List of usage examples for org.apache.commons.io FilenameUtils getFullPath
public static String getFullPath(String filename)
From source file:MSUmpire.LCMSPeakStructure.LCMSPeakDIAMS2.java
private void FSCluster2CurveWrite() { try {/*from w ww. j a v a 2s . co m*/ Logger.getRootLogger().debug("Writing PrecursorFragmentCorr serialization to file:" + FilenameUtils.getBaseName(ScanCollectionName) + "_Clus2Cur.serFS..."); FileOutputStream fout = new FileOutputStream( FilenameUtils.getFullPath(ParentmzXMLName) + FilenameUtils.getBaseName(ParentmzXMLName) + "_Peak/" + FilenameUtils.getBaseName(ScanCollectionName) + "_Clus2Cur.serFS", false); FSTObjectOutput oos = new FSTObjectOutput(fout); oos.writeObject(FragmentsClu2Cur); oos.close(); fout.close(); } catch (Exception ex) { Logger.getRootLogger().error(ExceptionUtils.getStackTrace(ex)); } }
From source file:MSUmpire.LCMSPeakStructure.LCMSPeakDIAMS2.java
private boolean FSCluster2CurveRead() { if (!new File(FilenameUtils.getFullPath(ParentmzXMLName) + FilenameUtils.getBaseName(ParentmzXMLName) + "_Peak/" + FilenameUtils.getBaseName(ScanCollectionName) + "_Clus2Cur.serFS").exists()) { return false; }//from ww w . j a v a 2 s.c o m try { Logger.getRootLogger().debug("Reading PrecursorFragmentCorr serialization from file:" + FilenameUtils.getBaseName(ScanCollectionName) + "_Clus2Cur.serFS..."); FileInputStream fileIn = new FileInputStream( FilenameUtils.getFullPath(ParentmzXMLName) + FilenameUtils.getBaseName(ParentmzXMLName) + "_Peak/" + FilenameUtils.getBaseName(ScanCollectionName) + "_Clus2Cur.serFS"); FSTObjectInput in = new FSTObjectInput(fileIn); FragmentsClu2Cur = (HashMap<Integer, ArrayList<PrecursorFragmentPairEdge>>) in.readObject(); in.close(); fileIn.close(); } catch (Exception ex) { Logger.getRootLogger().error(ExceptionUtils.getStackTrace(ex)); return false; } return true; }
From source file:MSUmpire.LCMSPeakStructure.LCMSPeakDIAMS2.java
private boolean JavaSerializationCluster2CurveRead() { if (!new File(FilenameUtils.getFullPath(ParentmzXMLName) + FilenameUtils.getBaseName(ParentmzXMLName) + "_Peak/" + FilenameUtils.getBaseName(ScanCollectionName) + "_Clus2Cur.ser").exists()) { return false; }// w w w. j ava2 s. c om try { Logger.getRootLogger().debug("Reading PrecursorFragmentCorr serialization from file:" + FilenameUtils.getBaseName(ScanCollectionName) + "_Clus2Cur.ser..."); FileInputStream fileIn = new FileInputStream( FilenameUtils.getFullPath(ParentmzXMLName) + FilenameUtils.getBaseName(ParentmzXMLName) + "_Peak/" + FilenameUtils.getBaseName(ScanCollectionName) + "_Clus2Cur.ser"); ObjectInputStream in = new ObjectInputStream(fileIn); FragmentsClu2Cur = (HashMap<Integer, ArrayList<PrecursorFragmentPairEdge>>) in.readObject(); in.close(); fileIn.close(); } catch (Exception ex) { Logger.getRootLogger().error(ExceptionUtils.getStackTrace(ex)); return false; } return true; }
From source file:ddf.metrics.reporting.internal.rest.MetricsEndpoint.java
/** * Returns a list of all of the metrics' names based on the list of RRD files found in the * metrics directory.// w ww . ja va2s . com * * @return */ private List<String> getMetricsNames() { String[] rrdFiles = getRrdFiles(); List<String> metricNames = new ArrayList<String>(); if (rrdFiles != null) { for (String rrdFile : rrdFiles) { String metricsName = FilenameUtils.getFullPath(rrdFile) + FilenameUtils.getBaseName(rrdFile); metricNames.add(metricsName); } } Collections.sort(metricNames); LOGGER.trace("Returning " + metricNames.size() + " metrics"); return metricNames; }
From source file:MSUmpire.DIA.DIAPack.java
public void SetPepXMLPath() { iProphPepXMLs = new ArrayList<String>(); String PepXMLPath1 = FilenameUtils .separatorsToUnix(FilenameUtils.getFullPath(Filename) + "interact-" + GetQ1Name() + ".pep.xml"); String PepXMLPath2 = FilenameUtils .separatorsToUnix(FilenameUtils.getFullPath(Filename) + "interact-" + GetQ2Name() + ".pep.xml"); String PepXMLPath3 = FilenameUtils .separatorsToUnix(FilenameUtils.getFullPath(Filename) + "interact-" + GetQ3Name() + ".pep.xml"); iProphPepXMLs.add(PepXMLPath1);//from w w w .j av a2 s. co m iProphPepXMLs.add(PepXMLPath2); iProphPepXMLs.add(PepXMLPath3); }
From source file:MSUmpire.LCMSPeakStructure.LCMSPeakDIAMS2.java
private void FSCluster2CurveUnfragWrite() { try {/*from w w w . ja v a 2s. co m*/ Logger.getRootLogger().debug("Writing UnfragPrecursorFragCorr serialization to file:" + FilenameUtils.getBaseName(ScanCollectionName) + "_UnfClus2Cur.serFS..."); FileOutputStream fout = new FileOutputStream( FilenameUtils.getFullPath(ParentmzXMLName) + FilenameUtils.getBaseName(ParentmzXMLName) + "_Peak/" + FilenameUtils.getBaseName(ScanCollectionName) + "_UnfClus2Cur.serFS", false); FSTObjectOutput oos = new FSTObjectOutput(fout); oos.writeObject(UnFragIonClu2Cur); oos.close(); fout.close(); } catch (Exception ex) { Logger.getRootLogger().error(ExceptionUtils.getStackTrace(ex)); } }
From source file:MSUmpire.DIA.DIAPack.java
public void ParsePepXML(DBSearchParam searchPara, LCMSID refID) throws ParserConfigurationException, SAXException, IOException, XmlPullParserException, ClassNotFoundException, InterruptedException { SetPepXMLPath();/*w w w . ja v a2s . c om*/ IDsummary = new LCMSID(FilenameUtils.getFullPath(Filename) + FilenameUtils.getBaseName(Filename), searchPara.DecoyPrefix, searchPara.FastaPath); for (String pepxml : iProphPepXMLs) { LCMSID pepxmlid = new LCMSID(FilenameUtils.getFullPath(Filename) + FilenameUtils.getBaseName(Filename), searchPara.DecoyPrefix, searchPara.FastaPath); PepXMLParser pepxmlparser = new PepXMLParser(pepxmlid, pepxml, 0f); if (refID == null) { pepxmlid.FilterByPepDecoyFDR(searchPara.DecoyPrefix, searchPara.PepFDR); } Logger.getRootLogger().info("No. of peptide ions:" + pepxmlid.GetPepIonList().size() + "; Peptide level threshold: " + pepxmlid.PepProbThreshold); for (PepIonID pepID : pepxmlid.GetPepIonList().values()) { if (refID != null) { if (refID.GetPepIonList().containsKey(pepID.GetKey())) { IDsummary.AddPeptideID(pepID); } } else { IDsummary.AddPeptideID(pepID); } } } IDsummary.ReMapProPep(); Logger.getRootLogger().info("Total number of peptide ions:" + IDsummary.GetPepIonList().size()); CheckPSMRT(); if (MS1FeatureMap != null) { this.MS1FeatureMap.IDsummary = IDsummary; } }
From source file:MSUmpire.DIA.TargetMatchScoring.java
public static TargetMatchScoring LibraryMatchRead(String Filename, String LibID) throws FileNotFoundException { if (!new File(FilenameUtils.getFullPath(Filename) + FilenameUtils.getBaseName(Filename) + "_" + LibID + "_LibMatch.serFS").exists()) { return null; }//from w ww. ja va2 s . c om TargetMatchScoring match = null; try { Logger.getRootLogger() .info("Loading Target library match results to file:" + FilenameUtils.getFullPath(Filename) + FilenameUtils.getBaseName(Filename) + "_" + LibID + "_LibMatch.serFS..."); FileInputStream fileIn = new FileInputStream(FilenameUtils.getFullPath(Filename) + FilenameUtils.getBaseName(Filename) + "_" + LibID + "_LibMatch.serFS"); FSTObjectInput in = new FSTObjectInput(fileIn); match = (TargetMatchScoring) in.readObject(); in.close(); fileIn.close(); } catch (Exception ex) { Logger.getRootLogger().error(ExceptionUtils.getStackTrace(ex)); return null; } return match; }
From source file:MSUmpire.LCMSPeakStructure.LCMSPeakDIAMS2.java
private boolean FSCluster2CurveUnfragRead() { if (!new File(FilenameUtils.getFullPath(ParentmzXMLName) + FilenameUtils.getBaseName(ParentmzXMLName) + "_Peak/" + FilenameUtils.getBaseName(ScanCollectionName) + "_UnfClus2Cur.serFS").exists()) { return false; }/*from w w w . java 2 s. c o m*/ try { Logger.getRootLogger().debug("Reading UnfragPrecursorFragCorr serialization from file:" + FilenameUtils.getBaseName(ScanCollectionName) + "_UnfClus2Cur.serFS..."); FileInputStream fileIn = new FileInputStream( FilenameUtils.getFullPath(ParentmzXMLName) + FilenameUtils.getBaseName(ParentmzXMLName) + "_Peak/" + FilenameUtils.getBaseName(ScanCollectionName) + "_UnfClus2Cur.serFS"); FSTObjectInput in = new FSTObjectInput(fileIn); UnFragIonClu2Cur = (HashMap<Integer, ArrayList<PrecursorFragmentPairEdge>>) in.readObject(); in.close(); fileIn.close(); } catch (Exception ex) { Logger.getRootLogger().error(ExceptionUtils.getStackTrace(ex)); return false; } return true; }
From source file:edu.cornell.med.icb.learning.CrossValidation.java
/** * Report the area under the Receiver Operating Characteristic (ROC) curve. Estimates are * done with a leave one out evaluation. * * @param decisionValues Decision values output by classifier. Larger values indicate more * confidence in prediction of a positive label. * @param labels Correct label for item, can be 0 (negative class) or +1 (positive class). * @param rocCurvefilename Name of the file to plot the pdf image to */// www.j av a 2 s . c o m public static void plotRocCurveLOO(final double[] decisionValues, final double[] labels, final String rocCurvefilename) { assert decisionValues.length == labels.length : "number of predictions must match number of labels."; for (int i = 0; i < labels.length; i++) { // for each training example, leave it out: if (decisionValues[i] < 0) { decisionValues[i] = 0; } if (labels[i] < 0) { labels[i] = 0; } } // R server only understands unix style path. Convert windows to unix if needed: final String plotFilename = FilenameUtils.separatorsToUnix(rocCurvefilename); final File plotFile = new File(plotFilename); final RConnectionPool connectionPool = RConnectionPool.getInstance(); RConnection connection = null; // CALL R ROC try { if (plotFile.exists()) { plotFile.delete(); } connection = connectionPool.borrowConnection(); connection.assign("predictions", decisionValues); connection.assign("labels", labels); final String cmd = " library(ROCR) \n" + "pred.svm <- prediction(predictions, labels)\n" + "pdf(\"" + plotFilename + "\", height=5, width=5)\n" + "perf <- performance(pred.svm, measure = \"tpr\", x.measure = \"fpr\")\n" + "plot(perf)\n" + "dev.off()"; final REXP expression = connection.eval(cmd); // attr(perf.rocOutAUC,"y.values")[[1]] final double valueROC_AUC = expression.asDouble(); // System.out.println("result from R: " + valueROC_AUC); } catch (Exception e) { // connection error or otherwise LOG.warn("Cannot plot ROC curve to " + plotFilename + ". Make sure Rserve (R server) " + "is configured and running and the owner of the Rserve process has permission " + "to write to the directory \"" + FilenameUtils.getFullPath(plotFile.getAbsolutePath()) + "\"", e); } finally { if (connection != null) { connectionPool.returnConnection(connection); } } }