Closed wongs2 closed 1 year ago
Hi @wongs2
I agree. Unfortunately, the original WFA2-lib function only has an option to write to a file (rather than send to stdout), so Ive added that functionality instead. You can send the output to a file using:
a.cigar_print_pretty("hello.txt")
Hope that helps,
Kez
Thanks. Is it possible to have the call return the alignment as a string, in addition to the stdout?
I run into all the same issues it seems. A method to return the gapped pattern and likewise for the text would be extremely helpful. I can monkey patch that for now but it seems worth having in the package.
I have added a new property to the results object, so the pretty string can now be accessed:
from pywfa.align import WavefrontAligner
pattern = "TCTTTACTCGCGCGTTGGAGAAATACAATAGT"
text = "TCTATACTGCGCGTTTGGAGAAATAAAATAGT"
a = WavefrontAligner(pattern)
res = a(text)
print(res.pretty)
>>>
3M1X4M1D7M1I9M1X6M ALIGNMENT
1X1D1I1X ALIGNMENT.COMPACT
PATTERN TCTTTACTCGCGCGTT-GGAGAAATACAATAGT
|||*|||| ||||||| |||||||||*||||||
TEXT TCTATACT-GCGCGTTTGGAGAAATAAAATAGT
It will be more convenient to allow the option for cigar_print_pretty to print to string instead of stdout.