use of de.bioforscher.jstructure.model.structure.Protein in project jstructure by JonStargaryen.
the class ProteinParserTest method checkAgreement.
private void checkAgreement(String pdbId) {
System.out.println("checking agreement between written and expected ATOM records for " + pdbId);
Protein protein = ProteinParser.source(pdbId).parse();
List<String> writtenLines = Pattern.compile("\n").splitAsStream(protein.getPdbRepresentation()).collect(Collectors.toList());
try {
List<String> expectedLines = Files.lines(Paths.get(TestUtils.getResourceAsFilepath("parser/parsed/" + pdbId + ".pdb"))).collect(Collectors.toList());
for (int i = 0; i < writtenLines.size(); i++) {
// some file have shorter lines
if (expectedLines.get(i).length() > writtenLines.get(i).length()) {
Assert.assertTrue("ATOM records do not match!" + System.lineSeparator() + "expected: " + expectedLines.get(i) + System.lineSeparator() + "actual: " + writtenLines.get(i), expectedLines.get(i).startsWith(writtenLines.get(i)));
} else {
Assert.assertTrue("ATOM records do not match!" + System.lineSeparator() + "expected: " + expectedLines.get(i) + System.lineSeparator() + "actual: " + writtenLines.get(i), writtenLines.get(i).startsWith(expectedLines.get(i)));
}
}
} catch (IOException e) {
throw new UncheckedIOException("did not find expected output file for " + pdbId, e);
}
}
use of de.bioforscher.jstructure.model.structure.Protein 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 de.bioforscher.jstructure.model.structure.Protein in project jstructure by JonStargaryen.
the class ModelIntegrityTest method shouldGetProteinCopy.
@Test
public void shouldGetProteinCopy() {
ChainContainer copiedProtein = protein.createCopy();
Assert.assertTrue(copiedProtein instanceof Protein);
}
use of de.bioforscher.jstructure.model.structure.Protein in project jstructure by JonStargaryen.
the class ProteinParserTest method shouldAnnotateHetAtmsCorrectlyFor1bs2.
@Test
public void shouldAnnotateHetAtmsCorrectlyFor1bs2() {
/*
* 1bs2 is an aars structure with the amino acid arginine in the binding site (annotated as ATOM record), some
* water (annotated as HETATM)
*/
Protein protein1bs2 = ProteinParser.source("1bs2").parse();
List<Group> waters = protein1bs2.select().water().asFilteredGroups().collect(Collectors.toList());
waters.forEach(group -> {
Assert.assertTrue(group.isLigand());
Assert.assertTrue("water records ought to start with HETATM", group.getPdbRepresentation().startsWith(Atom.HETATM_PREFIX));
});
Group arginineAsLigand = protein1bs2.select().residueNumber(900).asGroup();
// assert that selection does not return ARG ligand as normal amino acid
boolean arginineLigandIsNoAminoAcid = protein1bs2.aminoAcids().noneMatch(group -> group.equals(arginineAsLigand));
Assert.assertTrue("amino acid ligand ought to be not a part of the amino acid chain", arginineLigandIsNoAminoAcid);
// ensure last amino acid is MET and not the ARG ligand
Assert.assertThat(protein1bs2.getAminoAcidSequence(), endsWith("M"));
List<Group> hetatm1bs2 = protein1bs2.select().hetatms().asFilteredGroups().collect(Collectors.toList());
Assert.assertTrue(hetatm1bs2.containsAll(waters) && hetatm1bs2.contains(arginineAsLigand));
}
use of de.bioforscher.jstructure.model.structure.Protein in project jstructure by JonStargaryen.
the class ProteinParserTest method shouldHandleModifiedResidue.
@Test
public void shouldHandleModifiedResidue() {
Protein protein = ProteinParser.source("1brr").parse();
Group pca = protein.select().chainName("C").residueNumber(1).asGroup();
Assert.assertTrue(pca.isAminoAcid());
Assert.assertFalse(pca.isLigand());
// assert correct mapping of PCA to GLU
Assert.assertEquals("incorrect mapping of PCA to GLU", "E", pca.getGroupPrototype().getOneLetterCode().get());
}
Aggregations