[BioC] create CNA object in DNAcopy package with agilent data

Sean Davis sdavis2 at mail.nih.gov
Thu Sep 13 15:48:26 CEST 2007


jhs1jjm at leeds.ac.uk wrote:
> Could you possibly tell me what functions/package I need to look at in R in
> order to do this as I do not have excel and may well need to handle data that
> exceeds the maximum number of rows in openoffice.

`extractAgilentInfo` <-
  function(charvec) {
    tmp <- do.call(rbind,strsplit(charvec,':'))  #split chrom from locations
    tmp2 <- do.call(rbind,strsplit(tmp[,2],'-')) #split locations
    tmp3 <- sub('chr','',tmp[,1])  #convert to numeric chromosome if wanted
    tmp3[tmp3=='X'] <- 23   # May need to change these numbers to
    tmp3[tmp3=='Y'] <- 24   #   match your species
    tmp3 <- as.integer(tmp3)
    tmp[is.na(tmp3),1] <- NA

return(data.frame(chromosome=tmp[,1],location=as.integer(tmp2[,1]),NumChrom=tmp3))
  }

Use like so:

agilentInfo <- extractAgilentInfo(as.character(rawdat$SystematicName)

And you will get back a data.frame of what you need, I think.

Sean



More information about the Bioconductor mailing list