R/getGRangesFormat.r

Defines functions getGRangesFormat

Documented in getGRangesFormat

getGRangesFormat <- function(segments){
  nc = ncol(segments)
  if(!is.multiseg(segments)){
    gr <- GRanges(seqnames=segments$chrom,
                ranges=IRanges(start=segments$start.pos,end=segments$end.pos,names=segments$sampleID))
    mcols(gr) <- DataFrame(segments[,c(3,6:nc)])            
  }else{
    gr <- GRanges(seqnames=segments$chrom,
                ranges=IRanges(start=segments$start.pos,end=segments$end.pos))
    mcols(gr) <- DataFrame(segments[,c(2,5:nc)])                   
  }
  
  return(gr)
  
}
igordot/copynumber documentation built on Sept. 18, 2020, 8:48 a.m.