[BioC] bam or sam for counting

Martin Morgan mtmorgan at fhcrc.org
Wed Nov 2 21:32:01 CET 2011


On 11/02/2011 01:22 PM, wang peter wrote:
> hi all:
>       usually in R, people like to use readGappedAlignments to read aligned
> bam files, it is only for
> saving momery? is there any function to read sam files?

convert the sam file to bam using Rsamtools::asBam, or use R's scan() 
and appropriate 'what=' argument; see ?scan, ?scanBam

>      for some data, especially for human, the bam file is still very large
> (more than 15 G), do you have some ways to
> deal with it partly?

use

   param = ScanBamParam(which=GRanges("chr3", IRanges(1, 10000)))

and then

   GenomicRanges::readGappedAlignments(bamFile, param=param)

or

   Rsamtools::readBamGappedAlignments(bamFile, param=param)

or

   Rsamtools::scanBam(bamFile, param=param)

'which' can be any GRanges object.

Martin

>       thx
>
> shan gao
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor


-- 
Computational Biology
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109

Location: M1-B861
Telephone: 206 667-2793



More information about the Bioconductor mailing list