BlastFilter filter = new BlastFilter(Parameter.blast_filter_score,
Parameter.blast_filter_expect,
Parameter.blast_filter_overlap,
Parameter.blast_filter_identity1,
Parameter.blast_filter_identity2);
SNPFinder snpFinder = new SNPFinder();
BlastSet set = new BlastSet();
try {
while ((line=br.readLine())!=null) {
if ((m=m_Query.matcher(line)).find()) {
if (isAnother) {
if (filter.test(set)) {
blastList.add(set);
}
isAnother = isQuery = isSubject = false;
snpFinder.find(set);
set = new BlastSet();
}
set.setQName(m.group(1));
} else if ((m=m_Letters.matcher(line)).find()) {
set.setQLen(m.group(1));
} else if ((m=m_Subject.matcher(line)).find()) {
if (isAnother) {
if (filter.test(set)) {
blastList.add(set);
}
isAnother = isQuery = isSubject = false;
snpFinder.find(set);
set = new BlastSet(set.getQName());
}
set.setSName(m.group(1));
if ((m=m_Annotation.matcher(line)).find()) {
set.setAnnotation(m.group(1));
}
isAnnotation = true;
} else if ((m=m_Length.matcher(line)).find()) {
set.setSLen(m.group(1));
isAnnotation = false;
} else if (isAnnotation) {
set.addAnnotation(Utils.removeSpaceFromBegin(line));
} else if ((m=m_Score.matcher(line)).find()||
(m=m_Score2.matcher(line)).find()) {
if (isAnother) {
if (filter.test(set)) {
blastList.add(set);
}
isAnother = isQuery = isSubject = false;
snpFinder.find(set);
set = new BlastSet(set.getQName(), set.getSName());
}
set.setScore(m.group(1));
set.setExpect(m.group(2));
} else if ((m=m_Identities.matcher(line)).find()) {
set.setIdentity1(m.group(1));
set.setIdentity2(m.group(2));
set.setOverlap(m.group(3));
} else if ((m=m_Strand.matcher(line)).find()) {
set.setStrand1(m.group(1));
set.setStrand2(m.group(2));
} else if ((m=m_QuerySeq.matcher(line)).find()) {
if (!isQuery) {
set.setQBegin(m.group(1));
}
set.addQSeq(m.group(2), m.group(1), m.group(3));
set.setQEnd(m.group(3));
isQuery = true;
} else if ((m=m_SubjectSeq.matcher(line)).find()) {
if (!isSubject) {
set.setSBegin(m.group(1));
}
set.addSSeq(m.group(2), m.group(1), m.group(3));
set.setSEnd(m.group(3));
isSubject = isAnother = true;
}
}
if (isAnother) {
if (filter.test(set)) {
blastList.add(set);
}
isAnother = isQuery = isSubject = false;
snpFinder.find(set);
set = new BlastSet(set.getQName(), set.getSName());
}
br.close();
System.gc();
return true;