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