42 #include <Bpp/Text/TextTools.h> 43 #include <Bpp/Text/StringTokenizer.h> 52 if (!input) {
throw IOException (
"GenBank::read: fail to open file"); }
54 string temp, name, sequence =
"";
59 getline(input, temp,
'\n');
61 if(temp.size() >= 9 && temp.substr(0,9) ==
"ACCESSION")
63 name = TextTools::removeSurroundingWhiteSpaces(temp.substr(10));
64 StringTokenizer st(name,
" ");
65 name = st.nextToken();
68 if (temp.size() >=6 && temp.substr(0,6) ==
"ORIGIN")
71 getline(input, temp,
'\n');
72 while (!input.eof() && temp.size() > 2 && temp.substr(0,2) !=
"//")
74 sequence += TextTools::removeWhiteSpaces(temp.substr(10));
75 getline(input, temp,
'\n');
77 if(name ==
"")
throw Exception(
"GenBank::read(). Sequence with no ACCESSION number!");
79 vsc.addSequence(*seq,
true);
This alphabet is used to deal NumericAlphabet.
A basic implementation of the Sequence interface.
The SequenceContainer interface.
void appendSequencesFromStream(std::istream &input, SequenceContainer &sc) const
Append sequences to a container from a stream.