當前位置: 首頁>>代碼示例>>Java>>正文


Java BEASTVersion2類代碼示例

本文整理匯總了Java中beast.app.BEASTVersion2的典型用法代碼示例。如果您正苦於以下問題:Java BEASTVersion2類的具體用法?Java BEASTVersion2怎麽用?Java BEASTVersion2使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BEASTVersion2類屬於beast.app包,在下文中一共展示了BEASTVersion2類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: toJSON

import beast.app.BEASTVersion2; //導入依賴的package包/類
public String toJSON(BEASTInterface beastObject, Collection<BEASTInterface> others) {
    try {
        StringBuffer buf = new StringBuffer();
        //buf.append("{\"version\": \"2.0\",\n\"namespace\": \"" + DEFAULT_NAMESPACE + "\",\n\n" +
        //		"\"" + JSONParser.ANALYSIS_ELEMENT + "\": [\n");
        buf.append("{version: \"" + (new BEASTVersion2()).getMajorVersion() + "\",\nnamespace: \"" + DEFAULT_NAMESPACE + "\",\n\n" +
        		XMLParser.BEAST_ELEMENT + ": [\n");
        //buf.append("\n\n");
        isDone = new HashSet<>();
        isInputsDone = new HashMap<>();
        IDs = new HashSet<>();
        indentCount = 1;
        
        List<BEASTInterface> priorityBeastObjects = new ArrayList<>();
        findPriorityBeastObjects(beastObject, priorityBeastObjects);
        for (BEASTInterface beastObject2 : priorityBeastObjects) {
        	if (!isDone.contains(beastObject2)) {
        		//name = name.substring(name.lastIndexOf('.') + 1).toLowerCase();
        		beastObjectToJSON(beastObject2, BEASTInterface.class, buf, null, true);
        		buf.append(",");
        	}
        }
        buf.append("\n\n");
        
        beastObjectToJSON(beastObject, BEASTInterface.class, buf, null, true);
        String end = "\n]\n}";
        buf.append(end);

        String JSON = buf.toString();
        String[] nameSpaces = DEFAULT_NAMESPACE.split(":");
        for (String nameSpace : nameSpaces) {
            //JSON = JSON.replaceAll("\"spec\": \"" + nameSpace + ".", "\"spec\": \"");
            JSON = JSON.replaceAll("spec: \"" + nameSpace + ".", "spec: \"");
        }
        return JSON;
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}
 
開發者ID:CompEvol,項目名稱:beast2,代碼行數:41,代碼來源:JSONProducer.java

示例2: actionPerformed

import beast.app.BEASTVersion2; //導入依賴的package包/類
@Override
public void actionPerformed(ActionEvent ae) {
          BEASTVersion2 version = new BEASTVersion2();
          JOptionPane.showMessageDialog(null, version.getCredits(),
                  "About Beauti " + version.getVersionString(), JOptionPane.PLAIN_MESSAGE,
                  Utils.getIcon(BEAUTI_ICON));
      }
 
開發者ID:CompEvol,項目名稱:beast2,代碼行數:8,代碼來源:Beauti.java

示例3: main

import beast.app.BEASTVersion2; //導入依賴的package包/類
/**
 * main
 */
public static void main(String[] args) {
    LogAnalyser analyser1 = null;
    LogAnalyser analyser2 = null;
    try {
        if (args.length == 0) {
            BEASTVersion2 version = new BEASTVersion2();
            File file = Utils.getLoadFile("LogComparator " + version.getVersionString() + " - Select first log file to analyse",
                    null, "BEAST log (*.log) Files", "log", "txt");
            if (file == null) {
                return;
            }
            analyser1 = new LogAnalyser(file.getAbsolutePath());

            file = Utils.getLoadFile("LogComparator " + version.getVersionString() + " - Select second log file to analyse",
                    null, "BEAST log (*.log) Files", "log", "txt");
            if (file == null) {
                return;
            }
            analyser2 = new LogAnalyser(file.getAbsolutePath());

        } else {
            analyser1 = new LogAnalyser(args[0]);
            analyser2 = new LogAnalyser(args[1]);
        }

    } catch (Exception e) {
        e.printStackTrace();
    }

    LogComparator logComparator = new LogComparator(analyser1, analyser2);
    logComparator.print(System.out, true);

}
 
開發者ID:CompEvol,項目名稱:beast2,代碼行數:37,代碼來源:LogComparator.java

示例4: toXML

import beast.app.BEASTVersion2; //導入依賴的package包/類
public String toXML(BEASTInterface beastObject, Collection<BEASTInterface> others) {
    try {
        StringBuffer buf = new StringBuffer();
    	Set<String> requiredPacakges = AddOnManager.getPackagesAndVersions(beastObject);
    	String required = requiredPacakges.toString();
    	required = required.substring(1, required.length() - 1);
    	required = required.replaceAll(", ", ":");
        buf.append("<" + XMLParser.BEAST_ELEMENT + 
        		" version='" + new BEASTVersion2().getMajorVersion() + "'" +
        		" required='" + required + "'" +
        		" namespace='" + DEFAULT_NAMESPACE + "'>\n");
        for (String element : element2ClassMap.keySet()) {
        	if (!reservedElements.contains(element)) {
        		buf.append("<map name='" + element + "'>" + element2ClassMap.get(element) +"</map>\n");
        	}
        }
        buf.append("\n\n");
        isDone = new HashSet<>();
        isInputsDone = new HashMap<>();
        IDs = new HashSet<>();
        indent = 0;
        beastObjectToXML(beastObject, buf, null, true);
        String endBeastString = "</" + XMLParser.BEAST_ELEMENT + ">";
        buf.append(endBeastString);
        //return buf.toString();
        // beautify XML hierarchy
        String xml = cleanUpXML(buf.toString(), m_sXMLBeuatifyXSL);
        // TODO: fix m_sIDRefReplacementXSL script to deal with nested taxon sets
        // String xml2 = cleanUpXML(xml, m_sIDRefReplacementXSL);
        String xml2 = xml;
        xml = findPlates(xml2);
        // beatify by applying name spaces to spec attributes
        String[] nameSpaces = DEFAULT_NAMESPACE.split(":");
        for (String nameSpace : nameSpaces) {
            xml = xml.replaceAll("spec=\"" + nameSpace + ".", "spec=\"");
        }


        buf = new StringBuffer();
        if (others.size() > 0) {
            for (BEASTInterface beastObject2 : others) {
                if (!IDs.contains(beastObject2.getID())) {
                    beastObjectToXML(beastObject2, buf, null, false);
                }
            }
        }
        int endIndex = xml.indexOf(endBeastString);
        String extras = buf.toString();
        // prevent double -- inside XML comment, this can happen in sequences
        extras = extras.replaceAll("--","- - ");
        xml = xml.substring(0, endIndex) //+ "\n\n<!-- " + DO_NOT_EDIT_WARNING + " \n\n" + 
        	//extras +  "\n\n-->\n\n" 
        		+ endBeastString;

        xml = xml.replaceAll("xmlns=\"http://www.w3.org/TR/xhtml1/strict\"", "");
        
        xml = dedupName(xml);
        xml = sortTags(xml);
        

        //insert newlines in alignments
        int k = xml.indexOf("<data ");
        StringBuffer buf2 = new StringBuffer(xml); 
        while (k > 0) {
        	while (xml.charAt(k) != '>') {
        		if (xml.charAt(k) == ' ' && !xml.startsWith("idref", k+1)) {
        			buf2.setCharAt(k, '\n');
        		}
        		k++;
        	}
        	k = xml.indexOf("<data ", k + 1);
        }
        

        return buf2.toString();
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}
 
開發者ID:CompEvol,項目名稱:beast2,代碼行數:81,代碼來源:XMLProducer.java

示例5: run

import beast.app.BEASTVersion2; //導入依賴的package包/類
public void run() throws Exception {


       try {
           System.out.println("Reading file " + file.getName());
		NexusParser nexusParser = new NexusParser();
		nexusParser.parseFile(file);
           SATreeTraceAnalysis analysis = new SATreeTraceAnalysis(nexusParser.trees, 0.1);
           analysis.computeCredibleSet();

		String result = analysis.toReportString(printCladeFrequencies, printPairs, printFrequencies, printTopologyCredibleSet, !toStandardOutput);

		if (toStandardOutput) {
			System.out.println(result);
		} else {

			// create HTML file with results
			String html = "<html>\n" +
					"<title>BEAST " + new BEASTVersion2().getVersionString() + ": Sampled Ancestor Tree Analyser</title>\n" +
					"<head>  \n" +
					"<link rel='stylesheet' type='text/css' href='css/style.css'>\n" +
					"</head>\n" +
					"<body>\n" +
					"<h2>Sampled Ancestor Tree Trace Analysis from " + file.getPath() +"</h2>\n" +
					result +
					"</body>\n" +
					"</html>";


			// write html file in package dir + "/js/minitracer.html"
			String jsPath = Application.getPackagePath("SA.addon.jar") + "js";
			FileWriter outfile = new FileWriter(jsPath + "/SATreeAnalysis.html");
			outfile.write(html);
			outfile.close();

			// open html file in browser
			Application.openUrl("file://" + jsPath + "/SATreeAnalysis.html");
			//            analysis.report(System.out);
		}
       }
       catch (IOException e) {
       	Log.err.println(e.getMessage());
           //
       }
   }
 
開發者ID:CompEvol,項目名稱:sampled-ancestors,代碼行數:46,代碼來源:SampledAncestorTreeAnalyser.java


注:本文中的beast.app.BEASTVersion2類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。