BioJulia / BioAlignments.jl

Sequence alignment tools
MIT License
60 stars 24 forks source link

Get reference and query from `PairwiseAlignment` #55

Open jakobnissen opened 3 years ago

jakobnissen commented 3 years ago

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).

timoleistner commented 2 years ago

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 commented 2 years ago

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.