Debian Codegraph @

current/aligner/Alignment.java

raw symbols SCIP
1 package aligner;
2
3 import prok.GeneCaller;
4 import stream.Read;
5
6 public class Alignment implements Comparable<Alignment>{
7
8 public Alignment(Read r_){
9 r=r_;
10 }
11
12 @Override
13 public int compareTo(Alignment o) {
14 return id>o.id ? 1 : id<o.id ? -1 : r.length()>o.r.length() ? 1 : r.length()<o.r.length() ? -1 : 0;
15 }
16
17 public float align(byte[] ref){
18 id=align(r, ref);
19 match=r.match;
20 start=r.start;
21 stop=r.stop;
22 return id;
23 }
24
25 public static float align(Read r, byte[] ref){
26 SingleStateAlignerFlat2 ssa=GeneCaller.getSSA();
27 final int a=0, b=ref.length-1;
28 int[] max=ssa.fillUnlimited(r.bases, ref, a, b, 0);
29 if(max==null){return 0;}
30
31 final int rows=max[0];
32 final int maxCol=max[1];
33 final int maxState=max[2];
34
35 //returns {score, bestRefStart, bestRefStop}
36 //padded: {score, bestRefStart, bestRefStop, padLeft, padRight};
37 int[] score=ssa.score(r.bases, ref, a, b, rows, maxCol, maxState);
38 int rstart=score[1];
39 int rstop=score[2];
40 r.start=rstart;
41 r.stop=rstop;
42
43 byte[] match=ssa.traceback(r.bases, ref, a, b, rows, maxCol, maxState);
44 float id=Read.identity(match);
45 return id;
46 }
47
48 public final Read r;
49 public float id=-1;
50 public byte[] match;
51 public int start;
52 public int stop;
53
54 }