pyprot.align package

Submodules

pyprot.align.align module

class Align(scoreMatrix)[source]

Bases: builtins.object

Represents an alignment matrix, used to determine the alignment score between two Sequences

__init__(scoreMatrix)[source]

Creates an AlignMatrix object that uses scoreMatrix as a scoring system between amino acids.

globalAlign(seqA, seqB, iniGapPenalty=1, extGapPenalty=None, semiGlobal=False, resultCount=-1)[source]

Returns all best global alignment between ‘seqA’ and ‘seqB’ with the provided initial and extended gap penalties. If ‘semiGlobal’ is True, allows alignment to discard the start and end of either Sequence. (this allows for better alignments when Sequences overlap only partially)

localAlign(seqA, seqB, iniGapPenalty=1, extGapPenalty=None, resultCount=1, subOptimalDepth=0)[source]

Returns n best local alignment between ‘seqA’ and ‘seqB’ with the provided initial and extended gap penalties, where n equals ‘resultCount’ (-1 for all). If ‘subOptimalDepth’ equals m, looks for m best suboptimal alignments as well.

multiAlign(Sequence, resultCount=1, subOptimalDepth=3)[source]

Returns n best local M.S.A. of ‘Sequence’ against the ScoreMatrix (which must be position-specific and provide gap penalties) where n equals ‘resultCount’ (-1 for all). If ‘subOptimalDepth’ equals m, looks for m best suboptimal alignments as well.

class Aligned(seqA, seqB, seqAStart, seqBStart, alignType, alignScore, scoreMatrix, isMultiple=False)[source]

Bases: builtins.object

Represents two aligned Sequences with some metadata about the alignment. Alignments can be two-sequences alignments or multiple sequence alignments.

__init__(seqA, seqB, seqAStart, seqBStart, alignType, alignScore, scoreMatrix, isMultiple=False)[source]
getBottomSequence()[source]

pyprot.align.blosum module

belongs(outSequence, group, minMatches)[source]

Returns True if there’s at least ‘minMatches’ matches between outSequence and any sequence from ‘group’; False otherwise. Size of all sequences is assumed to be equal.

blosumFromFasta(requiredIdentityPercent, *filepaths)[source]

Creates and returns a ScoreMatrix for all sequences in the provided ‘filepaths’, using the BLOSUM approach with an identity of at least ‘requiredIdentityPercent’. Each file is grouped independently and only then their weighted probabilities are merged. :param requiredIdentityPercent: :param filepaths:

blosumFromProbabilities(probPairs, probSingle, requiredIdentityPercent)[source]

Fills and returns a Score according to the BLOSUM algorithm, from the probabilities of AA pairs and singletons provided in ‘probPairs’ and ‘probSingle’.

getFrequencies(groupValues, groupSizes)[source]

Evaluates the frequencies of AminoAcids within columns of groups in ‘groupValues’. Frequencies are weighted according to group sizes in ‘groupSizes’. Returns two dictionaries and a number: -‘freqPairs’ maps pairs of AminoAcids to their frequencies -‘freqSingle’ maps single AminoAcids to their frequencies -‘freqSum’ is the sum of all frequencies

makeGroupsFromFasta(path, requiredIdentityPercent)[source]

Loads Sequences from file at ‘path’ and separate them in groups with an identity of at least ‘requiredIdentityPercent’. Returns a list representing the groups as lists of Protein objects.

sumFrequenciesToProb(freqPairsList, freqSingleList, freqSumList)[source]

Sums all frequencies in provided lists, and transforms them to probabilities according to the sum of frequencies found in ‘freqSumList’.

valueDictsFromGroups(groups)[source]

Transforms each group from ‘groups’ into a list of dictionaries, one for each Protein column. The dictionaries map each AminoAcid found in that column to their count. Returns the list of dictionaries and a list of the size (in Sequences) of their groups.

pyprot.align.score module

class PSSM(description='')[source]

Bases: builtins.object

Position Specific Score Matrix. Creates a profile for a series of aligned Sequences, and gives a score to each AA subsitution in a given column.

__init__(description='')[source]
add(Sequence)[source]
getDescription()[source]
getGapPenalty(columnIndex)[source]
getScore(aminoAcid, columnIndex)[source]
setGapPenalty(penalty, columnIndex=None)[source]
class ScoreMatrix(path='', description='', ignore=None)[source]

Bases: builtins.object

Represents a scoring matrix, used to determine the score between two Amino Acids

__init__(path='', description='', ignore=None)[source]

Creates a Score object. If ‘path’ is provided, loads the Score values from an iij file. Otherwise, creates a Score for all possible AminoAcids with values 0.

getScore(aa1, aa2)[source]

Get the score assigned to AminoAcids ‘aa1’, ‘aa2’.

setScore(aa1, aa2, score)[source]

Set the score assigned to AminoAcids ‘aa1’, ‘aa2’.

Module contents

Table Of Contents

Previous topic

pyprot package

Next topic

pyprot.base package

This Page