Hi everyone, I noticed that the Bio.pairwise2 module has been deprecated, so I wanted to switch to Bio.Align.PairwiseAligner
in my scripts, as suggested by the warning message.
I used to do the following to calculate sequence identity and query coverage:
aln1, aln2, _, start_aln, end_aln = pairwise2.align.localds(x_seq, y_seq, blosum_matrix, -11, -1)[0]
identities = len([i for i,k in zip(aln1[start_aln:end_aln], aln2[start_aln:end_aln]) if i == k and i != '-'])
perc_ident = round(100 * (identities / (end_aln - start_aln)), 1)
query_cov = round(100 * ((end_aln - start_aln) / len(aln1)), 1)
With PairwiseAligner it looks like you can just print the aligned sequences, and I could not find a way to access the query and target gapped sequences (aln1 and aln2 variables above), so there is no way for me to calculate the sequence identity.
Can somebody help?
I think this point of view is different among generations: I never update a program or an operating system unless there is a very good reason to do so. To be clear, in my book having a newer version is not a good reason to update.
So while you are waiting for someone to answer your question, you can always go back to the BioPython version that worked for you.
I get your point, but if I can get rid of warning messages without silencing or ignoring them, I'm very happy to do so, especially if a module I'm using has been deprecated (I assume they had a good reason to do so). Anyway the current BioPython version is still working fine, I just get a warning message when I import pairwise2 suggesting to use something else and to let the developers know if you really still need that module. That's why I'm wondering whether it is possible to do the same I used to do with PairwiseAligner instead of pairwise2.
Do not delete posts that have received feedback. Redacting content is extremely bad etiquette and if done again, will get your user account suspended.
I've restored the content from Google cache.
FWIW, there are good reasons beyond it simply being a new version to update here. Pairwise in particular has been overhauled quite a bit in more recent versions of Biopython.