package com.cipres.mrBayesPlugin.ui; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.util.HashMap; import java.util.Map; import javax.swing.JFileChooser; import com.biomatters.geneious.publicapi.components.Dialogs; import com.biomatters.geneious.publicapi.documents.AnnotatedPluginDocument; import com.biomatters.geneious.publicapi.plugin.Geneious; import com.biomatters.geneious.publicapi.plugin.Options; import com.biomatters.geneious.publicapi.plugin.Options.ButtonOption; import com.biomatters.geneious.publicapi.plugin.Options.Option; import com.biomatters.geneious.publicapi.plugin.Options.OptionValue; import com.biomatters.geneious.publicapi.plugin.Options.StringOption; public class CipresOptions extends Options { protected String OPTION_NAME = null; protected static String GENEIOUS_FORMAT = null; protected static final String NEWLINE = System.getProperty("line.separator"); protected static final String SPACE = " "; public static final String PROTEIN = "Protein"; public static final String NUCLEOTIDE = "Nucleotide"; public static final String RNA_STRUCTURE = "RNA Structure"; public static final String BINARY_MORPHOLOGICAL = "Binary Morphological"; public static final String MULTI_STATE_MORPHOLOGICAL = "Multi-State Morphological"; protected static final String DNA = "dna"; protected static final String RNA = "rna"; protected static final String BINARY = "binary"; protected static final String MULTI = "multi"; protected static final String GTRCAT = "GTRCAT"; protected static final String GTRGAMMA = "GTRGAMMA"; protected static final String HKY85 = "HKY85"; protected static final String K80 = "K80"; protected static final String JC69 = "JC69"; protected static final String ASC_ = "ASC_"; protected static final String LEWIS = "lewis"; protected static final String FELSENSTEIN = "felsenstein"; protected static final String STAMATAKIS = "stamatakis"; //protected static final String PROTEIN_CAT = "Protein CAT"; protected static final String INVARIABLE = "I"; protected static final String FREQUENCY = "F"; protected static final String ML_FREQUENCY = "X"; protected static final String ONE = "1"; protected static final String ZERO = "0"; protected static final String UNDERSCORE = "_"; protected static final String DOT = "."; protected static final String YES = "yes"; protected static final String NO = "no"; public static final String DAYHOFF ="DAYHOFF"; public static final String DCMUT = "DCMUT"; public static final String JTT = "JTT"; public static final String MTREV = "MTREV"; public static final String WAG = "WAG"; public static final String RTREV = "RTREV"; public static final String CPREV = "CPREV"; public static final String VT = "VT"; public static final String BLOSUM62= "BLOSUM62"; public static final String MTMAM = "MTMAM"; public static final String LG = "LG"; public static final String MTART = "MTART"; public static final String MTZOA = "MTZOA"; public static final String PMB = "PMB"; public static final String HIVB ="HIVB"; public static final String HIVW = "HIVW"; public static final String JTTDCMUT = "JTTDCMUT"; public static final String FLU = "FLU"; public static final String DUMMY = "DUMMY"; public static final String DUMMY2 = "DUMMY2"; public static final String AUTO = "AUTO"; public static final String LG4M = "LG4M"; public static final String LG4X = "LG4X"; public static final String PROT_FILE = "PROT_FILE"; public static final String GTR_UNLINKED = "GTR_UNLINKED"; public static final String GTR = "GTR"; private static final String BROWSE = "Browse"; private static final String CLEAR = "Clear"; protected static final String PATTERN1 = "^\\s*$"; protected static final String PATTERN2 = "^((((-[A-Za-z0-9])(\\s+([A-Za-z0-9,_\\.][A-Za-z0-9,_\\.\\-]*))?)|(--\\S+))\\s+)*(((-[A-Za-z0-9])(\\s+([A-Za-z0-9,_\\.][A-Za-z0-9,_\\.\\-]*))?)|(--\\S+))\\s*$"; protected static final String PATTERN3 = "^(-w\\s).*|^(-w$)|.*(\\s+-w\\s).*|.*(\\s+-w$)"; protected static final String PATTERN4 = "^(-T\\s).*|^(-T$)|.*(\\s+-T\\s).*|.*(\\s+-T$)"; protected static final String PATTERN5 = "-w "; protected static final String PATTERN6 = " -w "; protected static final String PATTERN7 = "-T "; protected static final String PATTERN8 = " -T "; protected enum ParamType {VParam, InputParam, MetaData} protected static JFileChooser jfc = new JFileChooser(); protected AnnotatedPluginDocument[] selectedDocuments = null; private int bufferCount = 0; private static final String BUFFERNAME = "buffer"; private StringOption clientJobName; protected Map extraValues = new HashMap(); public CipresOptions() { extraValues.put(" ", ""); } protected void addJobNameOption(Options options, final AnnotatedPluginDocument[] selectedDocuments, int bufferCnt) { options.beginAlignHorizontally(null, false); clientJobName = options.addStringOption("clientJobName","Please specify a job name", selectedDocuments[0].getName()); for (int i = 0; i < bufferCnt; ++i) addBuffer(options); options.endAlignHorizontally(); options.beginAlignHorizontally(null, false); //addCipresDivider(options," "); addLabelBuffer(options); options.endAlignHorizontally(); } protected String getJobName() { return clientJobName.getValueAsString(); } /* public CipresOptions() { String version = Geneious.getVersion(); String[] vers = version.split("\\."); boolean correctVersion = true; try { if (vers != null && vers.length > 0) { int majorVer = Integer.parseInt(vers[0]); if (majorVer <= 11) correctVersion = false; } else correctVersion = false; } catch (Exception e) { correctVersion = false; } if (!correctVersion) { String message = "Your Geneious version is " + version + " which is not compatible with this CIPRES plugin.\n" + "Current CIPRES plugin requires at least Geneious Prime 2019.0.4\n" + "Please upgrade your Geneious. Thank you!"; String aContinue = "Continue"; Dialogs.DialogOptions dialogOptions = new Dialogs.DialogOptions(new String[]{aContinue, "Cancel"}, "Imcompatible Geneious Version", null, Dialogs.DialogIcon.ERROR); Object choice = Dialogs.showDialog(dialogOptions, message); } }*/ //protected AnnotatedPluginDocument[] selectedDocuments = null; protected FileChooser createFileChooser(Options options, String name, String label, boolean enabled) { String[] splitParts = label.split("~"); String watermark = null; if (splitParts.length > 1) { label = splitParts[0].strip(); watermark = splitParts[1].strip(); System.out.println("label = " + label + " watermark = " + watermark); } StringOption selectedFile = (watermark == null? options.addStringOption(name, label, "") : options.addStringOption(name, label, "", watermark)); ButtonOption selectedFileBrowse = options.addButtonOption(name + BROWSE, "", BROWSE); String importFrom = null; if (selectedDocuments != null && selectedDocuments.length > 0) { importFrom = (String) this.selectedDocuments[0].getFieldValue("importedFrom.path"); System.out.println("importFrom=" + importFrom); if (importFrom != null) jfc.setCurrentDirectory(new File(importFrom)); } selectedFileBrowse.addActionListener(new BrowseButtonActionListener(selectedFile, jfc)); ButtonOption clear = options.addButtonOption(name + CLEAR, "", CLEAR); clear.addActionListener(new ClearButtonActionListener(selectedFile)); selectedFile.setEnabled(enabled); selectedFileBrowse.setEnabled(enabled); return new FileChooser(selectedFile, selectedFileBrowse); } protected void addCipresDivider(Options options, String label) { options.addDivider("" + label + ""); } protected void addLabelBuffer(Options options) { options.addLabel(" "); } protected void addBuffer(Options options) { options.addStringOption(BUFFERNAME+(bufferCount++), BUFFERNAME, "").setVisible(false); } protected String getValueAsString(Options options, String name) { /* Option opt = options.getOption(name); if (opt == null) { Map children = options.getChildOptions(); for (Options opts : children.values()) { opt = opts.getOption(name); if (opt != null) break; } }*/ Option opt = findOptionByName(options, name); if (opt != null && opt.isEnabled() ) return opt.getValueAsString(); else return null; } protected Boolean getValueAsBoolean(Options options, String name) { /* Option opt = options.getOption(name); if (opt == null) { Map children = options.getChildOptions(); for (Options opts : children.values()) { opt = opts.getOption(name); if (opt != null) break; } }*/ Option opt = findOptionByName(options, name); if (opt != null && opt.isEnabled() && (opt instanceof BooleanOption)) { BooleanOption bo = (BooleanOption)opt; return bo.getValue(); } else return false; } protected Option findOptionByName(Options options, String name) { Option opt = options.getOption(name); if (opt == null) { Map children = options.getChildOptions(); for (Options opts : children.values()) { opt = opts.getOption(name); if (opt != null) break; } } return opt; } protected void setFileSelectorEnabled(Options options, String name, boolean enabled) { Option opt = findOptionByName(options, name); if (opt != null) opt.setEnabled(enabled); Option optBrowse = findOptionByName(options, name+"Browse"); if (optBrowse != null) optBrowse.setEnabled(enabled); } protected String capitializeFirstChar(String input) { if (input == null || input.isBlank()) return null; return(input.substring(0, 1).toUpperCase() + input.substring(1)); } //protected void setCipresDecription() //{ // //} /* enum RNASecondaryModel { S6A("S6A","Six State Model A"), S6B("S6B","Six State Model B"), S6C("S6C","Six State Model C"), S6D("S6D","Six State Model D"), S6E("S6E","Six State Model E"), S7A("S6A","Seven State Model A"), S7B("S6B","Seven State Model B"), S7C("S6C","Seven State Model C"), S7D("S6D","Seven State Model D"), S7E("S6E","Seven State Model E"), S7F("S6F","Seven State Model F"), S16A("S16A","Sixteen State Model A"), S16B("S16B","Sixteen State Model B"); private final String value; private final String label; RNASecondaryModel(String value, String label) { this.value = value; this.label = label; } public String getValue() { return value; } public String getLabel() { return label; } public static OptionValue[] fillOptionValues() { OptionValue[] opts = new OptionValue[RNASecondaryModel.values().length]; int i = 0; for (RNASecondaryModel model : RNASecondaryModel.values()) { opts[i++] = new OptionValue(model.getValue(), model.getLabel()); } return opts; } }*/ } class FileChooser { public FileChooser(StringOption selectedFile, ButtonOption selectedFileBrowse) { this.selectedFile = selectedFile; this.selectedFileBrowse = selectedFileBrowse; } public StringOption selectedFile; public ButtonOption selectedFileBrowse; } class NameAndLabel { //improve this by make them private and add getXXX() methods public String name; public String label; public String parameter; public String description; public boolean isFile; public NameAndLabel(String name, String label, String parameter, String description) { this.name = name; this.label = label; this.parameter = parameter; this.description = description; this.isFile = (name.contains("File") || name.contains("file")); } public NameAndLabel(String name, String label, String parameter, String description, boolean isFile) { this.name = name; this.label = label; this.parameter = parameter; this.description = description; this.isFile = isFile; } } class ClearButtonActionListener implements ActionListener { private Option option; public ClearButtonActionListener(Option option) { this.option = option; } @Override public void actionPerformed(ActionEvent e) { if (option != null) option.setValueFromString(""); //if (option instanceof FileSelectionOption) //{ // FileSelectionOption fso = (FileSelectionOption)option; // fso.restoreDefault(); //} } } class BrowseButtonActionListener implements ActionListener { private Option option = null; private JFileChooser fileChooser = null; public BrowseButtonActionListener(Option option, JFileChooser fileChooser) { this.option = option; this.fileChooser = fileChooser; } @Override public void actionPerformed(ActionEvent e) { if (fileChooser != null) { int ret = fileChooser.showOpenDialog(null); if (ret == JFileChooser.APPROVE_OPTION) { option.setValueFromString(fileChooser.getSelectedFile().getAbsolutePath()); } } //if (option != null) // option.setValueFromString(""); //if (option instanceof FileSelectionOption) //{ // FileSelectionOption fso = (FileSelectionOption)option; // fso.restoreDefault(); //} } } enum ComboBoxValueLabel { S6A("S6A","Six State Model A"), S6B("S6B","Six State Model B"), S6C("S6C","Six State Model C"), S6D("S6D","Six State Model D"), S6E("S6E","Six State Model E"), S7A("S7A","Seven State Model A"), S7B("S7B","Seven State Model B"), S7C("S7C","Seven State Model C"), S7D("S7D","Seven State Model D"), S7E("S7E","Seven State Model E"), S7F("S7F","Seven State Model F"), S16A("S16A","Sixteen State Model A"), S16B("S16B","Sixteen State Model B"), /*********Binary Model*************/ BINCAT("BINCAT","Binary CAT"), BINGAMMA("BINGAMMA","Binary GAMMA"), /*********Multi States************/ MULTICAT("MULTICAT", "Multi-state CAT"), MULTIGAMMA("MULTIGAMMA","Multi-state GAMMA"), /*********Choose Multi State*******/ ORDERED("ORDERED","Ordered"), MK("MK","MK"), GTR("GTR","GTR"), /**********Analysis Type***********/ fa("fa","(-f a) Rapid bootstrap analysis / search for best-scoring ML tree"), fd("fd","(-f d) Use the default, faster rapid hill-climbing algorithm"), fD("fD","(-f D) Rapid hillclimbing searches that also generate RELL bootstraps"), fb("fb","(-f b) Draw bipartitions onto a single tree topology"), fA("fA","(-f A) Compute Marginal Ancestral States using a rooted reference tree"), fJ("fJ","(-f J) Compute SH-like support values on a given tree passed via -t"), fe("fe","(-f e) Optimize model parameters+branch lengths for given input tree"), fh("fh","(-f h) Compute a log likelihood test"), fT("fT","(-f T) Do A Final Optimization of ML Tree"), fx("fx","(-f x) Compute pair-wise ML distances (GAMMA models only)"), fk("fk","(-f k) Fix long branch lengths in partitioned data sets with missing data"), fE("fE","(-f E) Very fast experimental tree search"), fu("fu","(-f u) Morphological weight calibration using maximum likelihood"), fv("fv","(-f v) Classify a bunch of environmental sequences into a reference tree using thorough read insertions"), fo("fo","(-f o) Use the old and slower rapid hillclimbing without the heuristic cutoff"), I("I","(-I) Use a posteriori boostopping"), J("J","(-J) Compute majority rule consensus tree"), y("y","(-y) Only compute a randomized parsimony starting tree"), /**********Bootstrapping Type********/ NOTMANDATORY("","[Not Mandatory]"), NONPARAMETRIC("b","Non-parametric Boostrapping (-b)"), RAPID("x","Rapid Bootstrapping (-x)"), /**********Bootstrapping Iteration Number**/ SPECIFY("specify","Specify an explicit number of bootstraps"), AUTOBOOTSTOP("bootstop","Let RaxML halt bootstrapping automatically"), /**********Bootstoping Criterion***********/ AUTOFC("autoFC","autoFC"), AUTOMR("autoMR","autoMR"), AUTOMRE("autoMRE","autoMRE"), AUTOMRE_IGN("autoMRE_IGN","autoMRE_IGN"), /**********Majority Rule Tree*************/ MR("MR","Majority rule"), MRE("MRE","Extended majority rule"), STRICT("STRICT","Strict Majority"), MR_DROP("MR_DROP","MR_Drop"), STRICT_DROP("STRICT_DROP","Strict_Drop"), /*******Protein sub model******/ PROTGAMMA("PROTGAMMA","Protein GAMMA"), PROTCAT("PROTCAT","Protein CAT"), IQTREE_VERSION_2("2","1.6.2"), IQTREE_VERSION_6("6","1.6.6"), IQTREE_VERSION_7("7","1.6.7"), IQTREE_VERSION_9("9","1.6.9"), IQTREE_VERSION_10("10","1.6.10"), IQTREE_VERSION_212("212","2.1.2"), IQTREE_VERSION_2225("2225","2.2.2.5"), IQTREE_VERSION_2227("2227","2.2.2.7"), IQTREE_RUNTYPE_MODEL("1","Model Selection"), IQTREE_RUNTYPE_INFERENCE("2","Tree Inference"), IQTREE_SEQUENCE_TYPE_NO_SELECT("NO_SELECT","No Select"), IQTREE_SEQUENCE_TYPE_DNA("DNA","DNA"), IQTREE_SEQUENCE_TYPE_AMINO("AA","Amino Acid"), IQTREE_SEQUENCE_TYPE_BINARY("BIN","Binary"), IQTREE_SEQUENCE_TYPE_MORPH("MORPH","Morphological"), IQTREE_SEQUENCE_TYPE_CODON("CODON","Codon"), IQTREE_SEQUENCE_TYPE_NT2AA("NT2AA","Translate DNA"), IQTREE_CODON1("CODON1","The Standard Code"), IQTREE_CODON2("CODON2","The Vertebrate Mitochondrial Code"), IQTREE_CODON3("CODON3","The Yeast Mitochondrial Code"), IQTREE_CODON4("CODON4","Mold, Protozoan, Coelenterate, Mycoplasma/Spiroplasma"), IQTREE_CODON5("CODON5","The Invertebrate Mitochondrial Code"), IQTREE_CODON6("CODON6","The Ciliate, Dasycladacean and Hexamita Nuclear Code"), IQTREE_CODON9("CODON9","The Echinoderm and Flatworm Mitochondrial Code"), IQTREE_CODON10("CODON10","The Euplotid Nuclear Code"), IQTREE_CODON11("CODON11","The Bacterial, Archaeal and Plant Plastid Code"), IQTREE_CODON12("CODON12","The Alternative Yeast Nuclear Code"), IQTREE_CODON13("CODON13","The Ascidian Mitochondrial Code"), IQTREE_CODON14("CODON14","The Alternative Flatworm Mitochondrial Code"), IQTREE_CODON16("CODON16","Chlorophycean Mitochondrial Code"), IQTREE_CODON21("CODON21","Trematode Mitochondrial Code"), IQTREE_CODON22("CODON22","Scenedesmus obliquus Mitochondrial Code"), IQTREE_CODON23("CODON23","Thraustochytrium Mitochondrial Code"), IQTREE_CODON24("CODON24","Pterobranchia Mitochondrial Code"), IQTREE_CODON25("CODON25","Candidate Division SR1 and Gracilibacteria Code"), IQTREE_NT2AA1("NT2AA1","The Standard Code"), IQTREE_NT2AA2("NT2AA2","The Vertebrate Mitochondrial Code"), IQTREE_NT2AA3("NT2AA3","The Yeast Mitochondrial Code"), IQTREE_NT2AA4("NT2AA4","Mold, Protozoan, Coelenterate, Mycoplasma/Spiroplasma"), IQTREE_NT2AA5("NT2AA5","The Invertebrate Mitochondrial Code"), IQTREE_NT2AA6("NT2AA6","The Ciliate, Dasycladacean and Hexamita Nuclear Code"), IQTREE_NT2AA9("NT2AA9","The Echinoderm and Flatworm Mitochondrial Code"), IQTREE_NT2AA10("NT2AA10","The Euplotid Nuclear Code"), IQTREE_NT2AA11("NT2AA11","The Bacterial, Archaeal and Plant Plastid Code"), IQTREE_NT2AA12("NT2AA12","The Alternative Yeast Nuclear Code"), IQTREE_NT2AA13("NT2AA13","The Ascidian Mitochondrial Code"), IQTREE_NT2AA14("NT2AA14","The Alternative Flatworm Mitochondrial Code"), IQTREE_NT2AA16("NT2AA16","Chlorophycean Mitochondrial Code"), IQTREE_NT2AA21("NT2AA21","Trematode Mitochondrial Code"), IQTREE_NT2AA22("NT2AA22","Scenedesmus obliquus Mitochondrial Code"), IQTREE_NT2AA23("NT2AA23","Thraustochytrium Mitochondrial Code"), IQTREE_NT2AA24("NT2AA24","Pterobranchia Mitochondrial Code"), IQTREE_NT2AA25("NT2AA25","Candidate Division SR1 and Gracilibacteria Code"), IQTREE_QUARTET_NO(" ","[Not Mandatory]"), IQTREE_QUARTET_ALL("ALL","All"), IQTREE_QUARTET_SPECIFY("specify_quartet","Specify number"), IQTREE_PARTITION_TYPE_NO("","[Not Mandatory]"), IQTREE_PARTITION_TYPE_Q("-q","Edge-equal partition model (-q)"), IQTREE_PARTITION_TYPE_SPP("-spp","Allow partitions to have different speeds (-spp)"), IQTREE_PARTITION_TYPE_SP("-sp", "Edge-unlinked partition model (-sp) "), IQTREE_PARTITION_0(" ","[Not Mandatory]"), IQTREE_PARTITION_2("2","2"), IQTREE_PARTITION_3("3","3"), IQTREE_PARTITION_4("4","4"), IQTREE_PARTITION_5("5","5"), IQTREE_TESTONLY("TESTONLY","TESTONLY"), IQTREE_TEST("TEST","TEST"), IQTREE_TESTNEWONLY("TESTNEWONLY","TESTNEWONLY"), IQTREE_TESTNEW("TESTNEW","TESTNEW"), IQTREE_TESTMERGEONLY("TESTMERGEONLY","TESTMERGEONLY"), IQTREE_TESTMERGE("TESTMERGE","TESTMERGE"), IQTREE_TESTNEWMERGEONLY("TESTNEWMERGEONLY","TESTNEWMERGEONLY"), IQTREE_TESTNEWMERGE("TESTNEWMERGE","TESTNEWMERGE"), IQTREE_NUCLEAR("nuclear","Nuclear"), IQTREE_MITOCHONDRIAL("mitochondrial","Mitochondrial"), IQTREE_CHLOROPLAST("chloroplast","Chloroplast"), IQTREE_VIRAL("viral","Viral"), IQTREE_JC69("JC69","JC/JC69"), IQTREE_F81("F81","F81"), IQTREE_K80("K80","K2P/K80"), IQTREE_HKY("HKY","HKY/HKY85"), IQTREE_TN93("TN93","TN/TrN/TN93"), IQTREE_TNe("TNe","TNe"), IQTREE_("K81","K3P/K81"), IQTREE_K81u("K81u","K81u"), IQTREE_TPM2("TPM2","TPM2"), IQTREE_TPM2u("TPM2u","TPM2u"), IQTREE_TPM3("TPM3","TPM3"), IQTREE_TPM3u("TPM3u","TPM3u"), IQTREE_TIM("TIM","TIM"), IQTREE_TIMe("TIMe","TIMe"), IQTREE_TIM2("TIM2","TIM2"), IQTREE_TIM2e("TIM2e","TIM2e"), IQTREE_TIM3("TIM3","TIM3"), IQTREE_TIM3e("TIM3e","TIM3e"), IQTREE__TVM("TVM","TVM"), IQTREE_TVMe("TVMe","TVMe"), IQTREE_SYM("SYM","SYM"), IQTREE_GTR("GTR","GTR"), IQTREE_BLOSUM62("BLOSUM62","BLOSUM62"), IQTREE_cpREV("cpREV","cpREV"), IQTREE_Dayhoff("Dayhoff","Dayhoff"), IQTREE_DCMut("DCMut","DCMut"), IQTREE_FLU("FLU","FLU"), IQTREE_HIVb("HIVb","HIVb"), IQTREE_HIVw("HIVw","HIVw"), IQTREE_JTT("JTT","JTT"), IQTREE_JTTDCMut("JTTDCMut","JTTDCMut"), IQTREE_LG("LG","LG"), IQTREE_mtART("mtART","mtART"), IQTREE_mtMAM("mtMAM","mtMAM"), IQTREE_mtREV("mtREV","mtREV"), IQTREE_mtZOA("mtZOA","mtZOA"), IQTREE_mtMet("mtMet", "mtMet"), IQTREE_mtVer("mtVer", "mtVer"), IQTREE_mtInv("mtInv", "mtInv"), IQTREE_Poisson("Poisson","Poisson"), IQTREE_PMB("PMB","PMB"), IQTREE_rtREV("rtREV","rtREV"), IQTREE_VT("VT","VT"), IQTREE_WAG("WAG","WAG"), IQTREE_C10("C10","C10"), IQTREE_C20("C20","C20"), IQTREE_C30("C30","C30"), IQTREE_C40("C40","C40"), IQTREE_C50("C50","C50"), IQTREE_C60("C60","C60"), IQTREE_EX2("EX2","EX2"), IQTREE_EX3("EX3","EX3"), IQTREE_EHO("EHO","EHO"), IQTREE_UL2("UL2","UL2"), IQTREE_UL3("UL3","UL3"), IQTREE_EX_EHO("EX_EHO","EX_EHO"), IQTREE_LG4M("LG4M","LG4M"), IQTREE_LG4X("LG4X","LG4X"), IQTREE_CF4("CF4","CF4"), IQTREE_PC10("+C10","C10"), IQTREE_PC20("+C20","C20"), IQTREE_PC30("+C30","C30"), IQTREE_PC40("+C40","C40"), IQTREE_PC50("+C50","C50"), IQTREE_PC60("+C60","C60"), IQTREE_PEX2("+EX2","EX2"), IQTREE_PEX3("+EX3","EX3"), IQTREE_PEHO("+EHO","EHO"), IQTREE_PUL2("+UL2","UL2"), IQTREE_PUL3("+UL3","UL3"), IQTREE_PEX_EHO("+EX_EHO","EX_EHO"), IQTREE_PLG4M("+LG4M","LG4M"), IQTREE_PG4X("+LG4X","LG4X"), IQTREE_PCF4("+CF4","CF4"), IQTREE_JC2("JC2","JC2"), IQTREE_GTR2("GTR2","GTR2"), IQTREE_MK("MK","MK"), IQTREE_ORDERED("ORDERED","Ordered"), IQTREE_MG("MG","MG"), IQTREE_MGK("MGK","MGK"), IQTREE_MG1KTS("MG1KTS","MG1KTS"), IQTREE_MG1KTV("MG1KTV","MG1KTV"), IQTREE_MG2K("MG2K","MG2K"), IQTREE_GY("GY","GY"), IQTREE_GY1KTS("GY1KTS","GY1KTS"), IQTREE_GY1KTV("GY1KTV","GY1KTV"), IQTREE_GY2K("GY2K","GY2K"), IQTREE_KOSI07("KOSI07","ECMK07/KOSI07"), IQTREE_ECMrest("ECMrest","ECMrest"), IQTREE_SCHN05("SCHN05","ECMS05/SCHN05"), IQTREE_F("+F","Empirical state frequency"), IQTREE_FO("+FO","State frequency optimized by maximum-likelihood"), IQTREE_FQ("+FQ","Equal state frequency"), IQTREE_F1x4("+F1x4","+F1x4"), IQTREE_F3x4("+F3x4","+F3x4"), IQTREE_I("+I","Invariable sites"), IQTREE_G("+G","Discrete Gamma model"), IQTREE_IG("+I+G","Invariable site plus discrete Gamma model"), IQTREE_R("+R","FreeRate model"), IQTREE_IR("+I+R","Invariable site plus FreeRate model"), IQTREE_YES("+ASC", "yes"), IQTREE_NO("", "no"), IQTREE_NOBOOT(" ", "no bootstrapping"), IQTREE_BB("bb","Ultrafast (bb)"), IQTREE_B("b","Non-Parametric (complete,b)"), IQTREE_BO("bo","Non-Parametric (bo)"), IQTREE_BC("bc","Non-Parametric (bc)"), IQTREE_GENE("GENE","GENE"), IQTREE_GENESITE("GENESITE","GENESITE"), IQTREE_none(" ", " "), IQTREE_r("-r","Yule-Harding model"), IQTREE_ru("-ru","Uniform"), IQTREE_rcat("-rcat","Caterpillar"), IQTREE_rbal("-rbal","Balanced"), IQTREE_rcsg("-rcsg","Circular Split"), IQTREE_LM("+LM", "Consider all Lie Markov models"), IQTREE_LMRY("+LMRY", "Consider all Lie Markov models with RY symmetry"), IQTREE_LMWS("+LMWS", "Consider all Lie Markov models with WS symmtry"), IQTREE_LMMK("+LMMK", "Consider all Lie Markov models with MK symmtry"), IQTREE_LMSS("+LMSS", "Consider all strand-symmetric Lie Markov models"), IQTREE_NOTMANDATORY(" ","[Not Mandatory]"), IQTREE_RCLUSTER("-rcluster", "rcluster"), IQTREE_RCLUSTERF("-rclusterf", "rclusterf"), IQTREE_RCLUSTERMAX("-rcluster-max", "specify max partition pairs"), IQTREE_SYMTEST("symtest", "Symtest"), IQTREE_SYMTEST_REMOVE_BAD("symtest-remove-bad", "Symtest and remove bad"), IQTREE_SYMTEST_REMOVE_GOOD("symtest-remove-good", "Symtest and remove good"), IQTREE_SYMTEST_KEEP_ZERO("symtest-keep-zero", "Symtest keep zero"), IQTREE_SYMTYPE_PVAL("pval", "PVAL"), IQTREE_SYMTYPE_MAR("MAR", "MARginal"), IQTREE_SYMTYPE_INT("INT", "INTernal"), ; private final String value; private final String label; ComboBoxValueLabel(String value, String label) { this.value = value; this.label = label; } public String getValue() { return value; } public String getLabel() { return label; } public static OptionValue[] fillOptionValues(ComboBoxValueLabel begin, ComboBoxValueLabel end) { if (begin.ordinal() > end.ordinal()) return null; OptionValue[] opts = new OptionValue[end.ordinal() + 1 - begin.ordinal()]; int i = 0; for (ComboBoxValueLabel model : ComboBoxValueLabel.values()) { if (model.ordinal() >= begin.ordinal() && model.ordinal() <= end.ordinal()) opts[i++] = new OptionValue(model.getValue().strip(), model.getLabel()); } return opts; } public static OptionValue[] fillOptionValues(Map extraValuesMap, ComboBoxValueLabel begin, ComboBoxValueLabel end) { if (begin.ordinal() > end.ordinal() || extraValuesMap == null) return null; OptionValue[] opts = new OptionValue[extraValuesMap.size() + end.ordinal() + 1 - begin.ordinal()]; int i = 0; for (Map.Entry e : extraValuesMap.entrySet()) { opts[i++] = new OptionValue(e.getValue(), e.getKey()); } for (ComboBoxValueLabel model : ComboBoxValueLabel.values()) { if (model.ordinal() >= begin.ordinal() && model.ordinal() <= end.ordinal()) opts[i++] = new OptionValue(model.getValue(), model.getLabel()); } return opts; } } /* enum RNASecondaryModel { RNASecondaryModel(String val, String label) { this.val = val1; this.label = label; } private String val; private String label; }*/