Search in sources :

Example 1 with StandardFormat

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));
}
Also used : OptionalDouble(java.util.OptionalDouble) InputStreamReader(java.io.InputStreamReader) OptionalInt(java.util.OptionalInt) Collectors(java.util.stream.Collectors) Start2FoldConstants(de.bioforscher.jstructure.efr.Start2FoldConstants) HotSpotScoring(de.bioforscher.jstructure.efr.model.HotSpotScoring) List(java.util.List) Document(org.jsoup.nodes.Document) Element(org.jsoup.nodes.Element) AminoAcid(de.bioforscher.jstructure.model.structure.aminoacid.AminoAcid) Chain(de.bioforscher.jstructure.model.structure.Chain) StandardFormat(de.bioforscher.jstructure.StandardFormat) Jsoup(org.jsoup.Jsoup) Elements(org.jsoup.select.Elements) BufferedReader(java.io.BufferedReader) ContactStructuralInformation(de.bioforscher.jstructure.efr.model.si.ContactStructuralInformation) Comparator(java.util.Comparator) Path(java.nio.file.Path) InputStream(java.io.InputStream) StandardFormat(de.bioforscher.jstructure.StandardFormat) OptionalInt(java.util.OptionalInt) OptionalDouble(java.util.OptionalDouble)

Aggregations

StandardFormat (de.bioforscher.jstructure.StandardFormat)1 Start2FoldConstants (de.bioforscher.jstructure.efr.Start2FoldConstants)1 HotSpotScoring (de.bioforscher.jstructure.efr.model.HotSpotScoring)1 ContactStructuralInformation (de.bioforscher.jstructure.efr.model.si.ContactStructuralInformation)1 Chain (de.bioforscher.jstructure.model.structure.Chain)1 AminoAcid (de.bioforscher.jstructure.model.structure.aminoacid.AminoAcid)1 BufferedReader (java.io.BufferedReader)1 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1 Path (java.nio.file.Path)1 Comparator (java.util.Comparator)1 List (java.util.List)1 OptionalDouble (java.util.OptionalDouble)1 OptionalInt (java.util.OptionalInt)1 Collectors (java.util.stream.Collectors)1 Jsoup (org.jsoup.Jsoup)1 Document (org.jsoup.nodes.Document)1 Element (org.jsoup.nodes.Element)1 Elements (org.jsoup.select.Elements)1