public MzidResultsWriter(FastaDatabase db, LcMsRun run, MsPfParameters options) { this.database = db; this.lcmsRun = run; this.options = options; }
/// <summary> /// Opens parameter file from .PARAM file.. /// </summary> /// <param name="filePath">The path of the parameter file.</param> /// <returns> /// Parsed MSPathFinder parameters. Returns null if file does not exist. /// Throws exception if file is not formatted correctly. /// </returns> public static MsPfParameters Parse(string filePath) { if (!File.Exists(filePath)) { return(null); } var file = File.ReadAllLines(filePath); var param = new MsPfParameters(); foreach (var line in file) { var parts = line.Split('\t'); if (parts.Length < 2) { continue; } switch (parts[0]) { case "SpecFile": param.SpecFilePath = parts[1]; break; case "DatabaseFile": param.DatabaseFilePath = parts[1]; break; case "FeatureFile": param.FeatureFilePath = parts[1]; break; case "SearchMode": #pragma warning disable 618 param.SearchModeInt = Convert.ToInt32(parts[1]); #pragma warning restore 618 break; case "InternalCleavageMode": param.InternalCleavageMode = (InternalCleavageType)Enum.Parse(typeof(InternalCleavageType), parts[1]); break; case "Tda": int tda = 0; tda += Convert.ToInt32(parts[1].Contains("Target")); tda += Convert.ToInt32(parts[1].Contains("Decoy")) * 2; param.TargetDecoySearchMode = (DatabaseSearchMode)tda; break; case "PrecursorIonTolerancePpm": param.PrecursorIonTolerance = new Tolerance(Convert.ToDouble(parts[1]), ToleranceUnit.Ppm); break; case "ProductIonTolerancePpm": param.ProductIonTolerance = new Tolerance(Convert.ToDouble(parts[1]), ToleranceUnit.Ppm); break; case "MinSequenceLength": param.MinSequenceLength = Convert.ToInt32(parts[1]); break; case "MaxSequenceLength": param.MaxSequenceLength = Convert.ToInt32(parts[1]); break; case "MinPrecursorIonCharge": param.MinPrecursorIonCharge = Convert.ToInt32(parts[1]); break; case "MaxPrecursorIonCharge": param.MaxPrecursorIonCharge = Convert.ToInt32(parts[1]); break; case "MinProductIonCharge": param.MinProductIonCharge = Convert.ToInt32(parts[1]); break; case "MaxProductIonCharge": param.MaxProductIonCharge = Convert.ToInt32(parts[1]); break; case "MinSequenceMass": param.MinSequenceMass = Convert.ToDouble(parts[1]); break; case "MaxSequenceMass": param.MaxSequenceMass = Convert.ToDouble(parts[1]); break; case "MinFeatureProbability": param.MinFeatureProbablility = Convert.ToDouble(parts[1]); break; case "MaxDynamicModificationsPerSequence": param.MaxDynamicModificationsPerSequence = Convert.ToInt32(parts[1]); break; case "Modification": param.Modifications.AddRange(ModFileParser.ParseModification(parts[1])); break; case "ActivationMethod": param.ActivationMethod = (ActivationMethod)Convert.ToInt32(parts[1]); break; } } if (param.PrecursorIonTolerance == null && param.ProductIonTolerance != null) { param.PrecursorIonTolerance = param.ProductIonTolerance; } if (param.PrecursorIonTolerance != null && param.ProductIonTolerance == null) { param.ProductIonTolerance = param.PrecursorIonTolerance; } return(param); }