Question: Subset bam file in R
0
gravatar for ferbecneu
7 months 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 7 months ago by Michael Lawrence11k • written 7 months ago by ferbecneu0
Answer: Subset bam file in R
0
gravatar for Michael Lawrence
7 months ago by
United States
Michael Lawrence11k wrote:

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

ADD COMMENTlink written 7 months ago by Michael Lawrence11k
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: 244 users visited in the last hour