Debian Codegraph @

current/driver/SummarizeMSDIN.java

raw symbols SCIP
1 package driver;
2
3 import fileIO.TextFile;
4
5 /**
6 * Summarizes match/sub/ins/del/N rates for consecutive BBMap runs
7 * @author Brian Bushnell
8 * @date Jan 8, 2014
9 *
10 */
11 public class SummarizeMSDIN {
12
13 public static void main(String[] args){
14 String fname=args[0];
15 boolean M=false;
16 boolean E=false;
17 boolean S=true;
18 boolean D=false;
19 boolean I=false;
20 boolean N=false;
21 boolean B=false;
22 boolean MS=true;
23
24 long mcount=0;
25 long ecount=0;
26 long scount=0;
27 long dcount=0;
28 long icount=0;
29 long ncount=0;
30 long bcount=0;
31
32 TextFile tf=new TextFile(fname);
33 StringBuilder sb=new StringBuilder();
34 for(String s=tf.nextLine(); s!=null; s=tf.nextLine()){
35 String[] split=s.split("\t");
36 if(s.startsWith("Total time:")){
37 if(B){
38 if(sb.length()>0){sb.append('\t');}
39 sb.append(bcount);
40 }
41 if(MS){
42 if(sb.length()>0){sb.append('\t');}
43 sb.append((mcount+scount));
44 }
45 if(M){
46 if(sb.length()>0){sb.append('\t');}
47 sb.append(mcount);
48 }
49 if(E){
50 if(sb.length()>0){sb.append('\t');}
51 sb.append(ecount);
52 }
53 if(S){
54 if(sb.length()>0){sb.append('\t');}
55 sb.append(scount);
56 }
57 if(D){
58 if(sb.length()>0){sb.append('\t');}
59 sb.append(dcount);
60 }
61 if(I){
62 if(sb.length()>0){sb.append('\t');}
63 sb.append(icount);
64 }
65 if(N){
66 if(sb.length()>0){sb.append('\t');}
67 sb.append(ncount);
68 }
69 System.out.println(sb);
70 sb.setLength(0);
71 mcount=ecount=scount=dcount=icount=ncount=bcount=0;
72 }else if(s.startsWith("Match Rate:")){
73 String x=split[split.length-1];
74 try{mcount=(Long.parseLong(x));}catch(Exception e){}
75 }else if(E && s.startsWith("Error Rate:")){
76 String x=split[split.length-1];
77 // if(E){
78 // if(sb.length()>0){sb.append('\t');}
79 // sb.append(x);
80 // }
81 try{ecount=(Long.parseLong(x));}catch(Exception e){}
82 }else if(s.startsWith("Sub Rate:")){
83 String x=split[split.length-1];
84 // if(S){
85 // if(sb.length()>0){sb.append('\t');}
86 // sb.append(x);
87 // }
88 try{scount=(Long.parseLong(x));}catch(Exception e){}
89 }else if(s.startsWith("Del Rate:")){
90 String x=split[split.length-1];
91 // if(D){
92 // if(sb.length()>0){sb.append('\t');}
93 // sb.append(x);
94 // }
95 try{dcount=(Long.parseLong(x));}catch(Exception e){}
96 }else if(s.startsWith("Ins Rate:")){
97 String x=split[split.length-1];
98 // if(I){
99 // if(sb.length()>0){sb.append('\t');}
100 // sb.append(x);
101 // }
102 try{icount=(Long.parseLong(x));}catch(Exception e){}
103 }else if(s.startsWith("N Rate:")){
104 String x=split[split.length-1];
105 // if(N){
106 // if(sb.length()>0){sb.append('\t');}
107 // sb.append(x);
108 // }
109 try{ncount=(Long.parseLong(x));}catch(Exception e){}
110 }else if(s.startsWith("Reads Used:")){
111 String x=split[split.length-1].replace("(", "").replace(" bases)", "");
112 // if(B){
113 // if(sb.length()>0){sb.append('\t');}
114 // sb.append(x);
115 // }
116 try{bcount=(Long.parseLong(x));}catch(Exception e){}
117 }
118 }
119
120 }
121
122 }