Debian Codegraph @

current/sketch/Record.java

raw symbols SCIP
1 package sketch;
2
3 import java.util.HashMap;
4
5 class Record implements Cloneable, Comparable<Record> {
6
7 Record(ResultLineParser parser){
8 qTaxID=parser.qTaxID;
9 rTaxID=parser.rTaxID;
10 qBases=parser.qBases;
11 rBases=parser.rBases;
12 qSize=parser.qSize;
13 rSize=parser.rSize;
14 ani=parser.ani;
15 ssu=parser.ssu;
16 taxLevelExtended=parser.taxLevelExtended;
17 text=parser.text;
18 }
19
20 Record copy(){
21 try {
22 return (Record) this.clone();
23 } catch (CloneNotSupportedException e) {
24 // TODO Auto-generated catch block
25 e.printStackTrace();
26 }
27 return null;
28 }
29
30 public void processSSU(){
31 if(verbose){System.err.println("Record.processSSU(): qTaxID="+qTaxID+", rTaxID="+rTaxID+", ssu="+(float)ssu);}
32 final HashMap<Integer, byte[]> map=SSUMap.r16SMap;
33 if(ssu<=0 && map!=null){
34 byte[] qssu=map.get(qTaxID);
35 byte[] rssu=map.get(rTaxID);
36 if(qssu!=null && rssu!=null){
37 ssu=SketchObject.align(qssu, rssu);
38 if(verbose){System.err.println("Aligned; ssu="+(float)ssu);}
39 }else{
40 if(verbose){System.err.println("Missing: "+qTaxID+"="+qssu+", "+rTaxID+"="+rssu);}
41 }
42 }else{
43 if(verbose){System.err.println("Skipping: ssu="+(float)ssu+", map="+(map==null ? "null" : map.size()));}
44 }
45 }
46
47 @Override
48 public int compareTo(Record o) {
49 return ani>o.ani ? -1 : ani<o.ani ? 1 : 0;
50 }
51
52 public double ssu(){return ssu<=0 ? 0 : ssu;}
53
54 final int qTaxID;
55 final int rTaxID;
56 final long qBases;
57 final long rBases;
58 final long qSize;
59 final long rSize;
60 final double ani;
61 private double ssu=-1;
62 int taxLevelExtended;
63 int correctNCBI;//0 is false, 1 is true
64 int correctSSU;//0 is false, 1 is true
65 boolean missingSSU;
66 byte[] text;
67 //All records are correctNCBI there is no later record with a lower taxLevel.
68 //Records are correctSSU if:
69 //Their SSUID is >= that of all subsequent records, and the next record (if present) has a SSUID
70
71 static boolean verbose;
72 }