本文整理汇总了Java中dr.app.util.Arguments类的典型用法代码示例。如果您正苦于以下问题:Java Arguments类的具体用法?Java Arguments怎么用?Java Arguments使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Arguments类属于dr.app.util包,在下文中一共展示了Arguments类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeTaxa
import dr.app.util.Arguments; //导入依赖的package包/类
/**
* Generate a taxa block from these beast options
*
* @param writer the writer
* @param taxonList the taxon list to write
* @throws dr.app.util.Arguments.ArgumentException
* ArgumentException
*/
private void writeTaxa(TaxonList taxonList, XMLWriter writer) throws Arguments.ArgumentException {
// -1 (single taxa), 0 (1st gene of multi-taxa)
writer.writeComment("The list of taxa to be analysed (can also include dates/ages).",
"ntax=" + taxonList.getTaxonCount());
writer.writeOpenTag(TaxaParser.TAXA, new Attribute[]{new Attribute.Default<String>(XMLParser.ID, TaxaParser.TAXA)});
boolean hasAttr = options.traits.size() > 0;
boolean firstDate = true;
for (int i = 0; i < taxonList.getTaxonCount(); i++) {
Taxon taxon = taxonList.getTaxon(i);
boolean hasDate = false;
if (options.clockModelOptions.isTipCalibrated()) {
hasDate = TaxonList.Utils.hasAttribute(taxonList, i, dr.evolution.util.Date.DATE);
}
if (hasDate) {
dr.evolution.util.Date date = (dr.evolution.util.Date) taxon.getAttribute(dr.evolution.util.Date.DATE);
if (firstDate) {
options.units = date.getUnits();
firstDate = false;
} else {
if (options.units != date.getUnits()) {
System.err.println("Error: Units in dates do not match.");
}
}
}
writeTaxon(taxon, hasDate, hasAttr, writer);
}
writer.writeCloseTag(TaxaParser.TAXA);
}
示例2: printUsage
import dr.app.util.Arguments; //导入依赖的package包/类
private void printUsage(Arguments arguments) {
arguments.printUsage(
"java -Djava.library.path=/usr/local/lib -jar buss.jar", " "
+ SPLIT_PARTITION + " " + "[<output-file-name>] [<seed>] [<true|false>] [<true|false>]");
System.out.println();
System.out
.println(" Example: java -Djava.library.path=/usr/local/lib -jar pibuss.jar "
+ "-treeFile SimTree.figtree -from 1 -to 500 -every 1 -branchSubstitutionModel HKY -HKYsubstitutionParameterValues 1.0"
+ " "
+ SPLIT_PARTITION
+ " "
+ "-treeFile SimTree.figtree -from 501 -to 1000 -every 1 -branchSubstitutionModel HKY -HKYsubstitutionParameterValues 10.0"
+ " " + SPLIT_PARTITION + " " + "sequences.fasta");
System.out.println();
}
示例3: writeTaxon
import dr.app.util.Arguments; //导入依赖的package包/类
/**
* Generate a taxa block from these beast options
*
* @param writer the writer
* @param taxon the taxon to write
* @throws dr.app.util.Arguments.ArgumentException
* ArgumentException
*/
private void writeTaxon(Taxon taxon, boolean hasDate, boolean hasAttr, XMLWriter writer) throws Arguments.ArgumentException {
writer.writeTag(TaxonParser.TAXON, new Attribute[]{
new Attribute.Default<String>(XMLParser.ID, taxon.getId())},
!(hasDate || hasAttr)); // false if any of hasDate or hasAttr is true
if (hasDate) {
dr.evolution.util.Date date = (dr.evolution.util.Date) taxon.getAttribute(dr.evolution.util.Date.DATE);
Attribute[] attributes;
if (date.getUncertainty() > 0.0) {
attributes = new Attribute[] {
new Attribute.Default<Double>(DateParser.VALUE, date.getTimeValue()),
new Attribute.Default<String>(DateParser.DIRECTION, date.isBackwards() ? DateParser.BACKWARDS : DateParser.FORWARDS),
new Attribute.Default<String>(DateParser.UNITS, Units.Utils.getDefaultUnitName(options.units)),
new Attribute.Default<Double>(DateParser.UNCERTAINTY, date.getUncertainty())
};
} else {
attributes = new Attribute[] {
new Attribute.Default<Double>(DateParser.VALUE, date.getTimeValue()),
new Attribute.Default<String>(DateParser.DIRECTION, date.isBackwards() ? DateParser.BACKWARDS : DateParser.FORWARDS),
new Attribute.Default<String>(DateParser.UNITS, Units.Utils.getDefaultUnitName(options.units))
//new Attribute.Default("origin", date.getOrigin()+"")
};
}
writer.writeTag(dr.evolution.util.Date.DATE, attributes, true);
}
for (TraitData trait : options.traits) {
// there is no harm in allowing the species trait to be listed in the taxa
// if (!trait.getName().equalsIgnoreCase(TraitData.TRAIT_SPECIES)) {
writer.writeOpenTag(AttributeParser.ATTRIBUTE, new Attribute[]{
new Attribute.Default<String>(Attribute.NAME, trait.getName())});
// denotes missing data using '?'
writer.writeText(taxon.containsAttribute(trait.getName()) ? taxon.getAttribute(trait.getName()).toString() : "?");
writer.writeCloseTag(AttributeParser.ATTRIBUTE);
// }
}
generateInsertionPoint(ComponentGenerator.InsertionPoint.IN_TAXON, taxon, writer);
if (hasDate || hasAttr) writer.writeCloseTag(TaxonParser.TAXON);
}
示例4: parseVariableLengthDoubleArray
import dr.app.util.Arguments; //导入依赖的package包/类
public static double[] parseVariableLengthDoubleArray(String inString) throws Arguments.ArgumentException {
List<Double> returnList = new ArrayList<Double>();
StringTokenizer st = new StringTokenizer(inString, ",");
while (st.hasMoreTokens()) {
try {
returnList.add(Double.parseDouble(st.nextToken()));
} catch (NumberFormatException e) {
throw new Arguments.ArgumentException();
}
}
if (returnList.size() > 0) {
double[] doubleArray = new double[returnList.size()];
for (int i = 0; i < doubleArray.length; i++)
doubleArray[i] = returnList.get(i);
return doubleArray;
}
return null;
}
示例5: parseVariableLengthDoubleArray
import dr.app.util.Arguments; //导入依赖的package包/类
public static double[] parseVariableLengthDoubleArray(String inString) throws Arguments.ArgumentException {
List<Double> returnList = new ArrayList<Double>();
StringTokenizer st = new StringTokenizer(inString,",");
while(st.hasMoreTokens()) {
try {
returnList.add(Double.parseDouble(st.nextToken()));
} catch (NumberFormatException e) {
throw new Arguments.ArgumentException();
}
}
if (returnList.size()>0) {
double[] doubleArray = new double[returnList.size()];
for(int i=0; i<doubleArray.length; i++)
doubleArray[i] = returnList.get(i);
return doubleArray;
}
return null;
}
示例6: printUsage
import dr.app.util.Arguments; //导入依赖的package包/类
public static void printUsage(Arguments arguments) {
arguments.printUsage("densityplotter", "<input-file-name> [<output-file-name>]");
System.out.println();
System.out.println(" Example: densityplotter -burnin 100 -trait rate test.trees density.plot");
System.out.println();
}
示例7: printUsage
import dr.app.util.Arguments; //导入依赖的package包/类
public static void printUsage(Arguments arguments) {
arguments.printUsage("GetAncestralSequenceFromSplitTrait", "[<*.tree file-name> [<output-file-name>]]");
System.out.println();
System.out.println(" Example: ...");
System.out.println(" Example: ...");
System.out.println();
}
示例8: printUsage
import dr.app.util.Arguments; //导入依赖的package包/类
public static void printUsage(Arguments arguments) {
arguments.printUsage(commandName, "<input-file-name> [<output-file-name>]");
progressStream.println();
progressStream.println(" Example: " + commandName + " indicator.log rates.out");
progressStream.println();
}
示例9: printUsage
import dr.app.util.Arguments; //导入依赖的package包/类
public static void printUsage(Arguments arguments) {
arguments.printUsage("beastgen", "<template-file-name> <input-file-name> [<output-file-name>]");
System.out.println();
System.out.println(" Example: beastgen template.beast test.nex test.xml");
System.out.println(" Example: beastgen -help");
System.out.println();
}
示例10: printUsage
import dr.app.util.Arguments; //导入依赖的package包/类
public static void printUsage(Arguments arguments) {
arguments.printUsage("beast", "[<input-file-name>]");
System.out.println();
System.out.println(" Example: beast test.xml");
System.out.println(" Example: beast -window test.xml");
System.out.println(" Example: beast -help");
System.out.println();
}
示例11: printUsage
import dr.app.util.Arguments; //导入依赖的package包/类
public static void printUsage(Arguments arguments) {
arguments.printUsage("roottotip", "<input-file-name> [<output-file-name>]");
System.out.println();
System.out.println(" Example: roottotip -burnin 100 test.trees rootToTip.txt");
System.out.println();
}
示例12: main
import dr.app.util.Arguments; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
String inputFileName = null;
String outputFileName = null;
printTitle();
Arguments arguments = new Arguments(
new Arguments.Option[]{
new Arguments.IntegerOption("burnin", "the number of trees to be ignored as 'burn-in' [default = 0]"),
new Arguments.StringOption("dateorder", "date_order", "order of date field in taxon name: first, last, 1, 2 etc. [default = last]"),
// new Arguments.StringOption("outgroup", "{taxon list}", "one or more taxa that will be used to root the tree(s) [default = find root]"),
new Arguments.Option("keeproot", "keep the existing root of the input trees [default = estimate root]"),
new Arguments.Option("writetree", "Write the optimally rooted tree to the output file"),
new Arguments.Option("help", "option to print this message"),
});
try {
arguments.parseArguments(args);
} catch (Arguments.ArgumentException ae) {
System.out.println(ae);
printUsage(arguments);
System.exit(1);
}
if (arguments.hasOption("help")) {
printUsage(arguments);
System.exit(0);
}
int burnin = 0;
if (arguments.hasOption("burnin")) {
burnin = arguments.getIntegerOption("burnin");
}
String dateOrder = "LAST";
if (arguments.hasOption("dateorder")) {
dateOrder = arguments.getStringOption("dateorder").toUpperCase();
}
String outgroup = null;
if (arguments.hasOption("outgroup")) {
outgroup = arguments.getStringOption("dateorder").toUpperCase();
}
boolean keepRoot = arguments.hasOption("keeproot");
boolean writeTree = arguments.hasOption("writetree");
String[] args2 = arguments.getLeftoverArguments();
if (args2.length > 2) {
System.err.println("Unknown option: " + args2[2]);
System.err.println();
printUsage(arguments);
System.exit(1);
}
if (args2.length == 0) {
System.err.println("Missing input file name");
printUsage(arguments);
System.exit(1);
}
inputFileName = args2[0];
if (args2.length == 2) {
outputFileName = args2[1];
}
new RootToTip(burnin,
dateOrder,
keepRoot,
outgroup,
writeTree,
inputFileName,
outputFileName
);
System.exit(0);
}
示例13: printUsage
import dr.app.util.Arguments; //导入依赖的package包/类
public static void printUsage(Arguments arguments) {
arguments.printUsage("beauti", "[<input-file-name> ...]");
System.out.println();
System.out.println(" Example: beauti test.nex");
System.out.println(" Example: beauti -help");
System.out.println();
}
示例14: main
import dr.app.util.Arguments; //导入依赖的package包/类
public static void main(String[] args) throws java.io.IOException {
// There is a major issue with languages that use the comma as a decimal separator.
// To ensure compatibility between programs in the package, enforce the US locale.
Locale.setDefault(Locale.US);
Arguments arguments = new Arguments(
new Arguments.Option[]{
new Arguments.StringOption("BEAST_XML", "FILENAME", "Specify a BEAST XML file"),
new Arguments.StringOption("load_dump", "FILENAME", "Specify a filename to load a dumped state from"),
new Arguments.StringOption("output_file", "FILENAME", "Specify a filename for the output file"),
new Arguments.StringOption("update_choice", "UPDATECHOICE", "Specify a function by which to update the tree"),
new Arguments.Option("help", "Print this information and stop")
});
try {
arguments.parseArguments(args);
} catch (Arguments.ArgumentException ae) {
System.out.println();
System.out.println(ae.getMessage());
System.out.println();
//printUsage(arguments);
System.exit(1);
}
String inputFile = null;
if (arguments.hasOption("BEAST_XML")) {
inputFile = arguments.getStringOption("BEAST_XML");
} else {
throw new RuntimeException("No BEAST XML file specified.");
}
String debugStateFile;
if (arguments.hasOption("load_dump")) {
debugStateFile = arguments.getStringOption("load_dump");
//pass on as argument
System.setProperty(BeastCheckpointer.LOAD_STATE_FILE, debugStateFile);
} else {
throw new RuntimeException("No dump file specified.");
}
String choice = "";
if (arguments.hasOption("update_choice")) {
choice = arguments.getStringOption("update_choice");
} else {
throw new RuntimeException("Update mechanism needs to be specified.");
}
UpdateChoice chosen = null;
for (UpdateChoice ch : UpdateChoice.values()) {
if (choice.equals(ch.getName())) {
chosen = ch;
break;
}
}
if (chosen == null) {
throw new RuntimeException("Incorrect update mechanism specified.");
}
if (arguments.hasOption("output_file")) {
String outputStateFile = arguments.getStringOption("output_file");
//pass on as argument
System.setProperty(BeastCheckpointer.SAVE_STATE_FILE, outputStateFile);
} else {
throw new RuntimeException("No output file specified.");
}
new CheckPointUpdaterApp(inputFile, debugStateFile, chosen);
System.exit(0);
}
示例15: main
import dr.app.util.Arguments; //导入依赖的package包/类
public static void main(String[] args) {
// There is a major issue with languages that use the comma as a decimal separator.
// To ensure compatibility between programs in the package, enforce the US locale.
Locale.setDefault(Locale.US);
Arguments arguments = new Arguments(
new Arguments.Option[]{
new Arguments.StringOption("BEAST_XML", "FILENAME", "Specify a BEAST XML file"),
new Arguments.StringOption("update_choice", "UPDATECHOICE", "Specify a function by which to update the tree"),
new Arguments.Option("help", "Print this information and stop")
});
try {
arguments.parseArguments(args);
} catch (Arguments.ArgumentException ae) {
System.out.println();
System.out.println(ae.getMessage());
System.out.println();
//printUsage(arguments);
System.exit(1);
}
String inputFile = null;
if (arguments.hasOption("BEAST_XML")) {
inputFile = arguments.getStringOption("BEAST_XML");
} else {
throw new RuntimeException("No BEAST XML file specified.");
}
String choice = "";
if (arguments.hasOption("update_choice")) {
choice = arguments.getStringOption("update_choice");
} else {
throw new RuntimeException("Update mechanism needs to be specified.");
}
CheckPointUpdaterApp.UpdateChoice chosen = null;
for (CheckPointUpdaterApp.UpdateChoice ch : CheckPointUpdaterApp.UpdateChoice.values()) {
if (choice.equals(ch.getName())) {
chosen = ch;
break;
}
}
if (chosen == null) {
throw new RuntimeException("Incorrect update mechanism specified.");
}
//Create and set up the window.
JFrame frame = new JFrame("Test distance matrix");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
DistanceMatrixInsertionTest test = new DistanceMatrixInsertionTest(inputFile, chosen);
test.setOpaque(true);
frame.setContentPane(test);
//Display the window.
frame.pack();
frame.setVisible(true);
//System.exit(0);
}