use of de.bioforscher.jstructure.StandardFormat in project jstructure by JonStargaryen.
the class EvolutionaryCouplingParser method parsePlmScore.
private static void parsePlmScore(ContactStructuralInformation contact, Element table) {
String residueIdentifier1 = String.valueOf(contact.getResidueIdentifier1());
String residueIdentifier2 = String.valueOf(contact.getResidueIdentifier2());
OptionalDouble plmScore = table.getElementsByTag("tr").stream().skip(1).map(element -> element.getElementsByTag("td")).filter(elements -> (elements.get(2).text().equals(residueIdentifier1) && elements.get(4).text().equals(residueIdentifier2)) || (elements.get(2).text().equals(residueIdentifier2) && elements.get(4).text().equals(residueIdentifier1))).mapToDouble(elements -> Double.valueOf(elements.get(6).text())).mapToObj(StandardFormat::format).mapToDouble(Double::valueOf).findFirst();
OptionalInt rank = table.getElementsByTag("tr").stream().skip(1).map(element -> element.getElementsByTag("td")).filter(elements -> (elements.get(2).text().equals(residueIdentifier1) && elements.get(4).text().equals(residueIdentifier2)) || (elements.get(2).text().equals(residueIdentifier2) && elements.get(4).text().equals(residueIdentifier1))).mapToInt(elements -> Integer.valueOf(elements.get(0).text())).findFirst();
contact.setPlmScore(plmScore.orElse(0.0));
contact.setCouplingRank(rank.orElse(-1));
// contact.setCouplingRank(rank.orElse(Integer.MAX_VALUE));
}
Aggregations