Search
Question: Subset bam file in R
0
gravatar for ferbecneu
12 days ago by
ferbecneu0
ferbecneu0 wrote:

Hi, I want to subset alignments in chromosome 7 from a BAM file and write a new BAM of only chr7 alignments.

I made this:

seq3<-"HF6_1_1fragmm9.bam"
seq3reads<-readGAlignments(seq3)
seq3chr7 <- seq3reads[seqnames(seq3reads) == 'chr7']

But I dont know how can I export seq3chr7 as a BAM file, can it be done?

Thank you very much!

ADD COMMENTlink modified 12 days ago by Michael Lawrence10k • written 12 days ago by ferbecneu0
0
gravatar for Michael Lawrence
12 days ago by
United States
Michael Lawrence10k wrote:

You could use the rtracklayer export() function. But I think you really want Rsamtools::filterBam() in this case.

ADD COMMENTlink written 12 days ago by Michael Lawrence10k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 341 users visited in the last hour