This isn't exactly what you asked for but sam2pairwise might work

It reconstructs the reference sequence versus the read, and if you had
interest you could probably grep the raw reference sequence out

https://github.com/mlafave/sam2pairwise

-Colin

On Thu, Jun 18, 2020, 8:27 PM John Crow <cro...@gmail.com> wrote:

> From a bam file I'd like to extract the alignment, for each aligning read,
> corresponding to the 10 bp region contig1:100-109 of the read, writing it
> as fasta. This would produce something like
>
> >1/1
> ACGTACGTAC
> >20/1
> ACGTAC-TAC
> >22/1
> C-GTACG-AC
>  . . .
>
> It seemed a combo of "samtools view ... contig1:100-109" and "samtools
> fasta" would do the trick but I haven't had luck with it yet. Any
> suggestions?
> _______________________________________________
> Samtools-help mailing list
> Samtools-help@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/samtools-help
>
_______________________________________________
Samtools-help mailing list
Samtools-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/samtools-help

Reply via email to