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());
}
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();
}
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();
}
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());
}
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()));
}
Aggregations