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 * Created on Nov 2, 2009 021 * Author: Andreas Prlic 022 * 023 */ 024 025package org.biojava.nbio.structure.align.ce; 026 027 028import org.biojava.nbio.structure.align.StructureAlignment; 029import org.biojava.nbio.structure.align.ce.CeParameters.ScoringStrategy; 030 031/** 032 * Process the arguments from command line 033 * 034 * @author Andreas Prlic 035 * 036 */ 037public class CeUserArgumentProcessor extends AbstractUserArgumentProcessor { 038 039 protected static class CeStartupParams extends StartupParameters { 040 protected int maxGapSize; 041 protected int winSize; 042 protected ScoringStrategy scoringStrategy; 043 protected double maxOptRMSD; 044 protected double gapOpen; 045 protected double gapExtension; 046 protected boolean showAFPRanges; 047 048 public CeStartupParams() { 049 super(); 050 maxGapSize = 30; 051 winSize = 8; 052 scoringStrategy = CeParameters.ScoringStrategy.DEFAULT_SCORING_STRATEGY; 053 showAFPRanges = false; 054 maxOptRMSD = 99d; 055 gapOpen = CeParameters.DEFAULT_GAP_OPEN; 056 gapExtension = CeParameters.DEFAULT_GAP_EXTENSION; 057 } 058 059 public int getWinSize() { 060 return winSize; 061 } 062 063 public void setWinSize(int winSize) { 064 this.winSize = winSize; 065 } 066 067 public ScoringStrategy getScoringStrategy() { 068 return scoringStrategy; 069 } 070 071 public void setScoringStrategy(ScoringStrategy scoringStrategy) { 072 this.scoringStrategy = scoringStrategy; 073 } 074 075 public double getGapOpen() { 076 return gapOpen; 077 } 078 079 public void setGapOpen(double gapOpen) { 080 this.gapOpen = gapOpen; 081 } 082 083 public double getGapExtension() { 084 return gapExtension; 085 } 086 087 public void setGapExtension(double gapExtension) { 088 this.gapExtension = gapExtension; 089 } 090 091 /** CE specific parameter: set the Max gap size parameter G (during AFP extension). Default: 30 092 * 093 * @return the maximum gap size G parameter. 094 */ 095 public int getMaxGapSize() { 096 return maxGapSize; 097 } 098 099 /** CE specific parameter: set the Max gap size parameter G (during AFP extension). Default: 30 100 * 101 * @param maxGapSize 102 */ 103 public void setMaxGapSize(int maxGapSize) { 104 this.maxGapSize = maxGapSize; 105 } 106 107 public boolean isShowAFPRanges() 108 { 109 return showAFPRanges; 110 } 111 112 public void setShowAFPRanges(boolean showAFP) 113 { 114 this.showAFPRanges = showAFP; 115 } 116 117 118 /**(jCE specific): maximum RMSD that shall be calculated for the alignment. 119 * 120 * @return maxOptRMSD parameter 121 */ 122 public Double getMaxOptRMSD() { 123 return maxOptRMSD; 124 } 125 126 /** (jCE specific): maximum RMSD that shall be calculated for the alignment. 127 * 128 * @param maxOptRMSD max RMSD to calculate 129 */ 130 public void setMaxOptRMSD(Double maxOptRMSD) { 131 this.maxOptRMSD = maxOptRMSD; 132 } 133 134 @Override 135 public String toString() { 136 StringBuilder builder = new StringBuilder(); 137 builder.append("CeStartupParams [maxGapSize=").append(maxGapSize) 138 .append(", winSize=").append(winSize) 139 .append(", scoringStrategy=").append(scoringStrategy) 140 .append(", maxOptRMSD=").append(maxOptRMSD) 141 .append(", gapOpen=").append(gapOpen) 142 .append(", gapExtension=").append(gapExtension) 143 .append(", showAFPRanges=").append(showAFPRanges) 144 .append(", pdbFilePath=").append(pdbFilePath) 145 .append(", cacheFilePath=").append(cacheFilePath) 146 .append(", outFile=").append(outFile).append(", pdb1=") 147 .append(pdb1).append(", pdb2=").append(pdb2) 148 .append(", file1=").append(file1).append(", file2=") 149 .append(file2).append(", showDBresult=") 150 .append(showDBresult).append(", printXML=") 151 .append(printXML).append(", printFatCat=") 152 .append(printFatCat).append(", show3d=").append(show3d) 153 .append(", autoFetch=").append(autoFetch) 154 .append(", printCE=").append(printCE).append(", showMenu=") 155 .append(showMenu).append(", printPDB=").append(printPDB) 156 .append(", isDomainSplit=").append(isDomainSplit) 157 .append(", alignPairs=").append(alignPairs) 158 .append(", saveOutputDir=").append(saveOutputDir) 159 .append(", nrCPU=").append(nrCPU).append("]"); 160 return builder.toString(); 161 } 162 163 } 164 165 @Override 166 protected StartupParameters getStartupParametersInstance() { 167 return new CeStartupParams(); 168 } 169 170 @Override 171 public StructureAlignment getAlgorithm() { 172 return new CeMain(); 173 } 174 175 176 @Override 177 public Object getParameters() { 178 179 StructureAlignment alignment = getAlgorithm(); 180 181 CeParameters aligParams = (CeParameters) alignment.getParameters(); 182 CeStartupParams startParams = (CeStartupParams) params; 183 184 if ( aligParams == null) 185 aligParams = new CECPParameters(); 186 187 // Copy relevant parameters from the startup parameters 188 aligParams.setMaxGapSize(startParams.getMaxGapSize()); 189 aligParams.setWinSize(startParams.getWinSize()); 190 aligParams.setScoringStrategy(startParams.getScoringStrategy()); 191 aligParams.setMaxOptRMSD(startParams.getMaxOptRMSD()); 192 aligParams.setGapOpen(startParams.getGapOpen()); 193 aligParams.setGapExtension(startParams.getGapExtension()); 194 aligParams.setShowAFPRanges(startParams.isShowAFPRanges()); 195 return aligParams; 196 } 197 198 199 @Override 200 public String getDbSearchLegend(){ 201 //String legend = "# name1\tname2\tscore\tz-score\trmsd\tlen1\tlen2\tsim1\tsim2\t " ; 202 //return legend; 203 204 return "# name1\tname2\tscore\tz-score\trmsd\tlen1\tlen2\tcov1\tcov2\t%ID\tDescription\t " ; 205 206 } 207 208 209}