annotate NGSrich_0.5.5/src/datastructures/ReadLine.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 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
6 * Represents a read line from the read alignment file.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
7 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
8 * @author Ali Abdallah
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
9 * @version 03.08.2011
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
10 * @since Java 1.6
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
11 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
12
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
13 public class ReadLine implements Line {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
14
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
15 String
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
16 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
17 * Query (pair) name.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
18 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
19 name,
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
20 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
21 * Reference sequence name.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
22 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
23 chrom;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
24 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
25 * Start position of the read.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
26 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
27 int start,
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
28 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
29 * End Position of the read.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
30 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
31 end,
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
32 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
33 * Length of the read.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
34 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
35 length;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
36
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
37 public ReadLine(String line){
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
38 // line format:
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
39 // qname flag rname pos mapq cigar mrnm mpos isize seq qual tag
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
40 Scanner s = new Scanner(line);
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
41 name = s.next();
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
42 s.next();
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
43 chrom = s.next();
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
44 start = s.nextInt();
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
45 s.next(); s.next();s.next();s.next();s.next();
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
46 length = s.next().length();
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
47 end = start+length-1;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
48 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
49
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
50 public String name(){
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
51 return name;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
52 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
53
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
54 public String chrom() {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
55 return chrom;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
56 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
57
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
58 public int end() {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
59 return end;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
60 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
61
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
62 public int start() {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
63 return start;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
64 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
65
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
66 public int length(){
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
67 return length;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
68 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
69
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
70 public String toString(){
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
71 return name+"\t"+chrom+"\t"+start+"\t"+end;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
72 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
73 }