70 "Input file format not recognized.");
104 const vector<TLineInfo> lineInfos)
107 const char* errTempl(
"Bad character [%c] found at data position %d.");
112 const string& alphabet = sequenceInfo.
Alphabet();
113 const string legalInHead =
115 const string legalInBody =
119 + sequenceInfo.
Match();
120 const string legalInTail =
125 for (
auto lineInfo: lineInfos) {
126 if (lineInfo.mData.empty()) {
129 string seqData(lineInfo.mData);
132 auto startBody = seqData.find_first_not_of(legalInHead);
133 if (startBody == string::npos) {
136 seqPart = ESeqPart::BODY;
137 seqData = seqData.substr(startBody);
138 if (alphabet.find(seqData[0]) == string::npos) {
139 auto linePos = lineInfo.mData.size() - seqData.size();
140 string description =
ErrorPrintf(errTempl, seqData[0], linePos);
148 if (seqPart == ESeqPart::BODY) {
149 auto startTail = seqData.find_first_not_of(legalInBody);
150 if (startTail == string::npos) {
154 seqData = seqData.substr(startTail);
157 auto startBad = seqData.find_first_not_of(legalInTail);
158 if (startBad == string::npos) {
161 auto linePos = lineInfo.mData.size() - seqData.size() + startBad;
163 errTempl, seqData[startBad], linePos);
181 alignInfo.
mIds.push_back(seqId);
190 for (
auto seqPart: sequence) {
205 for (
const auto& idInfo :
mSeqIds) {
206 if (seqId == idInfo.mData) {
207 existingInfo = idInfo;
212 string seqIdLower(seqId);
214 for (
const auto& idInfo :
mSeqIds) {
215 string idLower(idInfo.mData);
217 if (seqIdLower == idLower) {
218 existingInfo = idInfo;
236 auto seqIdCompare(
mSeqIds[index].mData);
237 if (seqId.size() != seqIdCompare.size()) {
241 return (seqId == seqIdCompare);
END_ENUM_INFO string ErrorPrintf(const char *format,...)
bool xSeqIdIsEqualToInfoAt(const string &seqId, int index)
virtual void xImportAlignmentData(CSequenceInfo &, CLineInput &)
virtual void xExportAlignmentData(SAlignmentFile &alignmentInfo)
vector< TLineInfo > mSeqIds
virtual void ProcessAlignmentFile(CSequenceInfo &, CLineInput &, SAlignmentFile &)
vector< vector< TLineInfo > > mSequences
virtual void xAdjustSequenceInfo(CSequenceInfo &)
ESeqIdComparison xGetExistingSeqIdInfo(const string &seqId, TLineInfo &existingInfo)
virtual void xVerifyAlignmentData(const CSequenceInfo &)
vector< TLineInfo > mDeflines
virtual void xVerifySingleSequenceData(const CSequenceInfo &, const TLineInfo &seqId, const vector< TLineInfo > seqData)
const string & Missing() const
const string & BeginningGap() const
const string & Alphabet() const
const string & MiddleGap() const
const string & EndGap() const
const string & Match() const
vector< string > mSequences
vector< TLineInfo > mDeflines
The NCBI C++ standard methods for dealing with std::string.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
static string & ToLower(string &str)
Convert string to lower case – string& version.
@ eAlnSubcode_BadDataChars
@ eAlnSubcode_UnsupportedFileFormat