Debian Codegraph @

current/hiseq/FlowcellCoordinate.java

raw symbols SCIP
1 package hiseq;
2
3 public class FlowcellCoordinate implements Comparable<FlowcellCoordinate> {
4
5 public FlowcellCoordinate() {}
6
7 public FlowcellCoordinate(String id) {
8 setFrom(id);
9 }
10
11 // public float distance(FlowcellCoordinate fc){ //Comment out due to being unused
12 // assert(isSet());
13 // assert(fc.isSet());
14 //
15 // if(lane!=fc.lane){return big;}
16 //
17 // long a=Tools.absdif(x, fc.x), b=Tools.absdif(y, fc.y);
18 // if(tile!=fc.tile){
19 // return spanTiles ? Tools.min(a, b) : big;
20 // }
21 // return (float)Math.sqrt(a*a+b*b);
22 //
23 // //Hard to say... could consider adjacent tiles?
24 //// if(tile!=fc.tile){
25 //// if(allowAdjacentTiles && Tools.absdif(tile, fc.tile)<2){return Tools.min(x-fc.x, y-fc.y);}
26 //// return big;
27 //// }
28 ////
29 //// long a=x-fc.x, b=y-fc.y;
30 //// return (float)Math.sqrt(a*a+b*b);
31 // }
32
33 //2402:6:1101:6337:2237/1
34 //MISEQ08:172:000000000-ABYD0:1:1101:18147:1925 1:N:0:TGGATATGCGCCAATT
35 //HISEQ07:419:HBFNEADXX:1:1101:1238:2072
36 // public void setFrom_old(String id){
37 // final int lim=id.length();
38 //
39 // int i=0;
40 // int current=0;
41 // while(i<lim && id.charAt(i)!=' ' && id.charAt(i)!='/'){i++;}
42 // if(i>=lim){i--;}
43 // for(int semis=0; i>=0; i--){
44 // if(id.charAt(i)==':'){
45 // semis++;
46 // if(semis==4){break;}
47 // }
48 // }
49 // i++;
50 //
51 // assert(Tools.isDigit(id.charAt(i))) : id;
52 // while(i<lim && Tools.isDigit(id.charAt(i))){
53 // current=current*10+(id.charAt(i)-'0');
54 // i++;
55 // }
56 // lane=current;
57 // current=0;
58 // i++;
59 //
60 // if(!Tools.isDigit(id.charAt(i))){//Hiseq 3000?
61 // while(i<lim && id.charAt(i)!=':'){i++;}
62 // i++;
63 //
64 // assert(Tools.isDigit(id.charAt(i))) : id;
65 // while(i<lim && Tools.isDigit(id.charAt(i))){
66 // current=current*10+(id.charAt(i)-'0');
67 // i++;
68 // }
69 // lane=current;
70 // current=0;
71 // i++;
72 // }
73 //
74 // assert(Tools.isDigit(id.charAt(i))) : id;
75 // while(i<lim && Tools.isDigit(id.charAt(i))){
76 // current=current*10+(id.charAt(i)-'0');
77 // i++;
78 // }
79 // tile=current;
80 // current=0;
81 // i++;
82 //
83 // assert(Tools.isDigit(id.charAt(i))) : id;
84 // while(i<lim && Tools.isDigit(id.charAt(i))){
85 // current=current*10+(id.charAt(i)-'0');
86 // i++;
87 // }
88 // x=current;
89 // current=0;
90 // i++;
91 //
92 // assert(Tools.isDigit(id.charAt(i))) : id;
93 // while(i<lim && Tools.isDigit(id.charAt(i))){
94 // current=current*10+(id.charAt(i)-'0');
95 // i++;
96 // }
97 // y=current;
98 // current=0;
99 // i++;
100 // }
101
102 public void setFrom(String id){
103 ihp.parse(id);
104
105 lane=ihp.lane();
106 tile=ihp.tile();
107 x=ihp.xPos();
108 y=ihp.yPos();
109 if(parseUMI) {umi=ihp.index3();}
110 }
111
112 public boolean isSet(){
113 return lane>=0 && tile>=0 && x>=0 && y>=0;
114 }
115
116 @Override
117 public int compareTo(FlowcellCoordinate b) {
118 if(lane!=b.lane){return lane-b.lane;}
119 if(tile!=b.tile){return tile-b.tile;}
120 if(y!=b.y){return y-b.y;}
121 if(x!=b.x){return x-b.x;}
122 return 0;
123 }
124
125 public int lane=-1;
126 public int tile=-1;
127 public int x=-1;
128 public int y=-1;
129 public String umi;
130 private final IlluminaHeaderParser2 ihp=new IlluminaHeaderParser2();
131
132 public static final float big=10000000;
133 public static boolean parseUMI=false;
134 // public static boolean spanTiles=false;
135
136
137 public static FlowcellCoordinate getFC(){
138 FlowcellCoordinate fc=localFC.get();
139 if(fc==null){
140 fc=new FlowcellCoordinate();
141 localFC.set(fc);
142 }
143 return fc;
144 }
145 private static final ThreadLocal<FlowcellCoordinate> localFC=new ThreadLocal<FlowcellCoordinate>();
146
147 }