This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Removing targeted sequences from contigs

Hi,

can anybody suggest a tool which aligns a targeted sequence (10 kb) against contigs/scaffolds or long reads, then removes that sequence from the contig and if necessary splits the contig into two if the undesired sequence is flanked by other sequence?

I could script this with BLAST or BWAmem coordinate alignments but I'd rather not reinvent the wheel if there is a tool which does this already. Most contaminant (adapter) trimming tools are designed for short stretches of sequence.

Thanks

genome alignment

1 answer

You might try BBMap's BBMask, which can mask a sequence using a sam file, converting all covered bases bases to N or lowercase. It can additionally split the result into contiguous sequences of unmasked bases only and discard the masked regions, which sounds like what you are looking for.

bbmask.sh in=sequence.fa sam=mapped.sam masklowentropy=f split=t out=split.fa

Log in to answer this question.