Expand description
I/O routines for MAFFT: FASTA, Clustal, PHYLIP, hat2, and localhom formats.
FASTA reading/writing delegates to noodles-fasta. The other formats are
MAFFT-specific or simple enough that we implement them directly.
Structs§
- Hat2
Matrix - MAFFT’s hat2 distance matrix format.
- Illegal
Residue - The first residue
seqcheckwould reject, in reading order.
Enums§
Functions§
- apply_
case_ convention - Apply C MAFFT’s residue-case convention to an already-parsed set: lowercase for DNA/RNA, uppercase for everything else.
- compute_
clustal_ marks - Compute CLUSTAL-format conservation marks per column.
- detect_
seq_ type - Detect whether sequences are DNA/RNA or protein by ATGC frequency.
- detect_
seq_ type_ with_ limit - find_
illegal_ residue - Scan
setthe way Cseqcheckdoes and return the first residue that is not in the alphabet forset.seq_type, orNonewhen every residue is legal. Gap characters (-) are part of both alphabets, so a gapped input passes. - normalize_
residues - Apply the FASTA reader’s residue filter to residues that are already in memory, so an in-memory caller ends up with exactly the bytes a FASTA round trip would have produced — and fails exactly where the reader would.
- read_
fasta - Read a FASTA file from a path into a
SequenceSet. - read_
fasta_ casepreserve - Read a FASTA file preserving case and non-standard residues — used
by
--anysymbol/--preservecase. Strips only newline, space and carriage return (matching C MAFFT’sreadData_pointer_casepreserve→charfilter,io.c:1329-1352); any other character — digits, tabs, punctuation, lowercase — is kept verbatim so the post-alignment restore pass can put the originals back. - read_
fasta_ from_ reader - Read FASTA from any buffered reader.
- read_
fasta_ from_ reader_ casepreserve - Like
read_fasta_from_readerbut preserves case and non-standard residues (seeread_fasta_casepreserve). - read_
hat2 - Read a hat2 distance matrix.
- read_
localhom_ table - Read a local homology table (hat3 format).
- residues_
are_ normalized truewhennormalize_residueswould returnrawunchanged, i.e. the residues already look like they came out of the FASTA reader. Lets a caller holding borrowed data skip the copy when nothing needs to change. Residues the reader would reject are not “unchanged”.- residues_
follow_ case_ convention truewhenapply_case_conventionwould leavedataunchanged for a set of typeseq_type: no uppercase letters for nucleotides, no lowercase letters otherwise.- seqcheck_
alphabet - The alphabet
seqchecktestssetagainst —mafft_scoring’s DNA alphabet for nucleotide sets, its protein alphabet otherwise. - write_
clustal - Write an alignment in Clustal format.
- write_
clustal_ full - Write an alignment in Clustal format with an optional header
comment (e.g. the alignment-mode label
FFT-NS-2). - write_
fasta - Write a
SequenceSetas FASTA to a file path. - write_
fasta_ to_ writer - Write a
SequenceSetas FASTA to any writer. - write_
fasta_ to_ writer_ with_ width - Write FASTA with a custom line width. Pass
0for unlimited (single line). - write_
hat2 - Write a hat2 distance matrix.
- write_
localhom_ table - Write a local homology table (hat3 format).
- write_
phylip - Write an alignment in interleaved PHYLIP format.