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 #ifndef _U2_BAM_ALIGNMENT_H_
23 #define _U2_BAM_ALIGNMENT_H_
24 
25 #include <QFlags>
26 #include <QList>
27 #include <QMap>
28 #include <QVariant>
29 
30 #include <U2Core/U2Assembly.h>
31 
32 namespace U2 {
33 namespace BAM {
34 
35 class Alignment {
36 public:
37     class CigarOperation {
38     public:
39         enum Operation {
40             AlignmentMatch,
41             Insertion,
42             Deletion,
43             Skipped,
44             SoftClip,
45             HardClip,
46             Padding,
47             SequenceMatch,
48             SequenceMismatch
49         };
50         CigarOperation(int length, Operation operation);
51         int getLength() const;
52         Operation getOperation() const;
53         void setLength(int length);
54         void setOperation(Operation operation);
55 
56     private:
57         int length;
58         Operation operation;
59     };
60     Alignment();
61     int getReferenceId() const;
62     int getPosition() const;
63     int getBin() const;
64     int getMapQuality() const;
65     qint64 getFlags() const;
66     int getNextReferenceId() const;
67     QByteArray getNextReferenceName() const;
68     int getNextPosition() const;
69     int getTemplateLength() const;
70     const QByteArray &getName() const;
71     const QList<CigarOperation> &getCigar() const;
72     const QByteArray &getSequence() const;
73     const QByteArray &getQuality() const;
74     const QList<U2AuxData> &getAuxData() const;
75     void setReferenceId(int referenceId);
76     void setPosition(int position);
77     void setBin(int bin);
78     void setMapQuality(int mapQuality);
79     void setFlags(qint64 flags);
80     void setNextReferenceId(int nextReferenceId);
81     void setNextReferenceName(const QByteArray &nextReferenceName);
82     void setNextPosition(int nextPosition);
83     void setTemplateLength(int templateLength);
84     void setName(const QByteArray &name);
85     void setCigar(const QList<CigarOperation> &cigar);
86     void setSequence(const QByteArray &sequence);
87     void setQuality(const QByteArray &quality);
88     void setAuxData(const QList<U2AuxData> &aux);
89 
90     static int computeLength(const QList<CigarOperation> &cigar);
91     static int computeLength(const QList<U2CigarToken> &cigar);
92 
93 private:
94     int referenceId;
95     int position;
96     int bin;
97     int mapQuality;
98     qint64 flags;
99     int nextReferenceId;
100     QByteArray nextReferenceName;
101     int nextPosition;
102     int templateLength;
103     QByteArray name;
104     QList<CigarOperation> cigar;
105     QByteArray sequence;
106     QByteArray quality;
107     QList<U2AuxData> aux;
108 };
109 
110 }  // namespace BAM
111 }  // namespace U2
112 
113 #endif  // _U2_BAM_ALIGNMENT_H_
114