Is it possible to clip (soft-clip preferably) n (for example, 3) nucleotides from both ends of reads in a bam file, but only for the reads with a certain defined read group?
I have merged bams for ancient DNA samples and the bams used for merging come from both UDG-treated and non-UDG-treated libraries. I would like to clip 3 nts from the ends of only the reads coming from non-UDG-treated libraries. These are marked by a label in Read Group: @RG LB:**dmg
So as a result I would like to have the same bam output but with the "dmg" labelled reads clipped
I hoped for gatk ClipReads or perhaps trimBam function of bamUtil to allow this but I haven't really found any clue as to whether and how that could be done.
Any tips appreciated.
Cheers, Martyna
Pierre Lindenbaum beat me to it
samtools split is new to me !
@Pierre Lindenbaum, @Istvan Albert, thanks a lot! My brain has somehow fixed on trying to do this in a single step.