annotate NGSrich_0.5.5/src/datastructures/GenomeLine.java @ 0:89ad0a9cca52 default tip

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