1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 package org.utgenome.gwt.utgb.client.bio;
26
27 import org.utgenome.gwt.utgb.client.util.Properties;
28
29
30
31
32
33
34
35 public class SAMRead extends SAMReadLight {
36 private static final long serialVersionUID = 1L;
37
38
39 public String rname;
40 public int mapq;
41 public String mrnm;
42 public int mStart;
43 public int iSize;
44 public String seq;
45 public String qual;
46 public Properties tag;
47
48 public String refSeq;
49
50 public SAMRead() {
51 super();
52 }
53
54 public SAMRead(int start, int end) {
55 super(start, end);
56 }
57
58 @Override
59 public String toString() {
60 StringBuilder sb = new StringBuilder();
61
62 sb.append("name=" + qname);
63 sb.append(", flag=" + flag);
64 sb.append(", start=" + start);
65 sb.append(", mapq=" + mapq);
66 sb.append(", cigar=" + cigar);
67 sb.append(", iSize=" + iSize);
68 sb.append(", tag=" + tag);
69
70 return sb.toString();
71 }
72
73 public boolean isMate(SAMRead other) {
74 if (this.isFirstRead()) {
75 if (other.isSecondRead())
76 return qname != null && qname.equals(other.qname);
77 }
78 else {
79 if (other.isFirstRead())
80 return qname != null && qname.equals(other.qname);
81 }
82 return false;
83 }
84
85 @Override
86 public String getSequence() {
87 return seq;
88 }
89
90 @Override
91 public String getQV() {
92 return qual;
93 }
94
95 @Override
96 public String getName() {
97 return qname;
98 }
99
100 @Override
101 public boolean isSense() {
102 return (flag & SAMReadFlag.FLAG_STRAND_OF_QUERY) == 0;
103 }
104
105 @Override
106 public boolean isAntiSense() {
107 return !isSense();
108 }
109
110 @Override
111 public void accept(OnGenomeDataVisitor visitor) {
112 visitor.visitSAMRead(this);
113 }
114
115 public boolean mateIsMappedToTheSameChr() {
116 return rname != null && rname.equals(mrnm);
117 }
118
119 }