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