1 /**
2  * UGENE - Integrated Bioinformatics Tools.
3  * Copyright (C) 2008-2021 UniPro <ugene@unipro.ru>
4  * http://ugene.net
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02110-1301, USA.
20  */
21 
22 #include "DNASequenceObjectTests.h"
23 
24 #include <U2Core/AppContext.h>
25 #include <U2Core/DNASequenceObject.h>
26 #include <U2Core/DocumentModel.h>
27 #include <U2Core/GObject.h>
28 #include <U2Core/IOAdapter.h>
29 #include <U2Core/MultipleSequenceAlignmentObject.h>
30 #include <U2Core/U2OpStatusUtils.h>
31 #include <U2Core/U2SafePoints.h>
32 
33 namespace U2 {
34 
35 /* TRANSLATOR U2::GTest */
36 
37 #define DOC_ATTR "doc"
38 #define VALUE_ATTR "value"
39 #define SORT_ATTR "sort"
40 #define START_ATTR "seqstart"
41 #define OBJ_ATTR "obj"
42 #define SEQNAME_ATTR "seqname"
43 #define QUALITY_ATTR "quality"
44 #define POSITION_ATTR "pos"
45 
init(XMLTestFormat *,const QDomElement & el)46 void GTest_DNASequenceSize::init(XMLTestFormat *, const QDomElement &el) {
47     objContextName = el.attribute(OBJ_ATTR);
48     if (objContextName.isEmpty()) {
49         failMissingValue(OBJ_ATTR);
50         return;
51     }
52 
53     QString v = el.attribute(VALUE_ATTR);
54     if (v.isEmpty()) {
55         failMissingValue(VALUE_ATTR);
56         return;
57     }
58     bool ok = false;
59     seqSize = v.toInt(&ok);
60     if (!ok) {
61         failMissingValue(VALUE_ATTR);
62     }
63 }
64 
report()65 Task::ReportResult GTest_DNASequenceSize::report() {
66     GObject *obj = getContext<GObject>(this, objContextName);
67     if (obj == nullptr) {
68         stateInfo.setError(QString("wrong value: %1").arg(OBJ_ATTR));
69         return ReportResult_Finished;
70     }
71 
72     U2SequenceObject *mySequence = qobject_cast<U2SequenceObject *>(obj);
73     if (mySequence == nullptr) {
74         stateInfo.setError(QString("can't cast to sequence from: %1").arg(obj->getGObjectName()));
75         return ReportResult_Finished;
76     }
77     int tempLength = mySequence->getSequenceLength();
78     if (tempLength != seqSize) {
79         stateInfo.setError(QString("sequence size not matched: %1, expected %2 ").arg(tempLength).arg(seqSize));
80     }
81     return ReportResult_Finished;
82 }
83 
init(XMLTestFormat *,const QDomElement & el)84 void GTest_DNASequenceAlphabet::init(XMLTestFormat *, const QDomElement &el) {
85     objContextName = el.attribute(OBJ_ATTR);
86     if (objContextName.isEmpty()) {
87         failMissingValue(OBJ_ATTR);
88         return;
89     }
90 
91     alphabetId = el.attribute(VALUE_ATTR);
92     if (alphabetId.isEmpty()) {
93         failMissingValue(VALUE_ATTR);
94         return;
95     }
96 }
97 
report()98 Task::ReportResult GTest_DNASequenceAlphabet::report() {
99     GObject *obj = getContext<GObject>(this, objContextName);
100     if (obj == nullptr) {
101         stateInfo.setError(QString("wrong value: %1").arg(OBJ_ATTR));
102         return ReportResult_Finished;
103     }
104 
105     U2SequenceObject *mySequence = qobject_cast<U2SequenceObject *>(obj);
106     if (mySequence == nullptr) {
107         stateInfo.setError(QString("can't cast to sequence from: %1").arg(name));
108         return ReportResult_Finished;
109     }
110 
111     const DNAAlphabet *tempAlphabet = mySequence->getAlphabet();
112     assert(tempAlphabet != nullptr);
113 
114     if (tempAlphabet->getId() != alphabetId) {
115         stateInfo.setError(QString("Alphabet not matched: %1, expected %2 ").arg(tempAlphabet->getId()).arg(alphabetId));
116     }
117 
118     return ReportResult_Finished;
119 }
120 
init(XMLTestFormat *,const QDomElement & el)121 void GTest_DNASequencePart::init(XMLTestFormat *, const QDomElement &el) {
122     objContextName = el.attribute(OBJ_ATTR);
123     if (objContextName.isEmpty()) {
124         failMissingValue(OBJ_ATTR);
125         return;
126     }
127 
128     subseq = el.attribute(VALUE_ATTR).toLatin1();
129     if (subseq.isEmpty()) {
130         failMissingValue(VALUE_ATTR);
131         return;
132     }
133 
134     QString p = el.attribute(START_ATTR);
135     if (p.isEmpty()) {
136         failMissingValue(START_ATTR);
137         return;
138     }
139     bool ok = false;
140     startPos = p.toInt(&ok);
141     if (!ok) {
142         failMissingValue(START_ATTR);
143     }
144 }
145 
report()146 Task::ReportResult GTest_DNASequencePart::report() {
147     GObject *obj = getContext<GObject>(this, objContextName);
148     if (obj == nullptr) {
149         stateInfo.setError(QString("wrong value: %1").arg(OBJ_ATTR));
150         return ReportResult_Finished;
151     }
152 
153     U2SequenceObject *objSequence = qobject_cast<U2SequenceObject *>(obj);
154     if (objSequence == nullptr) {
155         stateInfo.setError(QString("can't cast to sequence from: %1").arg(obj->getGObjectName()));
156         return ReportResult_Finished;
157     }
158     if (objSequence->getSequenceLength() < startPos + subseq.length()) {
159         stateInfo.setError(QString("sequence size is less that region end: size=%1, region-end=%2, objectName=%3").arg(objSequence->getSequenceLength()).arg(startPos + subseq.length()).arg(obj->getGObjectName()));
160         return ReportResult_Finished;
161     }
162     QByteArray objSubSeq = objSequence->getSequenceData(U2Region(startPos, subseq.length()));
163     if (!objSequence->getAlphabet()->isCaseSensitive()) {
164         subseq = subseq.toUpper();
165     }
166     if (objSubSeq != subseq) {
167         stateInfo.setError(QString("region not matched: %1, expected %2").arg(objSubSeq.constData()).arg(subseq.constData()));
168         return ReportResult_Finished;
169     }
170     return ReportResult_Finished;
171 }
init(XMLTestFormat *,const QDomElement & el)172 void GTest_DNASequenceAlphabetType::init(XMLTestFormat *, const QDomElement &el) {
173     objContextName = el.attribute(OBJ_ATTR);
174     if (objContextName.isEmpty()) {
175         failMissingValue(OBJ_ATTR);
176         return;
177     }
178 
179     QString v = el.attribute(VALUE_ATTR);
180     if (v.isEmpty()) {
181         failMissingValue(VALUE_ATTR);
182         return;
183     }
184     if (v == "DNAAlphabet_RAW") {
185         alphabetType = DNAAlphabet_RAW;
186         return;
187     }
188     if (v == "DNAAlphabet_NUCL") {
189         alphabetType = DNAAlphabet_NUCL;
190         return;
191     }
192     if (v == "DNAAlphabet_AMINO") {
193         alphabetType = DNAAlphabet_AMINO;
194         return;
195     }
196     stateInfo.setError(QString("alphabetType not set %1").arg(VALUE_ATTR));
197     return;
198 }
report()199 Task::ReportResult GTest_DNASequenceAlphabetType::report() {
200     GObject *obj = getContext<GObject>(this, objContextName);
201     if (obj == nullptr) {
202         stateInfo.setError(QString("wrong value: %1").arg(OBJ_ATTR));
203         return ReportResult_Finished;
204     }
205 
206     U2SequenceObject *mySequence = qobject_cast<U2SequenceObject *>(obj);
207     if (mySequence == nullptr) {
208         stateInfo.setError(QString("can't cast to sequence from: %1").arg(obj->getGObjectName()));
209         return ReportResult_Finished;
210     }
211     const DNAAlphabet *tempAlphabet = mySequence->getAlphabet();
212     if (tempAlphabet->getType() != alphabetType) {
213         stateInfo.setError(QString("Alphabet type not matched: %1, expected %2").arg(tempAlphabet->getType()).arg(alphabetType));
214     }
215     return ReportResult_Finished;
216 }
init(XMLTestFormat *,const QDomElement & el)217 void GTest_DNASequenceAlphabetId::init(XMLTestFormat *, const QDomElement &el) {
218     objContextName = el.attribute(OBJ_ATTR);
219     if (objContextName.isEmpty()) {
220         failMissingValue(OBJ_ATTR);
221         return;
222     }
223 
224     alpId = el.attribute(VALUE_ATTR);
225     if (alpId.isEmpty()) {
226         failMissingValue(VALUE_ATTR);
227         return;
228     }
229     return;
230 }
report()231 Task::ReportResult GTest_DNASequenceAlphabetId::report() {
232     GObject *obj = getContext<GObject>(this, objContextName);
233     if (obj == nullptr) {
234         stateInfo.setError(QString("wrong value: %1").arg(OBJ_ATTR));
235         return ReportResult_Finished;
236     }
237 
238     U2SequenceObject *mySequence = qobject_cast<U2SequenceObject *>(obj);
239     if (mySequence == nullptr) {
240         stateInfo.setError(QString("can't cast to sequence from: %1").arg(obj->getGObjectName()));
241         return ReportResult_Finished;
242     }
243     const DNAAlphabet *tempAlphabet = mySequence->getAlphabet();
244     if (tempAlphabet->getId() != alpId) {
245         stateInfo.setError(QString("Alphabet id not matched: %1 expected %2").arg(tempAlphabet->getId()).arg(alpId));
246     }
247     return ReportResult_Finished;
248 }
249 
250 //----------------------------------------------------------
init(XMLTestFormat *,const QDomElement & el)251 void GTest_DNAcompareSequencesNamesInTwoObjects::init(XMLTestFormat *, const QDomElement &el) {
252     docContextName = el.attribute(DOC_ATTR);
253     if (docContextName.isEmpty()) {
254         failMissingValue(DOC_ATTR);
255         return;
256     }
257 
258     secondDocContextName = el.attribute(VALUE_ATTR);
259     if (secondDocContextName.isEmpty()) {
260         failMissingValue(VALUE_ATTR);
261         return;
262     }
263 }
264 
report()265 Task::ReportResult GTest_DNAcompareSequencesNamesInTwoObjects::report() {
266     Document *doc = getContext<Document>(this, docContextName);
267     if (doc == nullptr) {
268         stateInfo.setError(QString("document not found %1").arg(docContextName));
269         return ReportResult_Finished;
270     }
271     Document *doc2 = getContext<Document>(this, secondDocContextName);
272     if (doc2 == nullptr) {
273         stateInfo.setError(QString("document not found %1").arg(secondDocContextName));
274         return ReportResult_Finished;
275     }
276 
277     const QList<GObject *> &objs = doc->getObjects();
278     const QList<GObject *> &objs2 = doc2->getObjects();
279     GObject *obj = nullptr;
280     U2SequenceObject *mySequence = nullptr;
281     U2SequenceObject *mySequence2 = nullptr;
282 
283     for (int i = 0; (i != objs.size()) && (i != objs2.size()); i++) {
284         obj = objs.at(i);
285         GObject *obj2 = objs2.at(i);
286 
287         if ((obj->getGObjectType() == GObjectTypes::SEQUENCE) && (obj2->getGObjectType() == GObjectTypes::SEQUENCE)) {
288             mySequence = qobject_cast<U2SequenceObject *>(obj);
289             if (mySequence == nullptr) {
290                 stateInfo.setError(QString("can't cast to sequence from: %1 in position %2").arg(obj->getGObjectName()).arg(i));
291                 return ReportResult_Finished;
292             }
293             mySequence2 = qobject_cast<U2SequenceObject *>(obj2);
294             if (mySequence2 == nullptr) {
295                 stateInfo.setError(QString("can't cast to sequence from: %1 in position %2").arg(obj2->getGObjectName()).arg(i));
296                 return ReportResult_Finished;
297             }
298             if (mySequence->getGObjectName() != mySequence2->getGObjectName()) {
299                 stateInfo.setError(QString("Name of object in position %1 not matched: '%2' vs '%3'").arg(i).arg(mySequence->getGObjectName()).arg(mySequence2->getGObjectName()));
300                 return ReportResult_Finished;
301             }
302         }
303     }
304 
305     if (objs.size() != objs2.size()) {
306         QString error("Number of objects in doc mismatches: [%1=%2] vs [%3=%4]");
307         error = error.arg(docContextName).arg(objs.size()).arg(secondDocContextName).arg(objs2.size());
308         if (obj) {
309             error += QString("\nLast good object: %1").arg(obj->getGObjectName());
310         }
311         stateInfo.setError(error);
312     }
313 
314     return ReportResult_Finished;
315 }
316 
317 //----------------------------------------------------------
init(XMLTestFormat *,const QDomElement & el)318 void GTest_DNAcompareSequencesInTwoObjects::init(XMLTestFormat *, const QDomElement &el) {
319     docContextName = el.attribute(DOC_ATTR);
320     if (docContextName.isEmpty()) {
321         failMissingValue(DOC_ATTR);
322         return;
323     }
324 
325     secondDocContextName = el.attribute(VALUE_ATTR);
326     if (secondDocContextName.isEmpty()) {
327         failMissingValue(VALUE_ATTR);
328         return;
329     }
330 }
331 
report()332 Task::ReportResult GTest_DNAcompareSequencesInTwoObjects::report() {
333     Document *doc = getContext<Document>(this, docContextName);
334     if (doc == nullptr) {
335         stateInfo.setError(QString("document not found %1").arg(docContextName));
336         return ReportResult_Finished;
337     }
338     Document *doc2 = getContext<Document>(this, secondDocContextName);
339     if (doc2 == nullptr) {
340         stateInfo.setError(QString("document not found %1").arg(secondDocContextName));
341         return ReportResult_Finished;
342     }
343 
344     const QList<GObject *> &objs = doc->getObjects();
345     const QList<GObject *> &objs2 = doc2->getObjects();
346     GObject *obj = nullptr;
347     U2SequenceObject *mySequence = nullptr;
348     U2SequenceObject *mySequence2 = nullptr;
349 
350     for (int i = 0; (i != objs.size()) && (i != objs2.size()); i++) {
351         obj = objs.at(i);
352         GObject *obj2 = objs2.at(i);
353 
354         if ((obj->getGObjectType() == GObjectTypes::SEQUENCE) && (obj2->getGObjectType() == GObjectTypes::SEQUENCE)) {
355             mySequence = qobject_cast<U2SequenceObject *>(obj);
356             if (mySequence == nullptr) {
357                 stateInfo.setError(QString("can't cast to sequence from: %1 in position %2").arg(obj->getGObjectName()).arg(i));
358                 return ReportResult_Finished;
359             }
360             mySequence2 = qobject_cast<U2SequenceObject *>(obj2);
361             if (mySequence2 == nullptr) {
362                 stateInfo.setError(QString("can't cast to sequence from: %1 in position %2").arg(obj2->getGObjectName()).arg(i));
363                 return ReportResult_Finished;
364             }
365             if (mySequence->getWholeSequenceData(stateInfo) != mySequence2->getWholeSequenceData(stateInfo)) {
366                 CHECK_OP(stateInfo, ReportResult_Finished);
367                 stateInfo.setError(QString("Sequences of object in position %1 not matched").arg(i));
368                 return ReportResult_Finished;
369             }
370             CHECK_OP(stateInfo, ReportResult_Finished);
371         }
372     }
373 
374     if (objs.size() != objs2.size()) {
375         QString error("Number of objects in doc mismatches: [%1=%2] vs [%3=%4]");
376         error = error.arg(docContextName).arg(objs.size()).arg(secondDocContextName).arg(objs2.size());
377         if (obj) {
378             error += QString("\nLast good object: %1").arg(obj->getGObjectName());
379         }
380         stateInfo.setError(error);
381     }
382 
383     return ReportResult_Finished;
384 }
385 
386 //----------------------------------------------------------
init(XMLTestFormat *,const QDomElement & el)387 void GTest_DNAcompareSequencesAlphabetsInTwoObjects::init(XMLTestFormat *, const QDomElement &el) {
388     docContextName = el.attribute(DOC_ATTR);
389     if (docContextName.isEmpty()) {
390         failMissingValue(DOC_ATTR);
391         return;
392     }
393 
394     secondDocContextName = el.attribute(VALUE_ATTR);
395     if (secondDocContextName.isEmpty()) {
396         failMissingValue(VALUE_ATTR);
397         return;
398     }
399 }
400 
report()401 Task::ReportResult GTest_DNAcompareSequencesAlphabetsInTwoObjects::report() {
402     Document *doc = getContext<Document>(this, docContextName);
403     if (doc == nullptr) {
404         stateInfo.setError(QString("document not found %1").arg(docContextName));
405         return ReportResult_Finished;
406     }
407     Document *doc2 = getContext<Document>(this, secondDocContextName);
408     if (doc2 == nullptr) {
409         stateInfo.setError(QString("document not found %1").arg(secondDocContextName));
410         return ReportResult_Finished;
411     }
412 
413     const QList<GObject *> &objs = doc->getObjects();
414     const QList<GObject *> &objs2 = doc2->getObjects();
415     GObject *obj = nullptr;
416     U2SequenceObject *mySequence = nullptr;
417     U2SequenceObject *mySequence2 = nullptr;
418 
419     for (int i = 0; (i != objs.size()) && (i != objs2.size()); i++) {
420         obj = objs.at(i);
421         GObject *obj2 = objs2.at(i);
422 
423         if ((obj->getGObjectType() == GObjectTypes::SEQUENCE) && (obj2->getGObjectType() == GObjectTypes::SEQUENCE)) {
424             mySequence = qobject_cast<U2SequenceObject *>(obj);
425             if (mySequence == nullptr) {
426                 stateInfo.setError(QString("can't cast to sequence from: %1 in position %2").arg(obj->getGObjectName()).arg(i));
427                 return ReportResult_Finished;
428             }
429             mySequence2 = qobject_cast<U2SequenceObject *>(obj2);
430             if (mySequence2 == nullptr) {
431                 stateInfo.setError(QString("can't cast to sequence from: %1 in position %2").arg(obj2->getGObjectName()).arg(i));
432                 return ReportResult_Finished;
433             }
434             if (mySequence->getAlphabet() != mySequence2->getAlphabet()) {
435                 stateInfo.setError(QString("Alphabets of object in position %1 not matched").arg(i));
436                 return ReportResult_Finished;
437             }
438         }
439     }
440 
441     if (objs.size() != objs2.size()) {
442         QString error("Number of objects in doc mismatches: [%1=%2] vs [%3=%4]");
443         error = error.arg(docContextName).arg(objs.size()).arg(secondDocContextName).arg(objs2.size());
444         if (obj) {
445             error += QString("\nLast good object: %1").arg(obj->getGObjectName());
446         }
447         stateInfo.setError(error);
448     }
449 
450     return ReportResult_Finished;
451 }
452 
453 //-----------------------------------------------------------------------------
init(XMLTestFormat *,const QDomElement & el)454 void GTest_DNAMulSequenceAlphabetId::init(XMLTestFormat *, const QDomElement &el) {
455     objContextName = el.attribute(OBJ_ATTR);
456     if (objContextName.isEmpty()) {
457         failMissingValue(OBJ_ATTR);
458         return;
459     }
460 
461     alpId = el.attribute(VALUE_ATTR);
462     if (alpId.isEmpty()) {
463         failMissingValue(VALUE_ATTR);
464         return;
465     }
466     return;
467 }
report()468 Task::ReportResult GTest_DNAMulSequenceAlphabetId::report() {
469     GObject *obj = getContext<GObject>(this, objContextName);
470     if (obj == nullptr) {
471         stateInfo.setError(QString("wrong value: %1").arg(OBJ_ATTR));
472         return ReportResult_Finished;
473     }
474 
475     MultipleSequenceAlignmentObject *myMSequence = qobject_cast<MultipleSequenceAlignmentObject *>(obj);
476     if (myMSequence == nullptr) {
477         stateInfo.setError(QString("can't cast to sequence from: %1").arg(obj->getGObjectName()));
478         return ReportResult_Finished;
479     }
480     const DNAAlphabet *tempAlphabet = myMSequence->getAlphabet();
481     if (tempAlphabet->getId() != alpId) {
482         stateInfo.setError(QString("Alphabet id not matched: %1 expected %2").arg(tempAlphabet->getId()).arg(alpId));
483     }
484     return ReportResult_Finished;
485 }
486 
487 //-----------------------------------------------------------------------------
488 
init(XMLTestFormat *,const QDomElement & el)489 void GTest_DNAMulSequenceSize::init(XMLTestFormat *, const QDomElement &el) {
490     objContextName = el.attribute(OBJ_ATTR);
491     if (objContextName.isEmpty()) {
492         failMissingValue(OBJ_ATTR);
493         return;
494     }
495 
496     QString v = el.attribute(VALUE_ATTR);
497     if (v.isEmpty()) {
498         failMissingValue(VALUE_ATTR);
499         return;
500     }
501     bool ok = false;
502     seqSize = v.toInt(&ok);
503     if (!ok) {
504         failMissingValue(VALUE_ATTR);
505     }
506 }
507 
report()508 Task::ReportResult GTest_DNAMulSequenceSize::report() {
509     GObject *obj = getContext<GObject>(this, objContextName);
510     if (obj == nullptr) {
511         stateInfo.setError(QString("wrong value: %1").arg(OBJ_ATTR));
512         return ReportResult_Finished;
513     }
514 
515     MultipleSequenceAlignmentObject *myMSequence = qobject_cast<MultipleSequenceAlignmentObject *>(obj);
516     if (myMSequence == nullptr) {
517         stateInfo.setError(QString("can't cast to sequence from: %1").arg(obj->getGObjectName()));
518         return ReportResult_Finished;
519     }
520     int tempLength = myMSequence->getLength();
521     if (tempLength != seqSize) {
522         stateInfo.setError(QString("sequence size not matched: %1, expected %2 ").arg(tempLength).arg(seqSize));
523     }
524     return ReportResult_Finished;
525 }
526 
527 //-----------------------------------------------------------------------------
528 
init(XMLTestFormat *,const QDomElement & el)529 void GTest_DNAMulSequencePart::init(XMLTestFormat *, const QDomElement &el) {
530     objContextName = el.attribute(OBJ_ATTR);
531     if (objContextName.isEmpty()) {
532         failMissingValue(OBJ_ATTR);
533         return;
534     }
535 
536     subseq = el.attribute(VALUE_ATTR).toLatin1();
537     if (subseq.isEmpty()) {
538         failMissingValue(VALUE_ATTR);
539         return;
540     }
541 
542     QString p = el.attribute(START_ATTR);
543     if (p.isEmpty()) {
544         failMissingValue(START_ATTR);
545         return;
546     }
547     bool ok = false;
548     startPos = p.toInt(&ok);
549     if (!ok) {
550         failMissingValue(START_ATTR);
551     }
552 
553     seqName = el.attribute(SEQNAME_ATTR);
554     if (seqName.isEmpty()) {
555         failMissingValue(SEQNAME_ATTR);
556         return;
557     }
558 }
559 
report()560 Task::ReportResult GTest_DNAMulSequencePart::report() {
561     GObject *obj = getContext<GObject>(this, objContextName);
562     if (obj == nullptr) {
563         stateInfo.setError(QString("wrong value: %1").arg(OBJ_ATTR));
564         return ReportResult_Finished;
565     }
566 
567     MultipleSequenceAlignmentObject *myMSequence = qobject_cast<MultipleSequenceAlignmentObject *>(obj);
568     if (myMSequence == nullptr) {
569         stateInfo.setError(QString("can't cast to sequence from: %1").arg(obj->getGObjectName()));
570         return ReportResult_Finished;
571     }
572 
573     if (myMSequence->getLength() < startPos + subseq.length()) {
574         stateInfo.setError(QString("sequence size is less that region end: size=%1, region-end=%").arg(myMSequence->getLength(), startPos + subseq.length()));
575         return ReportResult_Finished;
576     }
577 
578     if (!myMSequence->getAlphabet()->isCaseSensitive()) {
579         subseq = subseq.toUpper();
580     }
581     bool ok_flag = false;
582     U2OpStatus2Log os;
583     const MultipleSequenceAlignment ma = myMSequence->getMultipleAlignment();
584     foreach (const MultipleSequenceAlignmentRow &myItem, ma->getMsaRows()) {
585         if (myItem->getName() == seqName) {
586             ok_flag = true;
587             QByteArray objSubSeq = myItem->mid(startPos, subseq.length(), os)->toByteArray(os, subseq.length());
588             if (objSubSeq != subseq) {
589                 stateInfo.setError(QString("region not matched: %1, expected %2").arg(objSubSeq.constData()).arg(subseq.constData()));
590                 return ReportResult_Finished;
591             }
592         }
593     }
594     if (!ok_flag) {
595         stateInfo.setError(QString("no Sequence name: %1").arg(seqName));
596     }
597     return ReportResult_Finished;
598 }
599 
600 //-----------------------------------------------------------------------------
601 
init(XMLTestFormat *,const QDomElement & el)602 void GTest_DNAMulSequenceName::init(XMLTestFormat *, const QDomElement &el) {
603     objContextName = el.attribute(OBJ_ATTR);
604     if (objContextName.isEmpty()) {
605         failMissingValue(OBJ_ATTR);
606         return;
607     }
608 
609     seqName = el.attribute(SEQNAME_ATTR);
610     if (seqName.isEmpty()) {
611         failMissingValue(SEQNAME_ATTR);
612         return;
613     }
614 }
615 
report()616 Task::ReportResult GTest_DNAMulSequenceName::report() {
617     GObject *obj = getContext<GObject>(this, objContextName);
618     if (obj == nullptr) {
619         stateInfo.setError(QString("wrong value: %1").arg(OBJ_ATTR));
620         return ReportResult_Finished;
621     }
622 
623     MultipleSequenceAlignmentObject *myMSequence = qobject_cast<MultipleSequenceAlignmentObject *>(obj);
624     bool ok_flag = false;
625     const MultipleSequenceAlignment ma = myMSequence->getMultipleAlignment();
626     foreach (const MultipleSequenceAlignmentRow &myItem, ma->getMsaRows()) {
627         if (myItem->getName() == seqName) {
628             ok_flag = true;
629             break;
630         }
631     }
632     if (!ok_flag) {
633         stateInfo.setError(QString("no Sequence name: %1").arg(seqName));
634     }
635     return ReportResult_Finished;
636 }
637 
638 //-----------------------------------------------------------------------------
639 
init(XMLTestFormat *,const QDomElement & el)640 void GTest_DNAMulSequenceQuality::init(XMLTestFormat *, const QDomElement &el) {
641     objContextName = el.attribute(OBJ_ATTR);
642     if (objContextName.isEmpty()) {
643         failMissingValue(OBJ_ATTR);
644         return;
645     }
646 
647     seqName = el.attribute(SEQNAME_ATTR);
648     if (seqName.isEmpty()) {
649         failMissingValue(SEQNAME_ATTR);
650         return;
651     }
652 
653     expectedQuality = el.attribute(QUALITY_ATTR).toLatin1();
654     if (expectedQuality.isEmpty()) {
655         failMissingValue(QUALITY_ATTR);
656         return;
657     }
658 }
659 
report()660 Task::ReportResult GTest_DNAMulSequenceQuality::report() {
661     GObject *obj = getContext<GObject>(this, objContextName);
662     if (obj == nullptr) {
663         stateInfo.setError(QString("wrong object name: %1").arg(objContextName));
664         return ReportResult_Finished;
665     }
666 
667     MultipleSequenceAlignmentObject *myMSequence = qobject_cast<MultipleSequenceAlignmentObject *>(obj);
668     if (myMSequence == nullptr) {
669         stateInfo.setError(QString("Can not cast to alignment from: %1").arg(obj->getGObjectName()));
670         return ReportResult_Finished;
671     }
672 
673     bool ok_flag = false;
674     foreach (const MultipleSequenceAlignmentRow &myItem, myMSequence->getMsa()->getMsaRows()) {
675         if (myItem->getName() == seqName) {
676             ok_flag = true;
677             // QByteArray qualityCodes = myItem.getCoreQuality().qualCodes;
678             // if (qualityCodes != expectedQuality){
679             //     stateInfo.setError(
680             //         QString("Quality scores are not valid! The score is %1, expected %2").arg(qualityCodes.constData()).arg(expectedQuality.constData())
681             //         );
682             //     return ReportResult_Finished;
683             // }
684         }
685     }
686     if (!ok_flag) {
687         stateInfo.setError(QString("Sequence %1 is not found in the alignment").arg(seqName));
688     }
689     return ReportResult_Finished;
690 }
691 
692 //-----------------------------------------------------------------------------
693 
init(XMLTestFormat *,const QDomElement & el)694 void GTest_DNASequencInMulSequence::init(XMLTestFormat *, const QDomElement &el) {
695     objContextName = el.attribute(OBJ_ATTR);
696     if (objContextName.isEmpty()) {
697         failMissingValue(OBJ_ATTR);
698         return;
699     }
700 
701     QString v = el.attribute(VALUE_ATTR);
702     if (v.isEmpty()) {
703         failMissingValue(VALUE_ATTR);
704         return;
705     }
706     bool ok = false;
707     seqInMSeq = v.toInt(&ok);
708     if (!ok) {
709         failMissingValue(VALUE_ATTR);
710     }
711 }
712 
report()713 Task::ReportResult GTest_DNASequencInMulSequence::report() {
714     GObject *obj = getContext<GObject>(this, objContextName);
715     if (obj == nullptr) {
716         stateInfo.setError(QString("wrong value: %1").arg(OBJ_ATTR));
717         return ReportResult_Finished;
718     }
719 
720     MultipleSequenceAlignmentObject *myMSequence = qobject_cast<MultipleSequenceAlignmentObject *>(obj);
721     if (myMSequence == nullptr) {
722         stateInfo.setError(QString("can't cast to sequence from: %1").arg(obj->getGObjectName()));
723         return ReportResult_Finished;
724     }
725     int tempSize = myMSequence->getNumRows();
726     if (tempSize != seqInMSeq) {
727         stateInfo.setError(QString("numbers of Sequence not match: %1, expected %2 ").arg(tempSize).arg(seqInMSeq));
728     }
729     return ReportResult_Finished;
730 }
731 //----------------------------------------------------------
init(XMLTestFormat *,const QDomElement & el)732 void GTest_DNAcompareMulSequencesInTwoObjects::init(XMLTestFormat *, const QDomElement &el) {
733     docContextName = el.attribute(DOC_ATTR);
734     if (docContextName.isEmpty()) {
735         failMissingValue(DOC_ATTR);
736         return;
737     }
738 
739     secondDocContextName = el.attribute(VALUE_ATTR);
740     if (secondDocContextName.isEmpty()) {
741         failMissingValue(VALUE_ATTR);
742         return;
743     }
744 
745     sortValue = el.attribute(SORT_ATTR);
746 }
747 
report()748 Task::ReportResult GTest_DNAcompareMulSequencesInTwoObjects::report() {
749     Document *doc = getContext<Document>(this, docContextName);
750     if (doc == nullptr) {
751         stateInfo.setError(QString("document not found %1").arg(docContextName));
752         return ReportResult_Finished;
753     }
754     Document *doc2 = getContext<Document>(this, secondDocContextName);
755     if (doc2 == nullptr) {
756         stateInfo.setError(QString("document not found %1").arg(secondDocContextName));
757         return ReportResult_Finished;
758     }
759 
760     const QList<GObject *> &objs = doc->getObjects();
761     const QList<GObject *> &objs2 = doc2->getObjects();
762     MultipleSequenceAlignmentObject *myMSequence = 0;
763     MultipleSequenceAlignmentObject *myMSequence2 = 0;
764 
765     for (int i = 0; (i != objs.size()) && (i != objs2.size()); i++) {
766         GObject *obj = objs.at(i);
767         GObject *obj2 = objs2.at(i);
768 
769         if (obj->getGObjectType() == GObjectTypes::MULTIPLE_SEQUENCE_ALIGNMENT) {
770             myMSequence = qobject_cast<MultipleSequenceAlignmentObject *>(obj);
771             if (myMSequence == nullptr) {
772                 stateInfo.setError(QString("can't cast to sequence from: %1 in position %2").arg(obj->getGObjectName()).arg(i));
773                 return ReportResult_Finished;
774             }
775         }
776         if (obj2->getGObjectType() == GObjectTypes::MULTIPLE_SEQUENCE_ALIGNMENT) {
777             myMSequence2 = qobject_cast<MultipleSequenceAlignmentObject *>(obj2);
778             if (myMSequence2 == nullptr) {
779                 stateInfo.setError(QString("can't cast to sequence from: %1 in position %2").arg(obj2->getGObjectName()).arg(i));
780                 return ReportResult_Finished;
781             }
782         }
783         if (myMSequence->getLength() != myMSequence2->getLength()) {
784             stateInfo.setError(QString("sequences size not matched: size1=%1, size2=%2").arg(myMSequence->getLength()).arg(myMSequence2->getMultipleAlignment()->getLength()));
785             return ReportResult_Finished;
786         }
787 
788         MultipleSequenceAlignment one = myMSequence->getMultipleAlignment();
789         MultipleSequenceAlignment two = myMSequence2->getMultipleAlignment();
790         const QList<MultipleSequenceAlignmentRow> alignedSeqs1 = one->getMsaRows();
791         const QList<MultipleSequenceAlignmentRow> alignedSeqs2 = two->getMsaRows();
792 
793         if (alignedSeqs1.size() != alignedSeqs2.size()) {
794             stateInfo.setError(QString("different_sequences_number_in_msa_in_%1_object").arg(i));
795             return ReportResult_Finished;
796         }
797 
798         if (sortValue == "true") {
799             one->sortRows(MultipleAlignment::SortByName);
800             two->sortRows(MultipleAlignment::SortByName);
801         }
802 
803         int seqSz = alignedSeqs1.size();
804         for (int n = 0; n < seqSz; n++) {
805             const MultipleSequenceAlignmentRow &myItem1 = alignedSeqs1.at(i);
806             const MultipleSequenceAlignmentRow &myItem2 = alignedSeqs2.at(i);
807             if (myItem1->getName() != myItem2->getName()) {
808                 stateInfo.setError(QString("names of regions in position %1 not matched: %2, expected %3").arg(n).arg(myItem2->getName()).arg(myItem1->getName()));
809                 return ReportResult_Finished;
810             }
811             if (*myItem1 != *myItem2) {
812                 stateInfo.setError(QString("sequence_#%1_in_msa_in_object_#%2_not_matched").arg(n).arg(i));
813             }
814         }
815     }
816 
817     return ReportResult_Finished;
818 }
819 
820 //----------------------------------------------------------
init(XMLTestFormat *,const QDomElement & el)821 void GTest_DNAcompareMulSequencesNamesInTwoObjects::init(XMLTestFormat *, const QDomElement &el) {
822     docContextName = el.attribute(DOC_ATTR);
823     if (docContextName.isEmpty()) {
824         failMissingValue(DOC_ATTR);
825         return;
826     }
827 
828     secondDocContextName = el.attribute(VALUE_ATTR);
829     if (secondDocContextName.isEmpty()) {
830         failMissingValue(VALUE_ATTR);
831         return;
832     }
833 }
834 
report()835 Task::ReportResult GTest_DNAcompareMulSequencesNamesInTwoObjects::report() {
836     Document *doc = getContext<Document>(this, docContextName);
837     if (doc == nullptr) {
838         stateInfo.setError(QString("document not found %1").arg(docContextName));
839         return ReportResult_Finished;
840     }
841     Document *doc2 = getContext<Document>(this, secondDocContextName);
842     if (doc2 == nullptr) {
843         stateInfo.setError(QString("document not found %1").arg(secondDocContextName));
844         return ReportResult_Finished;
845     }
846 
847     const QList<GObject *> &objs = doc->getObjects();
848     const QList<GObject *> &objs2 = doc2->getObjects();
849     GObject *obj = nullptr;
850     GObject *obj2 = nullptr;
851     MultipleSequenceAlignmentObject *myMSequence = 0;
852     MultipleSequenceAlignmentObject *myMSequence2 = 0;
853 
854     for (int i = 0; (i != objs.size()) && (i != objs2.size()); i++) {
855         obj = objs.at(i);
856         obj2 = objs2.at(i);
857 
858         if (obj->getGObjectType() == GObjectTypes::MULTIPLE_SEQUENCE_ALIGNMENT) {
859             myMSequence = qobject_cast<MultipleSequenceAlignmentObject *>(obj);
860             if (myMSequence == nullptr) {
861                 stateInfo.setError(QString("can't cast to sequence from: %1 in position %2").arg(obj->getGObjectName()).arg(i));
862                 return ReportResult_Finished;
863             }
864         }
865         if (obj2->getGObjectType() == GObjectTypes::MULTIPLE_SEQUENCE_ALIGNMENT) {
866             myMSequence2 = qobject_cast<MultipleSequenceAlignmentObject *>(obj2);
867             if (myMSequence2 == nullptr) {
868                 stateInfo.setError(QString("can't cast to sequence from: %1 in position %2").arg(obj2->getGObjectName()).arg(i));
869                 return ReportResult_Finished;
870             }
871         }
872         ////////////////////////////////////////
873         if (myMSequence->getLength() != myMSequence2->getLength()) {
874             stateInfo.setError(QString("sequences size not matched: size1=%1, size2=%").arg(myMSequence->getLength(), myMSequence2->getMultipleAlignment()->getLength()));
875             return ReportResult_Finished;
876         }
877         const MultipleSequenceAlignment one = myMSequence->getMultipleAlignment();
878         const MultipleSequenceAlignment two = myMSequence2->getMultipleAlignment();
879         const QList<MultipleSequenceAlignmentRow> &myQList1 = one->getMsaRows();
880         const QList<MultipleSequenceAlignmentRow> &myQList2 = two->getMsaRows();
881 
882         for (int n = 0; (n != myQList1.size()) || (n != myQList2.size()); n++) {
883             const MultipleSequenceAlignmentRow &myItem1 = myQList1.at(i);
884             const MultipleSequenceAlignmentRow &myItem2 = myQList2.at(i);
885             if (myItem1->getName() != myItem2->getName()) {
886                 stateInfo.setError(QString("names of regions in position %1 not matched: %2, expected %3").arg(n).arg(myItem2->getName()).arg(myItem1->getName()));
887                 return ReportResult_Finished;
888             }
889         }
890         //////////////////////////////////////////////////////////
891     }
892 
893     if (obj != objs.last()) {
894         stateInfo.setError(QString("number of objects in document not matches: %1").arg(obj2->getGObjectName()));
895         return ReportResult_Finished;
896     }
897     if (obj2 != objs2.last()) {
898         stateInfo.setError(QString("number of objects in document not matches: %1").arg(obj2->getGObjectName()));
899         return ReportResult_Finished;
900     }
901 
902     return ReportResult_Finished;
903 }
904 //----------------------------------------------------------
init(XMLTestFormat *,const QDomElement & el)905 void GTest_DNASequenceQualityScores::init(XMLTestFormat *, const QDomElement &el) {
906     objContextName = el.attribute(OBJ_ATTR);
907     if (objContextName.isEmpty()) {
908         failMissingValue(OBJ_ATTR);
909         return;
910     }
911 
912     qualityScores = el.attribute(QUALITY_ATTR).toLatin1();
913     if (qualityScores.isEmpty()) {
914         failMissingValue(QUALITY_ATTR);
915     }
916 }
917 
report()918 Task::ReportResult GTest_DNASequenceQualityScores::report() {
919     GObject *obj = getContext<GObject>(this, objContextName);
920     if (obj == nullptr) {
921         stateInfo.setError(QString("wrong value: %1").arg(OBJ_ATTR));
922         return ReportResult_Finished;
923     }
924 
925     U2SequenceObject *mySequence = qobject_cast<U2SequenceObject *>(obj);
926     if (mySequence == nullptr) {
927         stateInfo.setError(QString("Can't cast to sequence from: %1").arg(obj->getGObjectName()));
928         return ReportResult_Finished;
929     }
930 
931     const DNAQuality &quality = mySequence->getQuality();
932     if (quality.isEmpty()) {
933         stateInfo.setError("Sequence doesn't have quality scores");
934         return ReportResult_Finished;
935     }
936 
937     if (quality.qualCodes != qualityScores) {
938         stateInfo.setError(QString("Quality scores are not valid! The score is %1, expected %2").arg(quality.qualCodes.constData()).arg(qualityScores.constData()));
939         return ReportResult_Finished;
940     }
941 
942     return ReportResult_Finished;
943 }
944 
945 //----------------------------------------------------------
946 
init(XMLTestFormat *,const QDomElement & el)947 void GTest_DNASequenceQualityValue::init(XMLTestFormat *, const QDomElement &el) {
948     objContextName = el.attribute(OBJ_ATTR);
949     if (objContextName.isEmpty()) {
950         failMissingValue(OBJ_ATTR);
951         return;
952     }
953 
954     QString buf;
955     bool ok = false;
956     buf = el.attribute(POSITION_ATTR).toLatin1();
957     if (buf.isEmpty()) {
958         failMissingValue(POSITION_ATTR);
959     }
960 
961     pos = buf.toInt(&ok);
962     if (!ok) {
963         setError("Failed to parse sequence position");
964         return;
965     }
966 
967     ok = false;
968     buf = el.attribute(VALUE_ATTR).toLatin1();
969     if (buf.isEmpty()) {
970         failMissingValue(VALUE_ATTR);
971     }
972 
973     expectedVal = buf.toInt(&ok);
974     if (!ok) {
975         setError("Failed to parse expected value");
976         return;
977     }
978 }
979 
report()980 Task::ReportResult GTest_DNASequenceQualityValue::report() {
981     GObject *obj = getContext<GObject>(this, objContextName);
982     if (obj == nullptr) {
983         stateInfo.setError(QString("wrong value: %1").arg(OBJ_ATTR));
984         return ReportResult_Finished;
985     }
986 
987     U2SequenceObject *mySequence = qobject_cast<U2SequenceObject *>(obj);
988     if (mySequence == nullptr) {
989         stateInfo.setError(QString("Can't cast to sequence from: %1").arg(obj->getGObjectName()));
990         return ReportResult_Finished;
991     }
992 
993     const DNAQuality &quality = mySequence->getQuality();
994     if ((pos < 0) || (pos > quality.qualCodes.count() - 1)) {
995         stateInfo.setError(QString("Quality scores doesn't have position %1").arg(pos));
996         return ReportResult_Finished;
997     }
998 
999     int val = quality.getValue(pos);
1000 
1001     if (val != expectedVal) {
1002         stateInfo.setError(QString("Quality score values do not match! The score is %1, expected %2").arg(val).arg(expectedVal));
1003         return ReportResult_Finished;
1004     }
1005 
1006     return ReportResult_Finished;
1007 }
1008 
1009 //----------------------------------------------------------
init(XMLTestFormat *,const QDomElement & el)1010 void GTest_CompareDNASequenceQualityInTwoObjects::init(XMLTestFormat *, const QDomElement &el) {
1011     doc1CtxName = el.attribute("doc1");
1012     if (doc1CtxName.isEmpty()) {
1013         failMissingValue("doc1");
1014         return;
1015     }
1016 
1017     doc2CtxName = el.attribute("doc2");
1018     if (doc2CtxName.isEmpty()) {
1019         failMissingValue("doc2");
1020         return;
1021     }
1022 }
1023 
getSeqObj(Document * doc)1024 static U2SequenceObject *getSeqObj(Document *doc) {
1025     if (doc == nullptr) {
1026         return nullptr;
1027     }
1028 
1029     QList<GObject *> seqObjs = doc->findGObjectByType(GObjectTypes::SEQUENCE);
1030     if (seqObjs.isEmpty()) {
1031         return nullptr;
1032     }
1033     return qobject_cast<U2SequenceObject *>(seqObjs.first());
1034 }
1035 
report()1036 Task::ReportResult GTest_CompareDNASequenceQualityInTwoObjects::report() {
1037     U2SequenceObject *seq1Obj = getSeqObj(getContext<Document>(this, doc1CtxName));
1038     if (seq1Obj == nullptr) {
1039         setError(QString("Cannot find sequence object at '%1' document").arg(doc1CtxName));
1040         return ReportResult_Finished;
1041     }
1042 
1043     U2SequenceObject *seq2Obj = getSeqObj(getContext<Document>(this, doc2CtxName));
1044     if (seq2Obj == nullptr) {
1045         setError(QString("Cannot find sequence object at '%1' document").arg(doc2CtxName));
1046         return ReportResult_Finished;
1047     }
1048 
1049     const DNAQuality &quality1 = seq1Obj->getQuality();
1050     const DNAQuality &quality2 = seq2Obj->getQuality();
1051 
1052     if (quality1.type != quality2.type) {
1053         setError(QString("quality types not matched"));
1054         return ReportResult_Finished;
1055     }
1056     if (quality1.qualCodes != quality2.qualCodes) {
1057         setError(QString("quality codes not matched"));
1058         return ReportResult_Finished;
1059     }
1060     return ReportResult_Finished;
1061 }
1062 
1063 //----------------------------------------------------------
init(XMLTestFormat *,const QDomElement & el)1064 void GTest_DNAcompareMulSequencesAlphabetIdInTwoObjects::init(XMLTestFormat *, const QDomElement &el) {
1065     docContextName = el.attribute(DOC_ATTR);
1066     if (docContextName.isEmpty()) {
1067         failMissingValue(DOC_ATTR);
1068         return;
1069     }
1070 
1071     secondDocContextName = el.attribute(VALUE_ATTR);
1072     if (secondDocContextName.isEmpty()) {
1073         failMissingValue(VALUE_ATTR);
1074         return;
1075     }
1076 }
1077 
report()1078 Task::ReportResult GTest_DNAcompareMulSequencesAlphabetIdInTwoObjects::report() {
1079     Document *doc = getContext<Document>(this, docContextName);
1080     if (doc == nullptr) {
1081         stateInfo.setError(QString("document not found %1").arg(docContextName));
1082         return ReportResult_Finished;
1083     }
1084     Document *doc2 = getContext<Document>(this, secondDocContextName);
1085     if (doc2 == nullptr) {
1086         stateInfo.setError(QString("document not found %1").arg(secondDocContextName));
1087         return ReportResult_Finished;
1088     }
1089 
1090     const QList<GObject *> &objs = doc->getObjects();
1091     const QList<GObject *> &objs2 = doc2->getObjects();
1092     GObject *obj = nullptr;
1093     MultipleSequenceAlignmentObject *myMSequence = 0;
1094     MultipleSequenceAlignmentObject *myMSequence2 = 0;
1095 
1096     for (int i = 0; (i != objs.size()) && (i != objs2.size()); i++) {
1097         obj = objs.at(i);
1098         GObject *obj2 = objs2.at(i);
1099 
1100         if (obj->getGObjectType() == GObjectTypes::MULTIPLE_SEQUENCE_ALIGNMENT) {
1101             myMSequence = qobject_cast<MultipleSequenceAlignmentObject *>(obj);
1102             if (myMSequence == nullptr) {
1103                 stateInfo.setError(QString("can't cast to sequence from: %1 in position %2").arg(obj->getGObjectName()).arg(i));
1104                 return ReportResult_Finished;
1105             }
1106         }
1107         if (obj2->getGObjectType() == GObjectTypes::MULTIPLE_SEQUENCE_ALIGNMENT) {
1108             myMSequence2 = qobject_cast<MultipleSequenceAlignmentObject *>(obj2);
1109             if (myMSequence2 == nullptr) {
1110                 stateInfo.setError(QString("can't cast to sequence from: %1 in position %2").arg(obj2->getGObjectName()).arg(i));
1111                 return ReportResult_Finished;
1112             }
1113         }
1114         ////////////////////////////////////////
1115         const DNAAlphabet *tempAlphabet = myMSequence->getAlphabet();
1116         const DNAAlphabet *tempAlphabet2 = myMSequence2->getAlphabet();
1117         if (tempAlphabet->getId() != tempAlphabet2->getId()) {
1118             stateInfo.setError(QString("sequences alphabets not matched: alphabet1=%1, alphabet2=%").arg(tempAlphabet->getId(), tempAlphabet2->getId()));
1119             return ReportResult_Finished;
1120         }
1121         //////////////////////////////////////////////////////////
1122     }
1123 
1124     if (objs.size() != objs2.size()) {
1125         QString error("Number of objects in doc mismatches: [%1=%2] vs [%3=%4]");
1126         error = error.arg(docContextName).arg(objs.size()).arg(secondDocContextName).arg(objs2.size());
1127         if (obj) {
1128             error += QString("\nLast good object: %1").arg(obj->getGObjectName());
1129         }
1130         stateInfo.setError(error);
1131     }
1132 
1133     return ReportResult_Finished;
1134 }
1135 
1136 //-----------------------------------------------------------------------------
createTestFactories()1137 QList<XMLTestFactory *> DNASequenceObjectTests::createTestFactories() {
1138     QList<XMLTestFactory *> res;
1139     res.append(GTest_DNASequenceSize::createFactory());
1140     res.append(GTest_DNASequenceAlphabet::createFactory());
1141     res.append(GTest_DNASequencePart::createFactory());
1142     res.append(GTest_DNASequenceAlphabetType::createFactory());
1143     res.append(GTest_DNASequenceAlphabetId::createFactory());
1144     res.append(GTest_DNASequenceQualityScores::createFactory());
1145     res.append(GTest_CompareDNASequenceQualityInTwoObjects::createFactory());
1146     res.append(GTest_DNASequenceQualityValue::createFactory());
1147     res.append(GTest_DNAMulSequenceAlphabetId::createFactory());
1148     res.append(GTest_DNAMulSequenceSize::createFactory());
1149     res.append(GTest_DNAMulSequencePart::createFactory());
1150     res.append(GTest_DNASequencInMulSequence::createFactory());
1151     res.append(GTest_DNAcompareSequencesNamesInTwoObjects::createFactory());
1152     res.append(GTest_DNAcompareSequencesInTwoObjects::createFactory());
1153     res.append(GTest_DNAcompareSequencesAlphabetsInTwoObjects::createFactory());
1154     res.append(GTest_DNAcompareMulSequencesInTwoObjects::createFactory());
1155     res.append(GTest_DNAMulSequenceQuality::createFactory());
1156     res.append(GTest_DNAMulSequenceName::createFactory());
1157     res.append(GTest_DNAcompareMulSequencesNamesInTwoObjects::createFactory());
1158     res.append(GTest_DNAcompareMulSequencesAlphabetIdInTwoObjects::createFactory());
1159     return res;
1160 }
1161 
1162 }  // namespace U2
1163