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
023import org.biojava.nbio.core.sequence.ProteinSequence;
024import org.biojava.nbio.core.sequence.compound.AminoAcidCompound;
025import org.biojava.nbio.core.sequence.compound.AminoAcidCompoundSet;
026import org.biojava.nbio.core.sequence.loader.UniprotProxySequenceReader;
027import org.biojava.nbio.ronn.Jronn;
028
029import java.util.Arrays;
030
031public class PredictDisorder {
032
033        public static void main(String[] args) throws Exception{
034
035                String uniprotID = "O30642";
036
037                ProteinSequence seq = getUniprot(uniprotID);
038                System.out.println("Protein Sequence: "+ seq.toString());
039                AminoAcidCompoundSet compoundSet = AminoAcidCompoundSet.getAminoAcidCompoundSet();
040
041                if (!compoundSet.isValidSequence(seq) ) {
042                        System.err.println("Invalid sequence, exiting");
043                        System.exit(1);
044                }
045
046                float[] values = Jronn.getDisorderScores(seq);
047
048                System.out.println("Disorder Scores: "+ Arrays.toString(values));
049
050
051        }
052
053        /** Fetch a protein sequence from the UniProt web site
054         *
055         * @param uniProtID
056         * @return a Protein Sequence
057         * @throws Exception
058         */
059        private static ProteinSequence getUniprot(String uniProtID) throws Exception {
060
061                AminoAcidCompoundSet set = AminoAcidCompoundSet.getAminoAcidCompoundSet();
062                UniprotProxySequenceReader<AminoAcidCompound> uniprotSequence = new UniprotProxySequenceReader<AminoAcidCompound>(uniProtID,set);
063
064                ProteinSequence seq = new ProteinSequence(uniprotSequence);
065
066                return seq;
067        }
068}