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 */
021package demo;
022
023
024import org.biojava.nbio.structure.Structure;
025import org.biojava.nbio.structure.align.util.AtomCache;
026import org.biojava.nbio.structure.domain.LocalProteinDomainParser;
027import org.biojava.nbio.structure.domain.pdp.Domain;
028import org.biojava.nbio.structure.domain.pdp.Segment;
029import org.biojava.nbio.structure.io.FileParsingParameters;
030
031import java.util.List;
032
033public class DemoDomainsplit {
034
035        public static void main(String[] args){
036
037                DemoDomainsplit split = new DemoDomainsplit();
038
039                //String pdbId = "3gly";
040                String pdbId = "4hhb";
041
042                split.basicLoad(pdbId);
043
044        }
045
046        public void basicLoad(String pdbId){
047
048                try {
049
050                        // This utility class can automatically download missing PDB files.
051                        AtomCache cache = new AtomCache();
052
053                        //
054                        // configure the parameters of file parsing (optional)
055
056                        FileParsingParameters params = new FileParsingParameters();
057
058                        // should the ATOM and SEQRES residues be aligned when creating the internal data model?
059                        params.setAlignSeqRes(true);
060                        // should secondary structure get parsed from the file
061                        params.setParseSecStruc(false);
062
063                        // and set the params in the cache.
064                        cache.setFileParsingParams(params);
065
066                        // end of optional part
067
068                        Structure struc = cache.getStructure(pdbId);
069
070                        System.out.println("structure loaded: " + struc);
071
072                        List<Domain> domains = LocalProteinDomainParser.suggestDomains(struc);
073
074                        System.out.println("RESULTS: =====");
075                        for ( Domain dom : domains){
076                                System.out.println("DOMAIN:" + dom.getSize() + " " +  dom.getScore());
077                                List<Segment> segments = dom.getSegments();
078                                for ( Segment s : segments){
079                                        System.out.println("   Segment: " + s);
080                                }
081                        }
082                } catch (Exception e){
083                        e.printStackTrace();
084                }
085
086        }
087}