Debian Codegraph @

current/driver/FixChr.java

raw symbols SCIP
1 package driver;
2
3 import fileIO.TextFile;
4 import fileIO.TextStreamWriter;
5
6 /** One-off program for converting grch38 sam files to hg19 */
7 public class FixChr {
8
9 public static void main(String[] args){
10
11 String in=args[0];
12 String out=args[1];
13
14 TextFile tf=new TextFile(in);
15 TextStreamWriter tsw=new TextStreamWriter(out, true, false, true);
16 tsw.start();
17
18 String s=null;
19 while((s=tf.nextLine())!=null){
20 if(!s.startsWith("#")){s="chr"+s;}
21 else if(s.startsWith("##contig=<ID=")){
22 s="##contig=<ID=chr"+s.substring("##contig=<ID=".length());
23 }
24 tsw.println(s);
25 }
26 tf.close();
27 tsw.poisonAndWait();
28 }
29
30 }