@@ -4,30 +4,61 @@ BioJava provide a module ''biojava3-protmod'' for identification of protein pre-
44
55==Example: identify and print all preloaded modifications from a structure ==
66<java>
7- void identifyAndPrintModfications(Structure struc) {
8- ProteinModificationIdentifier parser = new ProteinModificationIdentifier();
9- parser.identify(struc);
10- Set<ModifiedCompound> mcs = parser.getIdentifiedModifiedCompound();
11- for (ModifiedCompound mc : mcs) {
12- System.out.println(mc.toString());
13- }
7+ Set<ModifiedCompound> identifyAllModfications(Structure struc) {
8+ ProteinModificationIdentifier parser = new ProteinModificationIdentifier();
9+ parser.identify(struc);
10+ Set<ModifiedCompound> mcs = parser.getIdentifiedModifiedCompound();
11+ return mcs;
1412}
1513</java>
1614
1715==Example: identify phosphorylation sites in a structure ==
1816<java>
19- List<PDBResidueNumber> identifyPhosphosites(Structure struc) {
20- List<PDBResidueNumber> phosphosites = new ArrayList<Integer>();
21- ProteinModificationIdentifier parser = new ProteinModificationIdentifier();
22- parser.identify(struc, ProteinModification.getByKeyword("phosphoprotein"));
23- Set<ModifiedCompound> mcs = parser.getIdentifiedModifiedCompound();
24- for (ModifiedCompound mc : mcs) {
25- Set<StructureGroup> groups = mc.getGroups(ComponentType.AMINOACID);
26- for (StructureGroup group : groups) {
27- phosphosites.add(group.getPDBResidueNumber());
28- }
29- }
30- return phosphosites;
17+ List<ResidueNumber> identifyPhosphosites(Structure struc) {
18+ List<ResidueNumber> phosphosites = new ArrayList<ResidueNumber>();
19+ ProteinModificationIdentifier parser = new ProteinModificationIdentifier();
20+ parser.identify(struc, ProteinModificationRegistry.getByKeyword("phosphoprotein"));
21+ Set<ModifiedCompound> mcs = parser.getIdentifiedModifiedCompound();
22+ for (ModifiedCompound mc : mcs) {
23+ Set<StructureGroup> groups = mc.getGroups(true);
24+ for (StructureGroup group : groups) {
25+ phosphosites.add(group.getPDBResidueNumber());
26+ }
27+ }
28+ return phosphosites;
29+ }
30+ </java>
31+
32+ ==Demo code to run the above methods ==
33+ <java>
34+ import org.biojava.bio.structure.ResidueNumber;
35+ import org.biojava.bio.structure.Structure;
36+ import org.biojava.bio.structure.io.PDBFileReader;
37+ import org.biojava3.protmod.structure.ProteinModificationIdentifier;
38+
39+ public static void main(String[] args) {
40+ try {
41+ PDBFileReader reader = new PDBFileReader();
42+ reader.setAutoFetch(true);
43+
44+ // identify all modificaitons from PDB:1CAD and print them
45+ String pdbId = "1CAD";
46+ Structure struc = reader.getStructureById(pdbId);
47+ Set<ModifiedCompound> mcs = identifyAllModfications(struc)
48+ for (ModifiedCompound mc : mcs) {
49+ System.out.println(mc.toString());
50+ }
51+
52+ // identify all phosphosites from PDB:3MVJ and print them
53+ String pdbId = "3MVJ";
54+ Structure struc = reader.getStructureById(pdbId);
55+ List<ResidueNumber> psites = identifyPhosphosites(struc);
56+ for (ResidueNumber psite : psites) {
57+ System.out.println(psite.toString());
58+ }
59+ } catch(Exception e) {
60+ e.printStackTrace();
61+ }
3162}
3263</java>
3364
0 commit comments