diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/NGSrich_0.5.5/src/datastructures/ReadLine.java	Mon Nov 21 08:12:19 2011 -0500
@@ -0,0 +1,73 @@
+package datastructures;
+
+import java.util.Scanner;
+
+/**
+ * Represents a read line from the read alignment file.
+ * 
+ * @author Ali Abdallah
+ * @version 03.08.2011
+ * @since Java 1.6
+ */
+
+public class ReadLine implements Line {
+	
+	String 
+	/**
+	 * Query (pair) name.
+	 */
+	name, 
+	/**
+	 * Reference sequence name.
+	 */
+	chrom;
+	/**
+	 * Start position of the read.
+	 */
+	int start, 
+	/**
+	 * End Position of the read.
+	 */
+	end, 
+	/**
+	 * Length of the read.
+	 */
+	length;
+	
+	public ReadLine(String line){
+		// line format:
+		// qname flag rname pos mapq cigar mrnm mpos isize seq qual tag
+		Scanner s = new Scanner(line);
+		name = s.next();
+		s.next();
+		chrom = s.next();
+		start = s.nextInt();
+		s.next(); s.next();s.next();s.next();s.next();
+		length = s.next().length();
+		end = start+length-1;
+	}
+	
+	public String name(){
+		return name;
+	}
+	
+	public String chrom() {
+		return chrom;
+	}
+
+	public int end() {
+		return end;
+	}
+
+	public int start() {
+		return start;
+	}
+
+	public int length(){
+		return length;
+	}
+	
+	public String toString(){
+		return name+"\t"+chrom+"\t"+start+"\t"+end;
+	}
+}