42 #include "../Sequence.h" 43 #include "../Container/SequenceContainer.h" 44 #include "../Container/VectorSequenceContainer.h" 45 #include <Bpp/Text/TextTools.h> 46 #include <Bpp/Text/StringTokenizer.h> 47 #include <Bpp/Io/FileTools.h> 55 if (!input) {
throw IOException (
"DCSE::read : fail to open file"); }
58 const Alphabet * alpha = sc.getAlphabet();
59 string line, name, sequence =
"";
61 line = FileTools::getNextLine(input);
73 line = FileTools::getNextLine(input);
75 string::size_type endOfSeq = line.find(
" ");
76 if(endOfSeq == line.npos)
break;
77 sequence = string(line.begin(), line.begin() +
static_cast<ptrdiff_t
>(endOfSeq));
78 sequence = TextTools::removeWhiteSpaces(sequence);
79 sequence = TextTools::removeChar(sequence,
'{');
80 sequence = TextTools::removeChar(sequence,
'}');
81 sequence = TextTools::removeChar(sequence,
'[');
82 sequence = TextTools::removeChar(sequence,
']');
83 sequence = TextTools::removeChar(sequence,
'(');
84 sequence = TextTools::removeChar(sequence,
')');
85 sequence = TextTools::removeChar(sequence,
'^');
86 name = string(line.begin() +
static_cast<ptrdiff_t
>(endOfSeq + 1), line.end()),
87 name = TextTools::removeFirstWhiteSpaces(name);
88 if(name.find(
"Helix numbering") == name.npos
89 && name.find(
"mask") == name.npos)
The SiteContainer interface.
void appendAlignmentFromStream(std::istream &input, SiteContainer &sc) const
Append sequences to a container from a stream.
This alphabet is used to deal NumericAlphabet.
const std::string getFormatName() const
const std::string getFormatDescription() const
A basic implementation of the Sequence interface.