/// <summary> /// Write the results with the FDR data to the specified file /// </summary> /// <param name="outputFilePath"></param> /// <param name="includeDecoy"></param> public void WriteTo(string outputFilePath, bool includeDecoy = false) { //var resultsToUse = searchResults; var resultsToUse = filteredResults; IEnumerable <DatabaseSearchResultData> resultsToWrite; if (includeDecoy) { resultsToWrite = resultsToUse; } else { resultsToWrite = resultsToUse.Where(x => !x.ProteinName.StartsWith(FastaDatabaseConstants.DecoyProteinPrefix)); } DatabaseSearchResultData.WriteResultsToFile(outputFilePath, resultsToWrite, true); }
/// <summary> /// Read the file at path <paramref name="filePath"/>. /// </summary> /// <param name="filePath"></param> /// <returns></returns> public static SimpleMZIdentMLReader.SimpleMZIdentMLData ReadResultFile(string filePath) { SimpleMZIdentMLReader.SimpleMZIdentMLData results = null; var lowerFilePath = filePath.ToLower(); if (lowerFilePath.EndsWith(".mzid") || lowerFilePath.EndsWith(".mzid.gz")) { var mzidReader = new SimpleMZIdentMLReader(); results = mzidReader.Read(filePath); } else if (lowerFilePath.EndsWith("_ictda.tsv")) { results = DatabaseSearchResultData.ReadResultsFromFileToMzIdData(filePath); } return(results); }
private bool ReadTargetAndDecoy(string targetResultFilePath, string decoyResultFilePath) { var errorBase = "Cannot compute FDR Scores; "; if (!File.Exists(targetResultFilePath)) { ErrorMessage = errorBase + "target results file not found, " + Path.GetFileName(targetResultFilePath); return(false); } if (!File.Exists(decoyResultFilePath)) { ErrorMessage = errorBase + "decoy results file not found, " + Path.GetFileName(decoyResultFilePath); return(false); } var targetData = DatabaseSearchResultData.ReadResultsFromFile(targetResultFilePath); var decoyData = DatabaseSearchResultData.ReadResultsFromFile(decoyResultFilePath); return(AddTargetAndDecoyData(targetData, decoyData)); }