-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathReadHit.java
More file actions
40 lines (36 loc) · 1.37 KB
/
ReadHit.java
File metadata and controls
40 lines (36 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package org.seqcode.deepseq;
/**
* <tt>ReadHit</tt> represents the stranded coordinates of a mapped alignment hit
* Read and ReadHit are only used as a convenient way to represent multiply mapping reads when reading from certain file formats.
* <u>Note</u>: <br>
* 1) For a single read, we can have multiple (read) hits <br>
* 2) The <tt>start < end</tt> of the <tt>ReadHit</tt> ALWAYS <br>
* strand <tt>str</tt> is used to indicate whether the read is
* forward or reverse.
* @author mahony
*
*/
public class ReadHit{
protected String chrom;
protected int start, end;
protected char strand;
protected float weight;
public ReadHit(String c, int s, int e, char str){this(c,s,e,str, 1);}
public ReadHit(String c, int s, int e, char str, float w){
chrom = c;
start = s;
end = e;
strand = str;
weight = w;
}
//Accessors
public String getChrom(){return chrom;}
public int getStart(){return start;}
public int getEnd(){return end;}
public int getFivePrime(){return(strand=='+' ? start :end);}
public char getStrand(){return strand;}
public float getWeight(){return(weight);}
public void setWeight(float w){weight=w;}
public double getReadLength(){return(this.getEnd()-this.getStart()+1);}
public String toString(){return chrom+":"+getFivePrime()+":"+strand;}
}