* @see com.affymetrix.genometryImpl.symmetry.TypeContainerAnnot
* @see com.affymetrix.genometryImpl.util.SeqUtils
*/
private static void processSimHit(BioSeq query_seq, Element elem, String method) {
// method can never be null -- if it is, the XML is wrong
TypeContainerAnnot hitSym = new TypeContainerAnnot(method);
addDescriptors(elem, hitSym);
String hit_name = elem.getAttribute(NAMESTR);
String hit_descr = elem.getAttribute("desc");
if (hit_name != null && hit_name.length() > 0) {
hitSym.setProperty(NAMESTR, hit_name);
}
if (hit_descr != null && hit_descr.length() > 0) {
hitSym.setProperty("descr", hit_descr);
}
SeqSpan hitSpan = null;
NodeList children = elem.getChildNodes();
int num_spans = 0, aa_start = Integer.MAX_VALUE, aa_end = Integer.MIN_VALUE;
for (int i = 0; i < children.getLength(); i++) {
Node child = children.item(i);
String name = child.getNodeName();
if (child instanceof Element) {
Element chelem = (Element) child;
if (name.equalsIgnoreCase("simspan")) {
SeqSymmetry spanSym = processSimSpan(query_seq, chelem);
((SymWithProps) spanSym).setProperty(METHODSTR, method);
hitSym.addChild(spanSym);
SeqSpan spanSpan = spanSym.getSpan(query_seq);
if (hitSpan == null) {
hitSpan = new SimpleMutableSeqSpan(spanSpan.getMin(), spanSpan.getMax(), query_seq);
} else {
SeqUtils.encompass(hitSpan, spanSpan, (MutableSeqSpan) hitSpan);
}
//hitSym.setProperty(TYPESTR, "hitspan");
int start = Integer.valueOf(((SymWithProps)spanSym).getProperty(AA_START).toString());
int end = Integer.valueOf(((SymWithProps)spanSym).getProperty(AA_END).toString());
aa_start = Math.min(aa_start, start);
aa_end = Math.max(aa_end, end);
num_spans++;
}
}
}
String prop = (Integer.valueOf(num_spans)).toString();
hitSym.setProperty("num_spans", prop);
hitSym.setProperty(TYPESTR, "simHit");
hitSym.setProperty(AA_START, String.valueOf(aa_start));
hitSym.setProperty(AA_END, String.valueOf(aa_end));
hitSym.setProperty(AA_LENGTH, String.valueOf(aa_end - aa_start));
hitSym.addSpan(hitSpan);
hitSym.setID("");
query_seq.addAnnotation(hitSym);
}