Hi everyone,
is there a way to introduce a specific artificial deletion in a bam file? I'm searching something that take a particular interval of coordinates and remove it from the bam file e.g. chrx:3122135-3425222
Hi everyone,
is there a way to introduce a specific artificial deletion in a bam file? I'm searching something that take a particular interval of coordinates and remove it from the bam file e.g. chrx:3122135-3425222
Forgive me if I wasn't very clear, I mean that I would need to remove the reads that map a certain chromosomal interval from the bam file.
samtools view -L deletions.bed -O BAM --unoutput output.bam in.bam > /dev/null
e I have to find a way that partially removes the reads and not all of them
split your bam with
samtools view --subsample 0.5 -O BAM --unoutput output1.bam -o output2.bam in.bam
remove reads with deletion from output2.bam
and then samtools merge
with output1.bam and output2.with_del.bam
If you just want to remove the reads, it's relatively easy.
If you want to simulate a truncation, this is difficult, because you will need to modify instead of remove the reads so they can cross both breakpoints of a truncation.
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
A bam file is a representation of (typically) sequencing reads mapped against a reference genome. Is is not clear what you want. Do you want for the reference genome to have the deletion? Or do you want to remove the reads mapping to that region?
Forgive me if I wasn't very clear, I mean that I would need to remove the reads that map a certain chromosomal interval from the bam file. I need these samples with the artificial deletions to test a tool I'm developing.