Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get the gap/mismatch positions of alignment #4731

Open
leon945945 opened this issue May 18, 2024 · 2 comments
Open

How to get the gap/mismatch positions of alignment #4731

leon945945 opened this issue May 18, 2024 · 2 comments

Comments

@leon945945
Copy link

Hi, as the title descripts, can biopython get the gap/mismatch positions of alignment, I didn't find a function to implement it.

@leon945945
Copy link
Author

Hi, maybe I find how to get the mismatch position.
A for-loop will solve the problem.

def get_mis_pos(align):
    pos = []
    for i in range(align.get_alignment_length()):
        if align[0][i]!=align[1][i] and align[0][i]!="-" and align[1][i]!="-":
            pos.append(i)
    return pos 

@peterjc
Copy link
Member

peterjc commented May 20, 2024

You didn't make it clear which kind of alignments in Biopython you were talking about, but perhaps the multiple sequence alignment object's counts method added in #4221 is what you want?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants