synthaser.fasta
¶
This module contains some helper functions for handling FASTA format files/strings.
-
synthaser.fasta.
count
(fasta)¶ Counts sequences in an open FASTA file handle.
Iterates file and counts header lines. Then, seeks to start of the file and returns the count.
Parameters: fasta (file pointer) – An open file handle corresponding to a FASTA file. Returns: Total number of sequences in the file. Return type: count (int)
-
synthaser.fasta.
create
(header, sequence, limit=80)¶ Creates a FASTA format string from a header and sequence.
For example:
>>> fasta = create_fasta('header', 'AAAAABBBBBCCCCC', wrap=5) >>> print(fasta) >header AAAAA BBBBB CCCCC
Parameters: - header (str) – Name to use in FASTA definition line (i.e. >header).
- sequence (str) – The sequence corresponding to the header.
- limit (int) – Total characters per line before sequence is wrapped.
Returns: FASTA format string.
Return type: (str)
-
synthaser.fasta.
wrap
(sequence, limit=80)¶ Wraps sequences to limit characters per line.
Parameters: - sequence (str) – Sequence to be wrapped.
- limit (int) – Total characters per line.
Returns: Sequence wrapped to maximum limit characters per line.
Return type: (str)