Search in sources :

Example 41 with Structure

use of de.bioforscher.jstructure.model.structure.Structure in project jstructure by JonStargaryen.

the class AtomContainer method getPdbRepresentation.

default String getPdbRepresentation() {
    Structure structure;
    try {
        structure = getAtoms().get(0).getParentGroup().getParentChain().getParentStructure();
    } catch (Exception e) {
        structure = Structure.UNKNOWN_STRUCTURE;
    }
    // ensure ordering of atoms according to their pdbSerials
    List<Atom> sortedAtoms = atoms().sorted(Comparator.comparingInt(Atom::getPdbSerial)).collect(Collectors.toList());
    return getPdbRepresentation(sortedAtoms, structure);
// return getPdbRepresentation(getAtoms(), structure);
}
Also used : Structure(de.bioforscher.jstructure.model.structure.Structure) Atom(de.bioforscher.jstructure.model.structure.Atom)

Example 42 with Structure

use of de.bioforscher.jstructure.model.structure.Structure in project jstructure by JonStargaryen.

the class EnergyProfileCalculatorTest method shouldProcessStructureWithMPH.

@Test
public void shouldProcessStructureWithMPH() {
    Structure protein = StructureParser.fromPdbId("1P7P").parse();
    featureProvider.process(protein);
}
Also used : Structure(de.bioforscher.jstructure.model.structure.Structure) Test(org.junit.Test)

Example 43 with Structure

use of de.bioforscher.jstructure.model.structure.Structure in project jstructure by JonStargaryen.

the class EnergyProfileCalculatorTest method shouldProcessStructure.

@Test
public void shouldProcessStructure() {
    Structure protein = StructureParser.fromPdbId("1ATI").parse();
    featureProvider.process(protein);
}
Also used : Structure(de.bioforscher.jstructure.model.structure.Structure) Test(org.junit.Test)

Example 44 with Structure

use of de.bioforscher.jstructure.model.structure.Structure in project jstructure by JonStargaryen.

the class DictionaryOfProteinSecondaryStructureTest method getSecondaryStructureAnnotation.

private String getSecondaryStructureAnnotation(String id) {
    // load structure
    Structure protein = StructureParser.fromPdbId(id).parse();
    // assign states
    featureProvider.process(protein);
    // return complete DSSP annotation string from jstructrue
    return protein.aminoAcids().map(residue -> residue.getFeature(DSSPSecondaryStructure.class)).map(DSSPSecondaryStructure::getSecondaryStructure).map(SecondaryStructureType::getOneLetterRepresentation).map(character -> character.equals("c") ? " " : character).collect(Collectors.joining());
}
Also used : 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) DSSPSecondaryStructure(de.bioforscher.jstructure.feature.sse.dssp.DSSPSecondaryStructure) DSSPSecondaryStructure(de.bioforscher.jstructure.feature.sse.dssp.DSSPSecondaryStructure) Structure(de.bioforscher.jstructure.model.structure.Structure) DictionaryOfProteinSecondaryStructure(de.bioforscher.jstructure.feature.sse.dssp.DictionaryOfProteinSecondaryStructure)

Example 45 with Structure

use of de.bioforscher.jstructure.model.structure.Structure 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

Structure (de.bioforscher.jstructure.model.structure.Structure)61 IOException (java.io.IOException)45 Collectors (java.util.stream.Collectors)40 Chain (de.bioforscher.jstructure.model.structure.Chain)39 Files (java.nio.file.Files)35 StructureParser (de.bioforscher.jstructure.model.structure.StructureParser)30 Path (java.nio.file.Path)26 AminoAcid (de.bioforscher.jstructure.model.structure.aminoacid.AminoAcid)23 List (java.util.List)22 StandardFormat (de.bioforscher.jstructure.StandardFormat)21 Logger (org.slf4j.Logger)20 LoggerFactory (org.slf4j.LoggerFactory)20 Test (org.junit.Test)19 Group (de.bioforscher.jstructure.model.structure.Group)18 UncheckedIOException (java.io.UncheckedIOException)18 Pattern (java.util.regex.Pattern)17 Stream (java.util.stream.Stream)17 Jsoup (org.jsoup.Jsoup)17 ComputationException (de.bioforscher.jstructure.model.feature.ComputationException)16 java.util (java.util)15