0
|
1 package datastructures;
|
|
2
|
|
3 import java.util.Scanner;
|
|
4
|
|
5 public class GenomeLine implements Line {
|
|
6
|
|
7 boolean misformat = false;
|
|
8 String seqName, chrom, gene;
|
|
9 int start, end;
|
|
10
|
|
11 //fw.write(field(1)+"\t"+field(3)+"\t"
|
|
12 // +field(5)+"\t"+field(6)+"\t"+field(13)+"\r\n");
|
|
13
|
|
14 public GenomeLine(String line){
|
|
15 Scanner s = new Scanner(line);
|
|
16 if(line.startsWith("#")) misformat = true;
|
|
17 else
|
|
18 try{
|
|
19 seqName = s.next();s.next();
|
|
20 chrom = s.next();s.next();
|
|
21 start = s.nextInt();
|
|
22 end = s.nextInt();s.next();s.next();s.next();s.next();s.next();s.next();
|
|
23 gene = s.next();}
|
|
24 catch(Exception e){
|
|
25 misformat = true;
|
|
26 }
|
|
27 }
|
|
28
|
|
29 public boolean valid(){
|
|
30 return misformat == false;
|
|
31 }
|
|
32
|
|
33 public String chrom() {
|
|
34 return chrom;
|
|
35 }
|
|
36
|
|
37 public int end() {
|
|
38 return end;
|
|
39 }
|
|
40
|
|
41 public int start() {
|
|
42 return start;
|
|
43 }
|
|
44
|
|
45 public String gene(){
|
|
46 return gene;
|
|
47 }
|
|
48
|
|
49 public String seqName(){
|
|
50 return seqName;
|
|
51 }
|
|
52
|
|
53 public String toString(){
|
|
54 return seqName + "\t" + chrom + "\t" + start + "\t" + end + "\t" + gene;
|
|
55 }
|
|
56
|
|
57 }
|