pwem.convert.sequence module

class pwem.convert.sequence.SequenceHandler(sequence=None, iUPACAlphabet=8, doClean=True)[source]

Bases: object

alignSeq(referenceSeq)[source]
appendFile(fileName, seqID, sequence=None, name=None, seqDescription=None, type='fasta')[source]

Appends a sequence to the sequences in a file

downloadSeqFromDatabase(seqID, dataBase=None)[source]
getSequence()[source]

Returns the sequence as Bio.Seq.Seq object

getTypeFromFile(fileName)[source]

Returns the expected BioPython file type according to the filename

readSequenceFromFile(fileName, type='fasta', isAmino=True)[source]

From a sequences file, returns a dictionary with ther FIRST sequence info. Dictionary: {‘seqID’: seqID1, ‘sequence’: sequence1, ‘description’: description1, ‘alphabet’: alphabet1}

readSequencesFromFile(fileName, type='fasta', isAmino=True)[source]

From a sequences file, returns a list of dictionaries with each sequence info. Dictionary: [{‘seqID’: seqID1, ‘sequence’: sequence1, ‘description’: description1, ‘alphabet’: alphabet1},

…]

saveFile(fileName, seqID, sequence=None, name=None, seqDescription=None, type='fasta')[source]

Saves a single sequence into a specified file

saveFiles(fileName, seqIDs, sequences, names, seqDescriptions, type='fasta')[source]

Saves multiple sequences into a specified file

pwem.convert.sequence.alignBioPairwise2Sequences(structureSequenceId, structureSequence, userSequenceId, userSequence, outFileName)[source]

aligns two sequences and saves them to disk using fasta format

pwem.convert.sequence.alignClustalSequences(inFile, outFile)[source]
pwem.convert.sequence.alignMuscleSequences(inFile, outFile)[source]
pwem.convert.sequence.cleanSequence(alphabet, sequence)[source]

Remove all characters that are not in the alphabet :param alphabet: the alphabet to use as integer :param sequence: the sequence to clean

pwem.convert.sequence.cleanSequenceScipion(isAminoacid, iUPACAlphabet, sequence)[source]
pwem.convert.sequence.saveFileSequencesToAlign(SeqDic, inFile, type='fasta')[source]
pwem.convert.sequence.sequenceLength(filename, format='fasta')[source]