BioAlignments.jl icon indicating copy to clipboard operation
BioAlignments.jl copied to clipboard

Get reference and query from `PairwiseAlignment`

Open jakobnissen opened this issue 2 years ago • 2 comments

It would be nice if there were exported methods to get the reference and query form an alignment. Something like ref(aln) and seq(aln).

jakobnissen avatar Jul 23 '21 09:07 jakobnissen

The documentation mentions these

LongDNASeq([x for (x, _) in aln])  # create aligned `s1` with gaps
LongDNASeq([y for (_, y) in aln])  # create aligned `s2` with gaps

which can simply be written into small functions:

seq(aln::PairwiseAlignment) = LongDNASeq([y for (y, _) in aln])
ref(aln::PairwiseAlignment) = LongDNASeq([x for (_, x) in aln])

depending on which you determine to be reference and query you'd have to change the functionnames.

timoleistner avatar Jun 30 '22 13:06 timoleistner

The above mentioned gives you the gapped strings, to obtain the original sequences again you can do aln.a.seq and aln.b. I agree that some convenience functions would be nice though.

timoleistner avatar Jun 30 '22 13:06 timoleistner