Struct FastaRecord
Gives access to a single FASTA record. Does not copy the input sequence.
struct FastaRecord(T)
if (isSomeString!T);
Fields
Name | Type | Description |
data
|
T | FASTA data.
|
Properties
Name | Type | Description |
header [get]
|
auto | Get the complete header line including the leading > .
|
length [get]
|
size_t | Get the length of the sequence (in characters).
|
opDollar [get]
|
size_t | Get the length of the sequence (in characters).
|
Methods
Name | Description |
normalizeIndex
(i)
|
|
opIndex
()
|
Get the sequence of this FASTA record without newlines.
|
opIndex
(i)
|
Get the sequence character at index i of this FASTA record.
|
opIndex
(slice)
|
Get sub-sequence from i to j (exclusive) of this FASTA record.
|
opSlice
(i, j)
|
|
opSlice
(i, j)
|
|
toFasta
(lineWidth)
|
Get this record in FASTA format.
|
Example
auto fastaRecord1 = q"EOF
>sequence1
CTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCT
AACCCTAACCCTAACCCTAACCCTAACCCTAACAACCCTAACCCTAACCC
EOF".outdent.parseFastaRecord;
assert(fastaRecord1.header == ">sequence1");
assert(fastaRecord1[].equal("CTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACAACCCTAACCCTAACCC"));
assert(fastaRecord1[0 .. 5].equal("CTAAC"));
assert(fastaRecord1.toFasta(13).equal(q"EOF
>sequence1
CTAACCCTAACCC
TAACCCTAACCCT
AACCCTAACCCTA
ACCCTAACCCTAA
CCCTAACCCTAAC
CCTAACCCTAACC
CTAACAACCCTAA
CCCTAACCC
EOF".outdent));
auto fastaRecord2 = q"EOF
>sequence2
AAGCTGAGCAGGGCTTTAAAGCTATCTTATTAATAATTATTTCTGTATTG
TAACCCTAACCCTAAACCTAACCCTAACCCTAACCCTAACAACCCTAACC
EOF".outdent.parseFastaRecord;
assert(fastaRecord2.header == ">sequence2");
assert(fastaRecord2[].equal("AAGCTGAGCAGGGCTTTAAAGCTATCTTATTAATAATTATTTCTGTATTGTAACCCTAACCCTAAACCTAACCCTAACCCTAACCCTAACAACCCTAACC"));
assert(fastaRecord2[5 .. 10].equal("GAGCA"));
assert(fastaRecord2.toFasta(45).equal(q"EOF
>sequence2
AAGCTGAGCAGGGCTTTAAAGCTATCTTATTAATAATTATTTCTG
TATTGTAACCCTAACCCTAAACCTAACCCTAACCCTAACCCTAAC
AACCCTAACC
EOF".outdent));