Skip to content

Commit 8651cce

Browse files
jjgaoandreasprlic
authored andcommitted
Change to wiki page
1 parent 1a9d7eb commit 8651cce

2 files changed

Lines changed: 91 additions & 27 deletions

File tree

_wikis/BioJava:CookBook3:ModFinder.md

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,26 @@ part of them.
1515
Example: identify and print all preloaded modifications from a structure
1616
------------------------------------------------------------------------
1717

18-
<java> void identifyAndPrintModfications(Structure struc) {
18+
<java> Set<ModifiedCompound> identifyAllModfications(Structure struc) {
1919

2020
`   ProteinModificationIdentifier parser = new ProteinModificationIdentifier();`
2121
`   parser.identify(struc);`
2222
`   Set`<ModifiedCompound>` mcs = parser.getIdentifiedModifiedCompound();`
23-
`   for (ModifiedCompound mc : mcs) {`
24-
`       System.out.println(mc.toString());`
25-
`   }`
23+
`   return mcs;`
2624

2725
} </java>
2826

2927
Example: identify phosphorylation sites in a structure
3028
------------------------------------------------------
3129

32-
<java> List<PDBResidueNumber> identifyPhosphosites(Structure struc) {
30+
<java> List<ResidueNumber> identifyPhosphosites(Structure struc) {
3331

34-
`   List`<PDBResidueNumber>` phosphosites = new ArrayList`<Integer>`();`
32+
`   List`<ResidueNumber>` phosphosites = new ArrayList`<ResidueNumber>`();`
3533
`   ProteinModificationIdentifier parser = new ProteinModificationIdentifier();`
36-
`   parser.identify(struc, ProteinModification.getByKeyword("phosphoprotein"));`
34+
`   parser.identify(struc, ProteinModificationRegistry.getByKeyword("phosphoprotein"));`
3735
`   Set`<ModifiedCompound>` mcs = parser.getIdentifiedModifiedCompound();`
3836
`   for (ModifiedCompound mc : mcs) {`
39-
`       Set`<StructureGroup>` groups = mc.getGroups(ComponentType.AMINOACID);`
37+
`       Set`<StructureGroup>` groups = mc.getGroups(true);`
4038
`       for (StructureGroup group : groups) {`
4139
`           phosphosites.add(group.getPDBResidueNumber());`
4240
`       }`
@@ -45,6 +43,41 @@ Example: identify phosphorylation sites in a structure
4543

4644
} </java>
4745

46+
Demo code to run the above methods
47+
----------------------------------
48+
49+
<java> import org.biojava.bio.structure.ResidueNumber; import
50+
org.biojava.bio.structure.Structure; import
51+
org.biojava.bio.structure.io.PDBFileReader; import
52+
org.biojava3.protmod.structure.ProteinModificationIdentifier;
53+
54+
public static void main(String[] args) {
55+
56+
`   try {`
57+
`       PDBFileReader reader = new PDBFileReader();`
58+
`       reader.setAutoFetch(true);`
59+
60+
`       // identify all modificaitons from PDB:1CAD and print them`
61+
`       String pdbId = "1CAD";`
62+
`       Structure struc = reader.getStructureById(pdbId);`
63+
`       Set`<ModifiedCompound>` mcs = identifyAllModfications(struc)`
64+
`       for (ModifiedCompound mc : mcs) {`
65+
`           System.out.println(mc.toString());`
66+
`       }`
67+
68+
`       // identify all phosphosites from PDB:3MVJ and print them`
69+
`       String pdbId = "3MVJ";`
70+
`       Structure struc = reader.getStructureById(pdbId);`
71+
`       List`<ResidueNumber>` psites = identifyPhosphosites(struc);`
72+
`       for (ResidueNumber psite : psites) {`
73+
`           System.out.println(psite.toString());`
74+
`       }`
75+
`   } catch(Exception e) {`
76+
`       e.printStackTrace();`
77+
`   }`
78+
79+
} </java>
80+
4881
See also
4982
--------
5083

_wikis/BioJava:CookBook3:ModFinder.mediawiki

Lines changed: 50 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)