001/* 002 * BioJava development code 003 * 004 * This code may be freely distributed and modified under the 005 * terms of the GNU Lesser General Public Licence. This should 006 * be distributed with the code. If you do not have a copy, 007 * see: 008 * 009 * http://www.gnu.org/copyleft/lesser.html 010 * 011 * Copyright for this code is held jointly by the individual 012 * authors. These should be listed in @author doc comments. 013 * 014 * For more information on the BioJava project and its aims, 015 * or to join the biojava-l mailing list, visit the home page 016 * at: 017 * 018 * http://www.biojava.org/ 019 * 020 * 021 * Author: Andreas Prlic 022 * 023 */ 024package org.biojava.nbio.structure.domain; 025 026import org.biojava.nbio.structure.*; 027import org.biojava.nbio.structure.domain.pdp.*; 028 029import java.util.List; 030 031 032/** Protein Domain Parser is a an algorithm that attempts at assigning domains for 3D protein structures. 033 * Since domains in proteins are difficult to define, results detected by automated algorithms have to be taken with a grain of salt. 034 * 035 * see<pre> 036J Mol Biol. 2004 Jun 4;339(3):647-78. 037 038Toward consistent assignment of structural domains in proteins. 039 040Veretnik S, Bourne PE, Alexandrov NN, Shindyalov IN. 041</pre> 042 043 * This implementation is based on a Java port of the PDP algorithm, as described in: 044 * 045 * 046 * @author Andreas Prlic 047 * @since 3.0.2 048 */ 049public class LocalProteinDomainParser { 050 051 052 /** make sure this class can only get accessed via the static method calls 053 * 054 */ 055 private LocalProteinDomainParser(){ 056 057 } 058 059 /** Suggest domains for a protein structure 060 * 061 * @param s the protein structure 062 * @return a list of possible domains 063 * @throws StructureException 064 */ 065 public static List<Domain> suggestDomains(Structure s) throws StructureException{ 066 067 Atom[] ca = StructureTools.getRepresentativeAtomArray(s); 068 069 return suggestDomains(ca); 070 } 071 072 073 /** Suggest domains for a set of Calpha atoms 074 * 075 * @param ca an array of Calpha atoms 076 * @return a list of possible domains 077 * @throws StructureException 078 */ 079 public static List<Domain> suggestDomains(Atom[] ca) throws StructureException{ 080 081 GetDistanceMatrix distMaxCalculator = new GetDistanceMatrix(); 082 083 PDPDistanceMatrix pdpMatrix = distMaxCalculator.getDistanceMatrix(ca); 084 085 086 087 Domain dom = new Domain(); 088 Chain c = ca[0].getGroup().getChain(); 089 dom.setId("D"+c.getStructure().getPDBCode()+c.getId()+"1"); 090 dom.setSize(ca.length); 091 dom.setNseg(1); 092 dom.getSegmentAtPos(0).setFrom(0); 093 dom.getSegmentAtPos(0).setTo(ca.length-1); 094 095 CutSites cutSites = new CutSites(); 096 097 // Do the initial splitting 098 CutDomain cutDomain = new CutDomain(ca,pdpMatrix); 099 cutDomain.cutDomain(dom, cutSites, pdpMatrix); 100 List<Domain> domains = cutDomain.getDomains(); 101 102 103 // 104 domains = ClusterDomains.cluster(domains, pdpMatrix); 105 106 ShortSegmentRemover.cleanup(domains); 107 108 109 return domains; 110 111 } 112 113 114 115}