skbio.core.sequence.NucleotideSequence.to_fasta

NucleotideSequence.to_fasta(field_delimiter=' ', terminal_character='n')[source]

Return the sequence as a fasta-formatted string

Parameters:

field_delimiter : str, optional

The character(s) to use on the header line between the self.id and self.description.

terminal_character : str, optional

The last character to be included in the result (if you don’t want a trailing newline or other character in the result, you can pass terminal_character="").

Returns:

str

The BiologicalSequence as a fasta-formatted string.

See also

__str__

Examples

>>> from skbio.core.sequence import BiologicalSequence
>>> s = BiologicalSequence('ACACGACGTT')
>>> print s.to_fasta(terminal_character="")
>
ACACGACGTT
>>> t = BiologicalSequence('ACA',id='my-seq',description='h')
>>> print t.to_fasta(terminal_character="")
>my-seq h
ACA