MSA File

This module defines functions and classes for parsing, manipulating, and analyzing multiple sequence alignments.

class prody.sequence.msafile.MSAFile(msa, mode='r', format=None, aligned=True, **kwargs)[source]

Handle MSA files in FASTA, SELEX, CLUSTAL and Stockholm formats.

close()[source]

Close the file. This method will not affect a stream.

property closed

True for closed file.

property format

Format of the MSA file.

getFilename()[source]

Returns filename, or None if instance is handling a stream.

getFilter()[source]

Returns function used for filtering sequences.

getFormat()[source]

Returns file format.

getSlice()[source]

Returns object used to slice sequences.

getTitle()[source]

Returns title of the instance.

isAligned()[source]

Returns True if MSA is aligned.

reset()[source]

Returns to the beginning of the file.

setFilter(filter, filter_full=False)[source]

Set function used for filtering sequences. filter will be applied to split sequence label, by default. If filter_full is True, filter will be applied to the full label.

setSlice(slice)[source]

Set object used to slice sequences, which may be a slice() or a list() of numbers.

setTitle(title)[source]

Set title of the instance.

write(seq)[source]

Write seq, an Sequence instance, into the MSA file.

prody.sequence.msafile.parseMSA(filename, **kwargs)[source]

Returns an MSA instance that stores multiple sequence alignment and sequence labels parsed from Stockholm, SELEX, CLUSTAL, PIR, or FASTA format filename file, which may be a compressed file. Uncompressed MSA files are parsed using C code at a fraction of the time it would take to parse compressed files in Python.

prody.sequence.msafile.splitSeqLabel(label)[source]

Returns label, starting residue number, and ending residue number parsed from sequence label.

prody.sequence.msafile.writeMSA(filename, msa, **kwargs)[source]

Returns filename containing msa, a MSA or MSAFile instance, in the specified format, which can be SELEX, Stockholm, or FASTA. If compressed is True or filename ends with .gz, a compressed file will be written. MSA instances will be written using C function into uncompressed files.

Can also write CLUSTAL or PIR format files using Python functions.