package versusSNP.blast.util;
import versusSNP.blast.BlastSet;
import versusSNP.genome.SNP;
public class SNPFinder {
public SNPFinder() {
super();
// TODO Auto-generated constructor stub
}
public void find(BlastSet set) {
int qPos = set.getQBegin() - set.biasQStrand();
int sPos = set.getSBegin() - set.biasSStrand();
int length = set.getQSeqLength();
for (int i = 0; i < length; i++) {
char qBase = set.atQSeq(i);
char sBase = set.atSSeq(i);
if (qBase != '-')
qPos += set.biasQStrand();
if (sBase != '-')
sPos += set.biasSStrand();
if (qBase != sBase) {
if (sBase != '-') {
set.addSNP(new SNP(qPos, sPos, qBase, sBase));
} else {
set.addSNP(new SNP(qPos, set.isSStrand() ? sPos + 1 : sPos, qBase, sBase));
}
}
}
set.emptyQuerySubjectSeq();
}
}