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

MAINT: adapt MotifPssmPattern to modern biopython #88

Merged

Conversation

MaozGelbart
Copy link
Contributor

@MaozGelbart MaozGelbart commented Oct 27, 2024

Hi,

Since biopython v1.82, Bio.Align.AlignInfo.PSSM class is deprecated (there's a v1.84 biopython out there already) and Bio.motifs.Motif is favored. Prior to this PR, the mentioned deprecated class serves as the input of the MotifPssmPattern constructor. However, the two helper class methods that load pssm files or alignment use Biopython's create/parse methods that return the recommended Bio.motifs.Motif objects. For example, the following code fails with biopython>=1.82:

from dnachisel import MotifPssmPattern

seqs = ['ACGT', 'ACCT', 'AAGT']
motif_name = "test motif"
MotifPssmPattern.from_sequences(seqs, name=motif_name, relative_threshold=0.9)

The result is the following error: AttributeError: 'PSSM' object has no attribute 'length'

The proposed PR adds a test case, changes the documented input class to MotifPssmPattern to the recommended Bio.motifs.Motif, validates the input as such, and fixes the motif loading logic of from_sequences according to the changes in newer biopython.

The proposed change suggests setting a minimally supported biopython version, but this seems beyond the scope of this PR.

@veghp
Copy link
Member

veghp commented Oct 30, 2024

Thank you! The test failed on an unrelated issue, so I'll have to fix that before merging into master.

@veghp veghp merged commit e368695 into Edinburgh-Genome-Foundry:dev Oct 30, 2024
@MaozGelbart MaozGelbart deleted the pssmmotif_from_sequences branch October 31, 2024 16:24
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

Successfully merging this pull request may close these issues.

2 participants