--- title: BioJava:CookBook3:ModFinder permalink: wiki/BioJava%3ACookBook3%3AModFinder --- How can I identify protein modifications in a structure? -------------------------------------------------------- BioJava provide a module *biojava3-modfinder* for identification of protein pre-, co-, and post-translational modifications from structures. [A list of protein modifications](/wiki/BioJava:CookBook3:SupportedProtMod "wikilink") has been pre-loaded. It is possible to identify all pre-loaded modifications or part of them. Example: identify and print all preloaded modifications from a structure ------------------------------------------------------------------------ ```java Set identifyAllModfications(Structure struc) {    ProteinModificationIdentifier parser = new ProteinModificationIdentifier();    parser.identify(struc);    Set` mcs = parser.getIdentifiedModifiedCompound();    return mcs; } ``` Example: identify phosphorylation sites in a structure ------------------------------------------------------ ```java List identifyPhosphosites(Structure struc) {   List` phosphosites = new ArrayList``();   ProteinModificationIdentifier parser = new ProteinModificationIdentifier();   parser.identify(struc, ProteinModificationRegistry.getByKeyword("phosphoprotein"));   Set` mcs = parser.getIdentifiedModifiedCompound();   for (ModifiedCompound mc : mcs) {`       Set` groups = mc.getGroups(true);       for (StructureGroup group : groups) {`           phosphosites.add(group.getPDBResidueNumber());       }`   }`   return phosphosites; } ``` Demo code to run the above methods ---------------------------------- ```java import org.biojava.nbio.structure.ResidueNumber; import org.biojava.nbio.structure.Structure; import org.biojava.nbio.structure.io.PDBFileReader; import org.biojava.nbio.protmod.structure.ProteinModificationIdentifier; public static void main(String[] args) {   try {`       PDBFileReader reader = new PDBFileReader();       reader.setAutoFetch(true);       // identify all modificaitons from PDB:1CAD and print them`       String pdbId = "1CAD";       Structure struc = reader.getStructureById(pdbId);       Set` mcs = identifyAllModfications(struc);       for (ModifiedCompound mc : mcs) {`           System.out.println(mc.toString());       }`       // identify all phosphosites from PDB:3MVJ and print them`       pdbId = "3MVJ";       struc = reader.getStructureById(pdbId);       List` psites = identifyPhosphosites(struc);       for (ResidueNumber psite : psites) {`           System.out.println(psite.toString());       }`   } catch(Exception e) {`       e.printStackTrace();   }` } ``` See also --------
- [How can I get the list of supported protein modifications?](/wiki/BioJava:CookBook3:SupportedProtMod "wikilink") - [How can I define a new protein modification?](/wiki/BioJava:CookBook3:AddProtMod "wikilink")