Search in sources :

Example 1 with SecStrucState

use of org.biojava.nbio.structure.secstruc.SecStrucState in project jstructure by JonStargaryen.

the class SecondaryStructureAnnotatorTest method getDSSPAnnotatedStructure.

private String getDSSPAnnotatedStructure(String id) throws IOException, StructureException {
    // load structure
    Structure protein = new PDBFileReader().getStructureById(id);
    // assign states
    new SecStrucCalc().calculate(protein, true);
    // return complete DSSP annotation string from BioJava
    return protein.getChains().stream().flatMap(chain -> chain.getAtomGroups(GroupType.AMINOACID).stream()).map(aminoAcid -> aminoAcid.getProperty(Group.SEC_STRUC)).map(SecStrucState.class::cast).map(SecStrucState::getType).map(type -> String.valueOf(type.type)).collect(Collectors.joining());
}
Also used : PDBFileReader(org.biojava.nbio.structure.io.PDBFileReader) AbstractFeatureProvider(de.bioforscher.jstructure.model.feature.AbstractFeatureProvider) ProteinParser(de.bioforscher.jstructure.parser.ProteinParser) Test(org.junit.Test) IOException(java.io.IOException) Collectors(java.util.stream.Collectors) StructureException(org.biojava.nbio.structure.StructureException) SecStrucState(org.biojava.nbio.structure.secstruc.SecStrucState) Group(org.biojava.nbio.structure.Group) Structure(org.biojava.nbio.structure.Structure) SecStrucCalc(org.biojava.nbio.structure.secstruc.SecStrucCalc) Protein(de.bioforscher.jstructure.model.structure.Protein) Assert(org.junit.Assert) GroupType(org.biojava.nbio.structure.GroupType) PDBFileReader(org.biojava.nbio.structure.io.PDBFileReader) FeatureProviderRegistry(de.bioforscher.jstructure.model.feature.FeatureProviderRegistry) Before(org.junit.Before) SecStrucCalc(org.biojava.nbio.structure.secstruc.SecStrucCalc) SecStrucState(org.biojava.nbio.structure.secstruc.SecStrucState) Structure(org.biojava.nbio.structure.Structure)

Example 2 with SecStrucState

use of org.biojava.nbio.structure.secstruc.SecStrucState in project mm-dev by sbl-sdsc.

the class BioJavaStructureToDssp2 method calculateSecStructure.

private String calculateSecStructure(Structure structure, SecStrucCalc calculator) {
    List<SecStrucState> states = Collections.emptyList();
    // calculate DSSP secondary structure
    try {
        states = calculator.calculate(structure, false);
    } catch (StructureException e) {
    // this happens if there are not at least 4 consecutive residues
    }
    // create a DSSP string
    StringBuilder dssp = new StringBuilder();
    for (SecStrucState state : states) {
        dssp.append(state.getType().type);
    }
    return dssp.toString();
}
Also used : StructureException(org.biojava.nbio.structure.StructureException) SecStrucState(org.biojava.nbio.structure.secstruc.SecStrucState)

Example 3 with SecStrucState

use of org.biojava.nbio.structure.secstruc.SecStrucState in project mm-dev by sbl-sdsc.

the class BioJavaStructureToDssp3 method calculateSecStructure.

private String calculateSecStructure(Structure structure, SecStrucCalc calculator) throws Exception {
    List<SecStrucState> states = Collections.emptyList();
    // calculate DSSP secondary structure
    try {
        states = calculator.calculate(structure, false);
    } catch (StructureException e) {
    // this happens if there are not at least 4 consecutive residues
    }
    // create a DSSP string
    StringBuilder dssp = new StringBuilder();
    for (SecStrucState state : states) {
        dssp.append(state.getType().type);
    }
    return dssp.toString();
}
Also used : StructureException(org.biojava.nbio.structure.StructureException) SecStrucState(org.biojava.nbio.structure.secstruc.SecStrucState)

Example 4 with SecStrucState

use of org.biojava.nbio.structure.secstruc.SecStrucState in project jstructure by JonStargaryen.

the class DictionaryOfProteinSecondaryStructureTest method getDSSPAnnotatedStructure.

