Java Code Examples for org.biojava.nbio.structure.Structure#getSites()

The following examples show how to use org.biojava.nbio.structure.Structure#getSites() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestParseMmCIFFeatures.java    From biojava with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Test
public void testSites1a4w()throws IOException, StructureException {
	AtomCache cache = new AtomCache();

	StructureIO.setAtomCache(cache);

	cache.setUseMmCif(true);
	Structure sCif = StructureIO.getStructure("1A4W");

	assertNotNull(sCif);

	// After it has read the file, it should check that expected SITES are present.
	List<Site> sites = sCif.getSites();

	// 1a4w has 5 sites from ligands.
	assertEquals(5, sites.size());

	// Check for each site that it has parsed all residues.
	assertEquals(3, getGroupsInSite(sCif, "CAT"));
	assertEquals(6, getGroupsInSite(sCif, "AC1")); // Site has residue with insertion code.
	assertEquals(6, getGroupsInSite(sCif, "AC2"));
	assertEquals(14, getGroupsInSite(sCif, "AC3"));
	assertEquals(14, getGroupsInSite(sCif, "AC4"));

}
 
Example 2
Source File: TestParseMmCIFFeatures.java    From biojava with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testSites()throws IOException, StructureException {

	AtomCache cache = new AtomCache();

	StructureIO.setAtomCache(cache);

	cache.setUseMmCif(true);
	Structure sCif = StructureIO.getStructure("4HHB");

	assertNotNull(sCif);

	// After it has read the file, it should check that expected SITES are present.
	List<Site> sites = sCif.getSites();

	// 4HHB has 6 sites from ligands.
	assertEquals(6, sites.size());

	// Check for each site that it has parsed all residues.
	assertEquals(1, getGroupsInSite(sCif, "AC1"));
	assertEquals(1, getGroupsInSite(sCif, "AC2"));
	assertEquals(16, getGroupsInSite(sCif, "AC3"));
	assertEquals(13, getGroupsInSite(sCif, "AC4"));
	assertEquals(15, getGroupsInSite(sCif, "AC5"));
	assertEquals(7, getGroupsInSite(sCif, "AC6"));

	// Check that struct_site parsing worked, and they have descriptions.
	assertEquals(getDescription(sCif, "AC1"), "BINDING SITE FOR RESIDUE PO4 D 147");
	assertEquals(getDescription(sCif, "AC2"), "BINDING SITE FOR RESIDUE PO4 B 147");
	assertEquals(getDescription(sCif, "AC3"), "BINDING SITE FOR RESIDUE HEM A 142");
	assertEquals(getDescription(sCif, "AC4"), "BINDING SITE FOR RESIDUE HEM B 148");
	assertEquals(getDescription(sCif, "AC5"), "BINDING SITE FOR RESIDUE HEM C 142");
	assertEquals(getDescription(sCif, "AC6"), "BINDING SITE FOR RESIDUE HEM D 148");
}
 
Example 3
Source File: TestParseMmCIFFeatures.java    From biojava with GNU Lesser General Public License v2.1 5 votes vote down vote up
private int getGroupsInSite(Structure structure, String site) {
	for (Site a_site : structure.getSites()) {
		if (a_site.getSiteID().equals(site)) {
			return a_site.getGroups().size();
		}
	}
	return 0;
}
 
Example 4
Source File: TestParseMmCIFFeatures.java    From biojava with GNU Lesser General Public License v2.1 5 votes vote down vote up
private String getDescription(Structure structure, String site) {
	for (Site a_site : structure.getSites()) {
		if (a_site.getSiteID().equals(site)) {
			return a_site.getDescription();
		}
	}
	return "";
}