use of de.bioforscher.jstructure.model.structure.Group in project jstructure by JonStargaryen.
the class AbstractItemSetMinerDataSetComposer method handleLine.
private String handleLine(Protein protein, String line, boolean functional) {
try {
String[] sectionSplit = line.split("_");
PLIPInteractionContainer container = protein.getFeatureContainer().getFeature(PLIPInteractionContainer.class);
// extract peculiar residues
List<Group> groups = Stream.of(sectionSplit).skip(1).map(residueSection -> extractResidue(protein, residueSection)).collect(Collectors.toList());
return groups.stream().map(group -> mapToString(container, group)).collect(Collectors.joining(",", line + ",", "," + (functional ? "" : "non-") + "functional"));
} catch (Exception e) {
e.fillInStackTrace();
// thrown upon missing backbone atoms during secondary structure assignment
return "";
}
}
use of de.bioforscher.jstructure.model.structure.Group in project jstructure by JonStargaryen.
the class AbstractItemSetMinerDataSetComposer method extractResidue.
private Group extractResidue(Protein protein, String residueSection) {
String[] split = residueSection.split("-");
Group group = protein.select().chainName(split[0]).residueNumber(Integer.valueOf(split[1].substring(1))).asGroup();
// check for integrity
if (!group.getGroupPrototype().getOneLetterCode().get().equals(split[1].substring(0, 1))) {
// happens for alternative positions
throw new IllegalArgumentException("amino acid does not match expectation: " + residueSection + " found " + group.getGroupPrototype().getOneLetterCode());
}
return group;
}
use of de.bioforscher.jstructure.model.structure.Group in project jstructure by JonStargaryen.
the class ProteinParserTest method shouldParseInsertedAminoAcids.
@Test
public void shouldParseInsertedAminoAcids() {
Protein protein = ProteinParser.source("2w0l").parse();
List<Group> groups = protein.select().chainName("A").residueNumber(95).asFilteredGroups().collect(Collectors.toList());
Assert.assertEquals(2, groups.size());
groups.forEach(System.out::println);
}
Aggregations