use of de.bioforscher.jstructure.model.structure.GroupPrototype in project jstructure by JonStargaryen.
the class BindingSiteExtractor method handleLine.
private void handleLine(String line, String className, String modeName) {
System.out.println(line);
// map to amino acid family
String aminoAcid = Stream.of(AminoAcid.Family.values()).filter(aminoAcidFamily -> aminoAcidFamily.name().equalsIgnoreCase(line.split(":")[0])).findFirst().map(AminoAcid.Family::getGroupPrototype).map(GroupPrototype::getThreeLetterCode).orElse("Pyr");
int[] residueNumbers = Pattern.compile(", ").splitAsStream(line.split("\\[")[1].split("]")[0]).mapToInt(Integer::valueOf).toArray();
AARSConstants.lines(Paths.get(AARSConstants.MAIN_TABLE_CATALYTIC_PATH)).filter(mainTableLine -> mainTableLine.split(",")[1].equalsIgnoreCase(aminoAcid)).filter(mainTableLine -> mainTableLine.endsWith("1")).forEach(mainTableLine -> {
String[] split = mainTableLine.split(",");
String pdbId = split[2];
String chainId = split[13];
Protein protein = ProteinParser.source(AARSConstants.RENUMBERED_STRUCTURES_PATH + className + "/renumbered_structures/" + pdbId + "_renum.pdb").parse();
String output = "HEADER LIGASE/RNA 15-JUL-99 " + pdbId.toUpperCase() + " " + System.lineSeparator() + protein.select().chainName(chainId).aminoAcids().residueNumber(residueNumbers).asGroupContainer().getPdbRepresentation();
AARSConstants.write(Paths.get(AARSConstants.BINDING_SITE_PATH + className + "/ligand_based/per_type/" + modeName + "/" + aminoAcid.substring(0, 1).toUpperCase() + aminoAcid.substring(1, 3).toLowerCase() + "/" + pdbId + "_" + chainId + "_renum.pdb"), output.getBytes());
});
}
Aggregations