The support.bioconductor.org editor has been updated to markdown! Please see more info at: Tutorial: Updated Support Site Editor

Question: Subset bam file in R
0
gravatar for ferbecneu
10 weeks 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 10 weeks ago by Michael Lawrence10k • written 10 weeks ago by ferbecneu0
Answer: Subset bam file in R
0
gravatar for Michael Lawrence
10 weeks 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 10 weeks 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 16.09
Traffic: 422 users visited in the last hour