Search in sources :

Example 1 with GroupPrototype

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());
    });
}
Also used : List(java.util.List) ProteinParser(de.bioforscher.jstructure.parser.ProteinParser) Stream(java.util.stream.Stream) Paths(java.nio.file.Paths) AminoAcid(de.bioforscher.jstructure.model.structure.aminoacid.AminoAcid) GroupPrototype(de.bioforscher.jstructure.model.structure.GroupPrototype) Pattern(java.util.regex.Pattern) Protein(de.bioforscher.jstructure.model.structure.Protein) Path(java.nio.file.Path) Collectors(java.util.stream.Collectors) Protein(de.bioforscher.jstructure.model.structure.Protein)

Aggregations

GroupPrototype (de.bioforscher.jstructure.model.structure.GroupPrototype)1 Protein (de.bioforscher.jstructure.model.structure.Protein)1 AminoAcid (de.bioforscher.jstructure.model.structure.aminoacid.AminoAcid)1 ProteinParser (de.bioforscher.jstructure.parser.ProteinParser)1 Path (java.nio.file.Path)1 Paths (java.nio.file.Paths)1 List (java.util.List)1 Pattern (java.util.regex.Pattern)1 Collectors (java.util.stream.Collectors)1 Stream (java.util.stream.Stream)1