labblouin.FASTAnet module
A simple parser and writer for FASTA sequence files that uses a rich object hierarchy.
-
class labblouin.FASTAnet.FASTAsequence(name, seq)[source]
-
count(item)[source]
Return the number of characters in the sequence equal to input string.
-
removeGaps()[source]
Modify the sequence so gaps are removed and return it.
-
toLower()[source]
Return a lowercase version of the sequence, also changing it
in the structure.
-
toUpper()[source]
Modify the sequence so it is uppercase and return it.
-
class labblouin.FASTAnet.FASTAstructure(filein='', uniqueOnly=True, curate=False)[source]
-
addSequence(name, seq)[source]
Add a sequence to the FASTA object.
-
allLower()[source]
Change all sequences to lowercase.
-
allUpper()[source]
Change all sequences to uppercase.
-
getSequenceByName(n)[source]
-
getSequenceNames()[source]
-
getSequences()[source]
-
getStrictlyUngappedPositions(seqInds=None)[source]
Acquire the positions of all strictly ungapped sites. If parameter
is set, expects a list of what sequences (by index) you are checking.
Defaults to all sequences.
-
read(fast)[source]
Read the contents of a FASTA file.
-
readFile(fin)[source]
Read a file in. Return this FASTA object.
-
removeGaps()[source]
Remove the gaps for all sequences.
-
removeSequence(name)[source]
Remove a sequence from the FASTA object and
return it; or return None if it was not found.
-
renameSequence(oldname, newname)[source]
Renames a given sequence.
-
reorderSequences(iterable)[source]
Reorder all sequences by an iterable sequence
of their names.
-
writeFile(fout)[source]
Write the information currently contained in the
FASTAstructure to a file as a FASTA-formatted file.