API¶
Package for parsing and generating FASTA files of biological sequences.
Use the tinyfasta.FastaParser
class to parse FASTA files.
To generate FASTA files use the tinyfasta.FastaRecord.create()
static
method to create tinyfasta.FastaRecord
instances, which can be written
to file.
-
class
tinyfasta.
Sequence
¶ Class representing a biological sequence.
-
add_sequence_line
(sequence_line)¶ Add a sequence line to the
tinyfasta.Sequence
instance.This function can be called more than once. Each time the function is called the
tinyfasta.Sequence
is extended by the sequence line provided.Parameters: sequence_line – string representing (part of) a sequence
-
format_line_length
(line_length=80)¶ Format line length used to represent the sequence.
The full sequence is stored as list of shorter sequences. These shorter sequences are used verbatim when writing out the
tinyfasta.FastaRecord
over several lines.Parameters: line_length – length of the sequences used to make up the full sequence
-
-
class
tinyfasta.
FastaRecord
(description)¶ Class representing a FASTA record.
-
class
Description
(description)¶ Description line in a
tinyfasta.FastaRecord
.-
update
(description)¶ Update the content of the description.
This function can be used to replace the existing description with a new one.
Parameters: description – new description string
-
-
FastaRecord.
add_sequence_line
(sequence_line)¶ Add a sequence line to the
tinyfasta.FastaRecord
instance.This function can be called more than once. Each time the function is called the
tinyfasta.sequence
is extended by the sequence line provided.Parameters: sequence_line – string representing (part of) a sequence
-
static
FastaRecord.
create
(description, sequence)¶ Return a FastaRecord.
Parameters: - description – description string
- sequence – full sequence string
Returns:
-
class
-
class
tinyfasta.
FastaParser
(fpath)¶ Class for parsing FASTA files.