private String getDSSPAnnotatedStructure(String id) throws IOException, StructureException {
    // load structure
    org.biojava.nbio.structure.Structure protein = new PDBFileReader().getStructureById(id);
    // assign states
    new SecStrucCalc().calculate(protein, true);
    // return complete DSSP annotation string from BioJava
    return protein.getChains().stream().flatMap(chain -> chain.getAtomGroups(GroupType.AMINOACID).stream()).map(aminoAcid -> aminoAcid.getProperty(Group.SEC_STRUC)).map(SecStrucState.class::cast).map(SecStrucState::getType).map(type -> String.valueOf(type.type)).collect(Collectors.joining());
}
Also used : PDBFileReader(org.biojava.nbio.structure.io.PDBFileReader) DSSPSecondaryStructure(de.bioforscher.jstructure.feature.sse.dssp.DSSPSecondaryStructure) Structure(de.bioforscher.jstructure.model.structure.Structure) Test(org.junit.Test) IOException(java.io.IOException) StructureParser(de.bioforscher.jstructure.model.structure.StructureParser) Collectors(java.util.stream.Collectors) StructureException(org.biojava.nbio.structure.StructureException) SecStrucState(org.biojava.nbio.structure.secstruc.SecStrucState) Stream(java.util.stream.Stream) Group(org.biojava.nbio.structure.Group) SecStrucCalc(org.biojava.nbio.structure.secstruc.SecStrucCalc) Assert(org.junit.Assert) GroupType(org.biojava.nbio.structure.GroupType) PDBFileReader(org.biojava.nbio.structure.io.PDBFileReader) DictionaryOfProteinSecondaryStructure(de.bioforscher.jstructure.feature.sse.dssp.DictionaryOfProteinSecondaryStructure) Before(org.junit.Before) SecStrucCalc(org.biojava.nbio.structure.secstruc.SecStrucCalc) SecStrucState(org.biojava.nbio.structure.secstruc.SecStrucState)

Example 5 with SecStrucState

use of org.biojava.nbio.structure.secstruc.SecStrucState in project jstructure by JonStargaryen.

the class DictionaryOfProteinSecondaryStructureTest method test1btaBiojava.

@Test
public void test1btaBiojava() throws IOException, StructureException {
    org.biojava.nbio.structure.Structure structure = new PDBFileReader().getStructureById("1bta");
    new SecStrucCalc().calculate(structure, true);
    // return complete DSSP annotation string from BioJava
    System.out.println(structure.getChains().stream().flatMap(chain -> chain.getAtomGroups(GroupType.AMINOACID).stream()).map(aminoAcid -> aminoAcid.getProperty(Group.SEC_STRUC)).map(SecStrucState.class::cast).map(SecStrucState::getType).map(type -> String.valueOf(type.type)).map(type -> type.equals(" ") ? "-" : type).collect(Collectors.joining()));
}
Also used : PDBFileReader(org.biojava.nbio.structure.io.PDBFileReader) DSSPSecondaryStructure(de.bioforscher.jstructure.feature.sse.dssp.DSSPSecondaryStructure) Structure(de.bioforscher.jstructure.model.structure.Structure) Test(org.junit.Test) IOException(java.io.IOException) StructureParser(de.bioforscher.jstructure.model.structure.StructureParser) Collectors(java.util.stream.Collectors) StructureException(org.biojava.nbio.structure.StructureException) SecStrucState(org.biojava.nbio.structure.secstruc.SecStrucState) Stream(java.util.stream.Stream) Group(org.biojava.nbio.structure.Group) SecStrucCalc(org.biojava.nbio.structure.secstruc.SecStrucCalc) Assert(org.junit.Assert) GroupType(org.biojava.nbio.structure.GroupType) PDBFileReader(org.biojava.nbio.structure.io.PDBFileReader) DictionaryOfProteinSecondaryStructure(de.bioforscher.jstructure.feature.sse.dssp.DictionaryOfProteinSecondaryStructure) Before(org.junit.Before) SecStrucCalc(org.biojava.nbio.structure.secstruc.SecStrucCalc) SecStrucState(org.biojava.nbio.structure.secstruc.SecStrucState) Test(org.junit.Test)

Aggregations

StructureException (org.biojava.nbio.structure.StructureException)5 SecStrucState (org.biojava.nbio.structure.secstruc.SecStrucState)5 IOException (java.io.IOException)3 Collectors (java.util.stream.Collectors)3 Group (org.biojava.nbio.structure.Group)3 GroupType (org.biojava.nbio.structure.GroupType)3 PDBFileReader (org.biojava.nbio.structure.io.PDBFileReader)3 SecStrucCalc (org.biojava.nbio.structure.secstruc.SecStrucCalc)3 Assert (org.junit.Assert)3 Before (org.junit.Before)3 Test (org.junit.Test)3 DSSPSecondaryStructure (de.bioforscher.jstructure.feature.sse.dssp.DSSPSecondaryStructure)2 DictionaryOfProteinSecondaryStructure (de.bioforscher.jstructure.feature.sse.dssp.DictionaryOfProteinSecondaryStructure)2 Structure (de.bioforscher.jstructure.model.structure.Structure)2 StructureParser (de.bioforscher.jstructure.model.structure.StructureParser)2 Stream (java.util.stream.Stream)2 AbstractFeatureProvider (de.bioforscher.jstructure.model.feature.AbstractFeatureProvider)1 FeatureProviderRegistry (de.bioforscher.jstructure.model.feature.FeatureProviderRegistry)1 Protein (de.bioforscher.jstructure.model.structure.Protein)1 ProteinParser (de.bioforscher.jstructure.parser.ProteinParser)1