Search in sources :

Example 11 with Group

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 "";
    }
}
Also used : AbstractFeatureProvider(de.bioforscher.jstructure.model.feature.AbstractFeatureProvider) EnergyProfile(de.bioforscher.jstructure.feature.energyprofile.EnergyProfile) ProteinParser(de.bioforscher.jstructure.parser.ProteinParser) LoopFraction(de.bioforscher.jstructure.feature.loopfraction.LoopFraction) Files(java.nio.file.Files) FileWriter(java.io.FileWriter) DecimalFormat(java.text.DecimalFormat) IOException(java.io.IOException) Collectors(java.util.stream.Collectors) PLIPInteractionContainer(de.bioforscher.jstructure.feature.interactions.PLIPInteractionContainer) List(java.util.List) AccessibleSurfaceArea(de.bioforscher.jstructure.feature.asa.AccessibleSurfaceArea) PLIPInteraction(de.bioforscher.jstructure.feature.interactions.PLIPInteraction) Stream(java.util.stream.Stream) Paths(java.nio.file.Paths) Group(de.bioforscher.jstructure.model.structure.Group) Map(java.util.Map) Protein(de.bioforscher.jstructure.model.structure.Protein) FeatureProviderRegistry(de.bioforscher.jstructure.model.feature.FeatureProviderRegistry) Group(de.bioforscher.jstructure.model.structure.Group) PLIPInteractionContainer(de.bioforscher.jstructure.feature.interactions.PLIPInteractionContainer) IOException(java.io.IOException)

Example 12 with Group

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;
}
Also used : Group(de.bioforscher.jstructure.model.structure.Group)

Example 13 with 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);
}
Also used : Group(de.bioforscher.jstructure.model.structure.Group) Protein(de.bioforscher.jstructure.model.structure.Protein) Test(org.junit.Test)

Aggregations

Group (de.bioforscher.jstructure.model.structure.Group)13 Protein (de.bioforscher.jstructure.model.structure.Protein)7 List (java.util.List)6 ProteinParser (de.bioforscher.jstructure.parser.ProteinParser)4 IOException (java.io.IOException)4 Collectors (java.util.stream.Collectors)4 Test (org.junit.Test)4 AbstractFeatureProvider (de.bioforscher.jstructure.model.feature.AbstractFeatureProvider)3 Files (java.nio.file.Files)3 Paths (java.nio.file.Paths)3 Document (org.jsoup.nodes.Document)3 ComputationException (de.bioforscher.jstructure.feature.ComputationException)2 FeatureProviderRegistry (de.bioforscher.jstructure.model.feature.FeatureProviderRegistry)2 Chain (de.bioforscher.jstructure.model.structure.Chain)2 ProteinIdentifier (de.bioforscher.jstructure.model.structure.identifier.ProteinIdentifier)2 DecimalFormat (java.text.DecimalFormat)2 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 Stream (java.util.stream.Stream)2 Jsoup (org.jsoup.Jsoup)2