Commit a3adb644 authored by Mathieu Giraud's avatar Mathieu Giraud

core/fasta.cpp: defines and computes int* Sequence.seq

parent f00b60cb
......@@ -142,6 +142,7 @@ void OnlineFasta::next() {
current.label.erase();
current.sequence.erase();
current.quality.erase();
current.seq = NULL;
if (hasNext()) {
switch(line[0]) {
......@@ -189,6 +190,22 @@ void OnlineFasta::next() {
// Sequence in uppercase
transform(current.sequence.begin(), current.sequence.end(), current.sequence.begin(), (int (*)(int))toupper);
// Compute seq
current.seq = new int[current.sequence.length()];
for (int i=0; i< current.sequence.length(); i++)
{
int B ;
switch(current.sequence[i]) {
case 'A': B = 0; break;
case 'C': B = 1; break;
case 'G': B = 2; break;
case 'T': B = 3; break;
B = 4; break;
}
current.seq[i] = B ;
}
} else
unexpectedEOF();
}
......
......@@ -12,8 +12,9 @@ typedef struct read_t
{
string label_full;
string label;
string sequence;
string sequence; // Sequence: original string representation
string quality;
int* seq; // Sequence: seq representation
} Sequence;
typedef enum {
......
......@@ -97,6 +97,7 @@ Sequence create_sequence(string label_full, string label, string sequence, strin
seq.label = label;
seq.sequence = sequence;
seq.quality = quality;
// ! TODO: seq.seq, factorize with fasta.cpp
return seq;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment