use of de.bioforscher.start2fold.model.Start2FoldResidueAnnotation in project jstructure by JonStargaryen.
the class Start2FoldXmlParser method parse.
public static void parse(Chain chain, InputStream inputStream) {
try {
// assign baseline resp. entry container for each residue
chain.aminoAcids().forEach(aminoAcid -> aminoAcid.getFeatureContainer().addFeature(new Start2FoldResidueAnnotation()));
Document document = Jsoup.parse(inputStream, "UTF-8", "/");
Elements experimentElements = document.getElementsByTag("experiment");
// logger.info("found {} experiments",
// experimentElements.size());
List<Experiment> experiments = experimentElements.stream().map(Experiment::parse).collect(Collectors.toList());
for (Experiment experiment : experiments) {
assignValues(experiment, chain);
}
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
use of de.bioforscher.start2fold.model.Start2FoldResidueAnnotation in project jstructure by JonStargaryen.
the class Start2FoldXmlParser method parseSpecificExperiment.
public static void parseSpecificExperiment(Chain chain, InputStream inputStream, List<Integer> experimentIds) {
// experimentIds);
try {
// assign baseline resp. entry container for each residue
chain.aminoAcids().forEach(aminoAcid -> aminoAcid.getFeatureContainer().addFeature(new Start2FoldResidueAnnotation()));
Document document = Jsoup.parse(inputStream, "UTF-8", "/");
Elements experimentElements = document.getElementsByTag("experiment");
List<Experiment> experiments = experimentElements.stream().map(Experiment::parse).filter(experiment -> experimentIds.contains(experiment.getExperimentId())).collect(Collectors.toList());
if (experimentIds.size() != experiments.size()) {
throw new IllegalArgumentException("did not find all referenced experiments");
}
for (Experiment experiment : experiments) {
assignValuesForEarly(experiment, chain);
}
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
use of de.bioforscher.start2fold.model.Start2FoldResidueAnnotation in project jstructure by JonStargaryen.
the class A01_ReportGeneralStatistics method handleStrongFile.
private static void handleStrongFile(Path path) {
try {
String pdbId = Jsoup.parse(path.toFile(), "UTF-8").getElementsByTag("protein").attr("pdb_id");
Structure structure = StructureParser.fromPdbId(pdbId).parse();
Chain chain = structure.chains().findFirst().get();
Start2FoldXmlParser.parse(chain, path);
boolean hasStabilityData = chain.aminoAcids().map(aminoAcid -> aminoAcid.getFeature(Start2FoldResidueAnnotation.class)).anyMatch(Start2FoldResidueAnnotation::isStrong);
if (!hasStabilityData) {
return;
}
long count = chain.aminoAcids().filter(aminoAcid -> aminoAcid.getFeature(Start2FoldResidueAnnotation.class).isStrong()).count();
strong.add((int) count);
weak.add((int) (chain.aminoAcids().count() - count));
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
Aggregations