| 1 |
package driver; |
| 2 |
|
| 3 |
import fileIO.TextFile; |
| 4 |
import shared.Tools; |
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
public class ProcessFragMerging { |
| 13 |
|
| 14 |
public static void main(String[] args){ |
| 15 |
|
| 16 |
String sym="\t"; |
| 17 |
|
| 18 |
String fname=args[0]; |
| 19 |
TextFile tf=new TextFile(fname); |
| 20 |
for(String line=tf.nextLine(); line!=null; line=tf.nextLine()){ |
| 21 |
String[] split=line.split("\\p{javaWhitespace}+"); |
| 22 |
if(line.startsWith("***")){ |
| 23 |
System.out.print("\n"+split[1]+sym); |
| 24 |
|
| 25 |
}else if(line.startsWith("real")){ |
| 26 |
String time=line.split("\t")[1]; |
| 27 |
double seconds=toSeconds(time); |
| 28 |
System.out.print(Tools.format("%.3f", seconds)+sym); |
| 29 |
}else if(line.startsWith("Reads Used:")){ |
| 30 |
System.out.print(split[2]+sym+split[3].substring(1)+sym); |
| 31 |
}else if(line.startsWith("mapped:")){ |
| 32 |
System.out.print(split[2]+sym+split[4]+sym); |
| 33 |
}else if(line.startsWith("Error Rate:")){ |
| 34 |
System.out.print(split[3]+sym+split[5]+sym); |
| 35 |
}else if(line.startsWith("Sub Rate:")){ |
| 36 |
System.out.print(split[3]+sym+split[5]+sym); |
| 37 |
}else if(line.startsWith("Del Rate:")){ |
| 38 |
System.out.print(split[3]+sym+split[5]+sym); |
| 39 |
}else if(line.startsWith("Ins Rate:")){ |
| 40 |
System.out.print(split[3]+sym+split[5]+sym); |
| 41 |
} |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
} |
| 46 |
|
| 47 |
} |
| 48 |
|
| 49 |
public static double toSeconds(String s){ |
| 50 |
s=s.replaceAll("s", ""); |
| 51 |
String[] split=s.split("m"); |
| 52 |
String seconds=split[1], minutes=split[0]; |
| 53 |
return 60*Double.parseDouble(minutes)+Double.parseDouble(seconds); |
| 54 |
} |
| 55 |
|
| 56 |
} |