Debian Codegraph @

current/jgi/RemoveBadBarcodes.java

raw symbols SCIP
1 package jgi;
2
3 import dna.AminoAcid;
4 import shared.Timer;
5 import stream.Read;
6 import template.BBTool_ST;
7
8 /**
9 * @author Brian Bushnell
10 * @date Mar 16, 2015
11 *
12 */
13 public class RemoveBadBarcodes extends BBTool_ST {
14
15 /*--------------------------------------------------------------*/
16 /*---------------- Initialization ----------------*/
17 /*--------------------------------------------------------------*/
18
19 /**
20 * Code entrance from the command line.
21 * Must be overridden; the commented body is an example.
22 * @param args Command line arguments
23 */
24 public static void main(String[] args){
25 Timer t=new Timer();
26 RemoveBadBarcodes bbt=new RemoveBadBarcodes(args);
27 bbt.process(t);
28 }
29
30 /**
31 * @param args
32 */
33 public RemoveBadBarcodes(String[] args) {
34 super(args);
35 }
36
37 @Override
38 protected void setDefaults(){}
39
40 @Override
41 public boolean parseArgument(String arg, String a, String b) {
42 return false;
43 }
44
45 @Override
46 protected boolean processReadPair(Read r1, Read r2) {
47 String id=r1.id;
48 int loc=(id==null ? -1 : id.lastIndexOf(':'));
49 if(loc<0 || loc>=id.length()-1){
50 noBarcode++;
51 return false;
52 }
53 for(int i=loc+1; i<id.length(); i++){
54 char c=id.charAt(i);
55 boolean ok=(c=='+' || AminoAcid.isFullyDefined(c));
56 if(!ok){
57 bad++;
58 return false;
59 }
60 }
61 good++;
62 return true;
63 }
64
65 @Override
66 protected void startupSubclass() {}
67
68 protected @Override
69 void shutdownSubclass() {}
70
71 @Override
72 protected final boolean useSharedHeader(){return true;}
73
74 @Override
75 protected void showStatsSubclass(Timer t, long readsIn, long basesIn) {
76
77 outstream.println();
78 outstream.println("Good: "+good);
79 outstream.println("Bad: "+bad);
80 outstream.println("No Barcode: "+noBarcode);
81 }
82
83 long good=0;
84 long bad=0;
85 long noBarcode=0;
86
87 }