Skip to content

docs: Database with custom scoring example - #10

Open
valentynbez wants to merge 1 commit into
althonos:mainfrom
valentynbez:docs
Open

valentynbez wants to merge 1 commit into
althonos:mainfrom
valentynbez:docs

Conversation

@valentynbez

Copy link
Copy Markdown
Contributor

Copilot AI review requested due to automatic review settings January 5, 2026 11:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds documentation to the Database.__init__ method to demonstrate how to create a database with a custom scoring matrix alphabet, addressing issue #9 where users encountered a "database and score matrix have different alphabets" error when using Database and Aligner with custom scoring matrices separately.

  • Adds an example showing how to extract the alphabet from a custom scoring matrix and use it when creating a Database

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/pyopal/lib.pyx
>>> from scoring_matrices import ScoringMatrix
>>>
>>> alphabet = ScoringMatrix.from_name("VTML80").alphabet
>>> db = pyopal.Database(["ATGC", "TTCA"], alphabet=alphabet)

Copilot AI Jan 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example uses DNA sequences ("ATGC", "TTCA") with a protein scoring matrix (VTML80). VTML80 is designed for protein sequences, not DNA. Consider using protein sequences in the example to match the scoring matrix, such as sequences containing amino acid codes like "MVLIGWIFSLIFLLFLFGFLGLLLLLIIGIIFGFLGLLI" (from the issue example).

Suggested change
>>> db = pyopal.Database(["ATGC", "TTCA"], alphabet=alphabet)
>>> db = pyopal.Database(["MVLIGWIFSLIF", "LLFLFGFLGLLL"], alphabet=alphabet)

Copilot uses AI. Check for mistakes.
Comment thread src/pyopal/lib.pyx
>>>
>>> alphabet = ScoringMatrix.from_name("VTML80").alphabet
>>> db = pyopal.Database(["ATGC", "TTCA"], alphabet=alphabet)

Copilot AI Jan 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is trailing whitespace on this line. Please remove it to maintain code cleanliness.

Suggested change

Copilot uses AI. Check for mistakes.
Comment thread src/pyopal/lib.pyx
Comment on lines +493 to +494
>>> alphabet = ScoringMatrix.from_name("VTML80").alphabet
>>> db = pyopal.Database(["ATGC", "TTCA"], alphabet=alphabet)

Copilot AI Jan 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example demonstrates how to create a Database with a custom alphabet, but doesn't show how to use it with an Aligner to avoid the "database and score matrix have different alphabets" error mentioned in issue #9. Consider extending the example to show the complete workflow of creating both a Database and an Aligner with matching alphabets and performing alignment.

Suggested change
>>> alphabet = ScoringMatrix.from_name("VTML80").alphabet
>>> db = pyopal.Database(["ATGC", "TTCA"], alphabet=alphabet)
>>> scoring = ScoringMatrix.from_name("VTML80")
>>> alphabet = scoring.alphabet
>>> db = pyopal.Database(["ATGC", "TTCA"], alphabet=alphabet)
>>>
>>> # use the same scoring matrix/alphabet when creating the aligner
>>> aligner = pyopal.Aligner(scoring)
>>> result = aligner.align("ATGC", db)

Copilot uses AI. Check for mistakes.

This branch has not been deployed

No deployments
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.

Database and Aligner scoring matrix mismatch

2 participants