[Bioc-sig-seq] Rsamtools

Steve Lianoglou mailinglist.honeypot at gmail.com
Wed Jan 27 23:18:06 CET 2010


Hi Karl,

On Wed, Jan 27, 2010 at 5:00 PM, Dykema, Karl <Karl.Dykema at vai.org> wrote:
> Hi all,
>
> We have been using Rsamtools to import BAM files also. On previous sequencing runs the BAM files were around 800 megs and I could import the entire BAM with .readAligned_bam(). Our new sequencing data creates larger BAM files and I am unable to import them like before. So, as Steve pointed out to me offline, I probably will need to import the reads from each chromosome individually. Unfortunately it does not seem to be recognizing my chromosome names, error msg below. Has anyone had a similar problem or recognize something that I might be doing incorrectly? Thanks in advance.
>
>
>> which <- RangesList(chr1=IRanges(start=1,end=247249719))
>> params <- ScanBamParam(which=which)
>>
>> chr1reads <- scanBam("../aln.sorted.nodupes.bam",param=params)
> Error in function (bam, tmpl, space, start, end)  : failed to scan BAM
>  file: �
>  last record: 0
> In addition: Warning message:
> In function (bam, tmpl, space, start, end)  : 'space' not in BAM header
>  file: ../aln.sorted.nodupes.bam
>  space: chr1

Perhaps the chromosome names are different in your BAM file. I think
you can list them using samtools, like so (from the command line):

$ samtools view -H aln.sorted.nodupes.bam

You should get a lot of lines that start with @SQ -- the names of "the
spaces" are there, some of the output from one of my files looks like:

@SQ	SN:chr1	LN:247249719
@SQ	SN:chr2	LN:242951149
@SQ	SN:chr3	LN:199501827
...

That's why this works for me:

which <- RangesList(chr1=IRanges(start=1,end=247249719))

Maybe your's might look like:

@SQ	SN:chromo1	LN:247249719
@SQ	SN:chromo2	LN:242951149
@SQ	SN:chromo3	LN:199501827

(or something)

Then the appropriate call for you would be:

which <- RangesList(chromo1=IRanges(start=1,end=247249719))

Does that work for you?

-steve

-- 
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact



More information about the Bioc-sig-sequencing mailing list