molforge.wrappers.msa¶
msa ¶
Local homology search — producing MSAs without a public server.
molforge's AF3-class folding wrappers have always sourced alignments from ColabFold's public MMseqs2 server. This subpackage is the local alternative: the same search, against a database you control, on a machine you can inspect.
- :class:
MMseqs2— fast profile search (Steinegger & Söding 2017), returning a :class:~molforge.sequence.MultipleSequenceAlignment.
Each engine needs its own pre-built database; molforge deliberately does not download or build those, since they run to hundreds of gigabytes and only need making once. The engines' errors name the command that does it.
MMseqs2 ¶
MMseqs2(
*,
database: str | PathLike[str] | None = None,
sensitivity: float | None = None,
max_seqs: int | None = None,
threads: int | None = None,
executable: str = "mmseqs",
timeout: float | None = None,
)
Search a sequence against a local MMseqs2 database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
database
|
str | PathLike[str] | None
|
Path to a pre-built MMseqs2 database — the |
None
|
sensitivity
|
float | None
|
MMseqs2's |
None
|
max_seqs
|
int | None
|
Cap on hits taken through to alignment
( |
None
|
threads
|
int | None
|
|
None
|
executable
|
str
|
Name or path of the |
'mmseqs'
|
timeout
|
float | None
|
Seconds before the search is abandoned. |
None
|
Example
from molforge.wrappers.msa import MMseqs2 engine = MMseqs2(database="/data/uniref90", sensitivity=7.5) msa = engine.search("MKQHKAMIVAL...") # doctest: +SKIP msa.depth # doctest: +SKIP 2041 shallow = msa.subsample(32, seed=0) # doctest: +SKIP
search ¶
Search sequence and return the alignment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sequence
|
str
|
A one-letter amino-acid sequence. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
A |
MultipleSequenceAlignment
|
class: |
MultipleSequenceAlignment
|
query is |
|
MultipleSequenceAlignment
|
database they came from. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
MMseqs2NotInstalledError
|
If the binary isn't on |
MSADatabaseNotFoundError
|
If no database is configured. |
RuntimeError
|
If a search step fails or produces no alignment. |
MMseqs2NotInstalledError ¶
Bases: RuntimeError
Raised when the mmseqs binary isn't on $PATH.
MSADatabaseNotFoundError ¶
Bases: RuntimeError
Raised when no MMseqs2 database was given, or the path isn't one.
mmseqs2 ¶
MMseqs2 homology search — a local alternative to the public MSA server.
molforge's AF3-class folding wrappers have always sourced their alignments from ColabFold's public MMseqs2 server. That is fine for a handful of predictions and increasingly hard to defend at scale: it is a shared community resource, it rate-limits, it requires network access from wherever the job runs, and it means the single most influential input to a prediction is produced somewhere you cannot inspect or reproduce.
MMseqs2 <https://github.com/soedinglab/MMseqs2>_ (Steinegger & Söding,
2017) is the same search, run locally against a database you control.
Installation::
conda install -c conda-forge -c bioconda mmseqs2
# or: brew install mmseqs2
The database¶
search needs a pre-built MMseqs2 database — a raw FASTA will not
do. Building one is a one-off:
.. code-block:: bash
mmseqs databases UniRef90 /data/uniref90 /tmp/mmseqs-tmp
Expect hundreds of gigabytes and hours of wall clock. molforge deliberately
does not wrap that step: it is not something anyone should be able to
trigger by accident from a notebook, and it only needs doing once per
machine. Point molforge at the result with database= or by setting
$MOLFORGE_MSA_DB.
What comes back¶
A :class:~molforge.sequence.MultipleSequenceAlignment, ready to subsample
down a depth ladder or hand to a folding engine. Searches are cached on the
same content-addressed basis as every other molforge engine result, which
matters more here than usual — a deep search is minutes to hours, and the
same query against the same database is the same answer.
MMseqs2NotInstalledError ¶
Bases: RuntimeError
Raised when the mmseqs binary isn't on $PATH.
MSADatabaseNotFoundError ¶
Bases: RuntimeError
Raised when no MMseqs2 database was given, or the path isn't one.
MMseqs2 ¶
MMseqs2(
*,
database: str | PathLike[str] | None = None,
sensitivity: float | None = None,
max_seqs: int | None = None,
threads: int | None = None,
executable: str = "mmseqs",
timeout: float | None = None,
)
Search a sequence against a local MMseqs2 database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
database
|
str | PathLike[str] | None
|
Path to a pre-built MMseqs2 database — the |
None
|
sensitivity
|
float | None
|
MMseqs2's |
None
|
max_seqs
|
int | None
|
Cap on hits taken through to alignment
( |
None
|
threads
|
int | None
|
|
None
|
executable
|
str
|
Name or path of the |
'mmseqs'
|
timeout
|
float | None
|
Seconds before the search is abandoned. |
None
|
Example
from molforge.wrappers.msa import MMseqs2 engine = MMseqs2(database="/data/uniref90", sensitivity=7.5) msa = engine.search("MKQHKAMIVAL...") # doctest: +SKIP msa.depth # doctest: +SKIP 2041 shallow = msa.subsample(32, seed=0) # doctest: +SKIP
search ¶
Search sequence and return the alignment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sequence
|
str
|
A one-letter amino-acid sequence. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
A |
MultipleSequenceAlignment
|
class: |
MultipleSequenceAlignment
|
query is |
|
MultipleSequenceAlignment
|
database they came from. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
MMseqs2NotInstalledError
|
If the binary isn't on |
MSADatabaseNotFoundError
|
If no database is configured. |
RuntimeError
|
If a search step fails or produces no alignment. |