Using GRanges and IRanges to simply get all chromosome data
2
1
Entering edit mode
Kyle Johnsen ▴ 30
@kyle-johnsen-11443
Last seen 5.8 years ago
United States/Brigham Young University

Hi!

I have basically two questions. I'm trying to analyze RNA-seq data, contained in BAM files, using applyPileups. The ApplyPileupsParam, however, needs the 'which' paremeter, which needs a GRanges object.

Is there an easy way to, say, get all chromosomes from a file (not contigs)?

And since it seems to require an IRanges object for the 'ranges' parameter of the GRanges object, is there an easy way to simply get all the data from each chromosome? Or do I have to find then plug in the coordinates for each chromosome?

 

Thank you!

GRanges IRanges • 1.6k views
ADD COMMENT
3
Entering edit mode
@martin-morgan-1513
Last seen 4 months ago
United States

as(seqinfo(BamFile("your.bam")), "GRanges") (or BamFileList()) to query the seqinfo in the header of the bam file. GenomeInfoDb::keepStandardChromosomes() will trim to just the 'standard' chromosomes.

ADD COMMENT
1
Entering edit mode
@michael-lawrence-3846
Last seen 3.0 years ago
United States

I'm surprised it requires a which argument. You could just coerce the Seqinfo to a GRanges, e.g. for hg19:

as(Seqinfo(genome="hg19"), "GRanges")

 

ADD COMMENT

Login before adding your answer.

Traffic: 676 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6