Nuc MSA
Immutable multiple sequence alignment object, consisting of two or more NucSeqRecords with equal lengths. The data can then be regarded as a matrix of letters, with well defined columns. NucMSA also supports all read-only collection operations on the list of NucSeqRecords.
Please note while the Kotlin "x..y" range operator is supported, and works very similarly to Python's slice "x:y", y is inclusive here in Kotlin, and exclusive in Python.
Creating a NucMSA object: You will typically use Bio.AlignIO to read in alignments from files as NucMSA objects. You can also use Bio.Align to align sequences of uneven length and generate a MultipleSeqAlignment object.
You can also create a MultipleSeqAlignment object directly, with argument:
seqs - List of sequence records, required (type: ImmutableList
or List )
@throws IllegalStateException if seqs has less than two elements, or if the sequence records in seqs are not all of the same length.
from Bio.Seq import Seq from Bio.Seq import NucSeqRecord from Bio.Seq import MultipleSeqAlignment val record_1 = NucSeqRecord(Seq("ATCG"), "1") val record_2 = NucSeqRecord(Seq("ATCC"), "2") val alignment = NucMSA(listOf(record_1, record_2))
Functions
Returns the list of sequences in the NucMSA
Returns the number of sequences in the alignment.
Returns the list of sample names in the NucMSA
Function to filter the MSA by sample index based on the provided filterLambda. This will return another NucMSA. Note this will not work with negative indices
Function to return a NucMSA given a collection of both indices and sample names. Returns a subset of the NucSeqRecords in the NucMSA as a new NucMSA based on the provided indices and sample names. Note this will work with both positive and negative indices.
Returns a subset of the NucSeqRecords in the NucMSA as a NucMSA, based on the sample IntRange given. Kotlin range operator is "..". Indices start at zero. Note Kotlin IntRange are inclusive end, while Python slices exclusive end. Negative slices "-3..-1" start from the last base (i.e. would return the last three bases).
Function to filter the MSA by sample index based on the provided filterLambda. This will return another NucMSA.
Function to filter the NucMSA sites using a lambda function. This will return another NucMSA object Note this will not work with negative indices