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 org.biojava.nbio.structure.align.seq;
022
023import org.biojava.nbio.structure.align.StructureAlignment;
024import org.biojava.nbio.structure.align.ce.AbstractUserArgumentProcessor;
025import org.biojava.nbio.structure.align.ce.StartupParameters;
026
027public class SmithWatermanUserArgumentProcessor extends AbstractUserArgumentProcessor{
028
029
030        protected static class SmithWatermanStartupParams extends StartupParameters {
031
032                private short gapOpen;
033                private short gapExtend;
034                private double maxRmsd;
035                private int minLen;
036
037                public SmithWatermanStartupParams() {
038                        super();
039                }
040
041                public short getGapOpen() {
042                        return gapOpen;
043                }
044
045                public void setGapOpen(short gapOpen) {
046                        this.gapOpen = gapOpen;
047                }
048
049                public short getGapExtend() {
050                        return gapExtend;
051                }
052
053                public void setGapExtend(short gapExtend) {
054                        this.gapExtend = gapExtend;
055                }
056
057
058                public double getMaxRmsd() {
059                        return maxRmsd;
060                }
061
062                public void setMaxRmsd(double maxRmsd) {
063                        this.maxRmsd = maxRmsd;
064                }
065
066                public int getMinLen() {
067                        return minLen;
068                }
069
070                public void setMinLen(int minLen) {
071                        this.minLen = minLen;
072                }
073
074                @Override
075                public String toString() {
076                        StringBuilder builder = new StringBuilder();
077                        builder.append("SmithWatermanStartupParams [gapOpen=")
078                        .append(gapOpen).append(", gapExtend=").append(gapExtend)
079                        .append("]").append(", maxRmsd=").append(maxRmsd)
080                        .append(", minLen=").append(minLen).append("]");
081                        return builder.toString();
082                }
083        }
084
085
086        @Override
087        public StructureAlignment getAlgorithm() {
088                return new SmithWaterman3Daligner();
089        }
090
091
092
093        @Override
094        public Object getParameters() {
095                StructureAlignment alignment = getAlgorithm();
096
097                SmithWaterman3DParameters p = (SmithWaterman3DParameters) alignment.getParameters();
098                SmithWatermanStartupParams startup = (SmithWatermanStartupParams) params;
099
100                if ( p == null)
101                        p = new SmithWaterman3DParameters();
102
103                p.setGapExtend(startup.getGapExtend());
104                p.setGapOpen(startup.getGapOpen());
105                p.setMaxRmsd(startup.getMaxRmsd());
106                p.setMinLen(startup.getMinLen());
107
108                return p;
109        }
110
111        @Override
112        public String getDbSearchLegend(){
113                String legend = "# name1\tname2\tscore\tz-score\trmsd\tlen1\tlen2\tsim1\tsim2\t " ;
114                return legend;
115        }
116
117
118
119        @Override
120        protected StartupParameters getStartupParametersInstance() {
121                return new SmithWatermanStartupParams();
122        }
123
124}