Esempio n. 1
0
 public static string MSGFParamsToOverload(MSGFParams config)
 {
     return("-inst " + config.Instrument
            + " -o \"[FileNameOnly]" + config.OutputSuffix + ".mzid\""
            + " -tda 1"
            + " -m 0"// + config.FragmentationMethod
            + " -protocol " + config.Protocol
            + " -e " + config.CleavageAgent
            + " -t " + config.PrecursorTolerance.ToString(CultureInfo.InvariantCulture) + config.PrecursorToleranceUnits
            + " -ti " + config.IsotopeErrorMin + "," + config.IsotopeErrorMax
            + " -ntt " + config.Specificity
            + " -s \"[FullFileName]\"");
 }
Esempio n. 2
0
        public static MSGFParams OverloadToMSGFParams(string overloadString)
        {
            var config        = new MSGFParams();
            var splitOverload = overloadString.Split();

            for (var x = 0; x < splitOverload.Length; x++)
            {
                var nextNumber      = -999;
                var validNumberNext = false;
                if (x + 1 < splitOverload.Length)
                {
                    validNumberNext = int.TryParse(splitOverload[x + 1], out nextNumber);
                }
                switch (splitOverload[x])
                {
                case "-inst":
                    if (validNumberNext)
                    {
                        config.Instrument = nextNumber;
                    }
                    break;

                case "-o":
                    var trimmedString = splitOverload[x + 1].Replace("\"[FileNameOnly]", string.Empty)
                                        .Replace(".mzid\"", string.Empty);
                    config.OutputSuffix = trimmedString;
                    break;
                    //case "-m":
                    //    if (validNumberNext)
                    //        config.FragmentationMethod = nextNumber;
                    break;

                case "-e":
                    if (validNumberNext)
                    {
                        config.CleavageAgent = nextNumber;
                    }
                    break;

                case "-p":
                    if (validNumberNext)
                    {
                        config.Protocol = nextNumber;
                    }
                    break;

                case "-t":
                    if (x + 1 < splitOverload.Length)
                    {
                        double tolerance;
                        var    rx = new Regex(@"([\.\d]+)([A-Za-z]+)");
                        if (!rx.IsMatch(splitOverload[x + 1]))
                        {
                            break;
                        }
                        var groups = rx.Match(splitOverload[x + 1]).Groups;
                        if (groups.Count != 3 || !double.TryParse(groups[1].Value, out tolerance))
                        {
                            break;
                        }
                        config.PrecursorTolerance      = tolerance;
                        config.PrecursorToleranceUnits = groups[2].Value;
                    }
                    break;

                case "-ti":
                    if (x + 1 < splitOverload.Length)
                    {
                        int min;
                        int max;
                        var splitNext = splitOverload[x + 1].Split(',');
                        if (splitNext.Length != 2)
                        {
                            break;
                        }
                        if (!int.TryParse(splitNext[0], out min) || !int.TryParse(splitNext[1], out max))
                        {
                            break;
                        }
                        config.IsotopeErrorMin = min;
                        config.IsotopeErrorMax = max;
                    }
                    break;

                case "-ntt":
                    if (validNumberNext)
                    {
                        config.Specificity = nextNumber;
                    }
                    break;
                }
            }
            return(config);
        }
Esempio n. 3
0
 public static MSGFParams OverloadToMSGFParams(string overloadString)
 {
     var config = new MSGFParams();
     var splitOverload = overloadString.Split();
     for (var x = 0; x < splitOverload.Length; x++)
     {
         var nextNumber=-999;
         var validNumberNext = false;
         if (x + 1 < splitOverload.Length)
             validNumberNext = int.TryParse(splitOverload[x + 1], out nextNumber);
         switch (splitOverload[x])
         {
             case "-inst":
                 if (validNumberNext)
                     config.Instrument = nextNumber;
                 break;
             case "-o":
                 var trimmedString = splitOverload[x + 1].Replace("\"[FileNameOnly]", string.Empty)
                                                         .Replace(".mzid\"", string.Empty);
                 config.OutputSuffix = trimmedString;
                 break;
             //case "-m":
             //    if (validNumberNext)
             //        config.FragmentationMethod = nextNumber;
                 break;
             case "-e":
                 if (validNumberNext)
                     config.CleavageAgent = nextNumber;
                 break;
             case "-p":
                 if (validNumberNext)
                     config.Protocol = nextNumber;
                 break;
             case "-t":
                 if (x + 1 < splitOverload.Length)
                 {
                     double tolerance;
                     var rx = new Regex(@"([\.\d]+)([A-Za-z]+)");
                     if (!rx.IsMatch(splitOverload[x + 1]))
                         break;
                     var groups = rx.Match(splitOverload[x + 1]).Groups;
                     if (groups.Count != 3 || !double.TryParse(groups[1].Value, out tolerance))
                         break;
                     config.PrecursorTolerance = tolerance;
                     config.PrecursorToleranceUnits = groups[2].Value;
                 }
                 break;
             case "-ti":
                 if (x + 1 < splitOverload.Length)
                 {
                     int min;
                     int max;
                     var splitNext = splitOverload[x + 1].Split(',');
                     if (splitNext.Length != 2)
                         break;
                     if (!int.TryParse(splitNext[0], out min) || !int.TryParse(splitNext[1], out max))
                         break;
                     config.IsotopeErrorMin = min;
                     config.IsotopeErrorMax = max;
                 }
                 break;
             case "-ntt":
                 if (validNumberNext)
                     config.Specificity = nextNumber;
                 break;
         }
     }
     return config;
 }
Esempio n. 4
0
 public static string MSGFParamsToOverload(MSGFParams config)
 {
     return "-inst " + config.Instrument
            + " -o \"[FileNameOnly]" + config.OutputSuffix + ".mzid\""
            + " -tda 1"
            + " -m 0"// + config.FragmentationMethod
            + " -protocol " + config.Protocol
            + " -e " + config.CleavageAgent
            + " -t " + config.PrecursorTolerance.ToString(CultureInfo.InvariantCulture) + config.PrecursorToleranceUnits
            + " -ti " + config.IsotopeErrorMin + "," + config.IsotopeErrorMax
            + " -ntt " + config.Specificity
            + " -s \"[FullFileName]\"";
 }