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 java.io.Serializable;
28
29 public class ChrLoc implements Serializable {
30
31
32
33 private static final long serialVersionUID = 1L;
34
35 public int start;
36 public int end;
37 public String chr;
38
39 public ChrLoc() {
40 }
41
42 public ChrLoc(String chr, int start, int end) {
43 this.chr = chr;
44 this.start = start;
45 this.end = end;
46 }
47
48 public ChrLoc getLocForPositiveStrand() {
49 if (start < end)
50 return new ChrLoc(chr, start, end);
51 else
52 return new ChrLoc(chr, end, start);
53 }
54
55 public int length() {
56 return viewEnd() - viewStart();
57 }
58
59 public int viewStart() {
60 if (isSense())
61 return start;
62 else
63 return end;
64 }
65
66 public int viewEnd() {
67 if (isSense())
68 return end;
69 else
70 return start;
71 }
72
73 public boolean isSense() {
74 return start <= end;
75 }
76
77 public boolean isAntiSense() {
78 return !isSense();
79 }
80
81 @Override
82 public String toString() {
83 return chr + ":" + start + "-" + end;
84 }
85 }