Skip to content

Commit

Permalink
Peptide digestion settings on commandline (#2793)
Browse files Browse the repository at this point in the history
- added command line support for the settings on the peptide digestion tab
* renamed document settings group to transition settings, and put peptide settings in a new peptide settings group
  • Loading branch information
chambm authored Dec 1, 2023
1 parent f9f1a74 commit 6a818db
Show file tree
Hide file tree
Showing 9 changed files with 341 additions and 22 deletions.
69 changes: 62 additions & 7 deletions pwiz_tools/Skyline/CommandArgUsage.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 23 additions & 2 deletions pwiz_tools/Skyline/CommandArgUsage.resx
Original file line number Diff line number Diff line change
Expand Up @@ -529,8 +529,11 @@ http://localhost:8080</value>
<data name="_tool_zip_overwrite_annotations" xml:space="preserve">
<value>Specify whether conflicting custom annotations from the provided ZIP file should overwrite (true) existing annotations or be skipped (false).</value>
</data>
<data name="CommandArgs_GROUP_SETTINGS_Document_Settings" xml:space="preserve">
<value>Document Settings</value>
<data name="CommandArgs_GROUP_SETTINGS_Transition_Settings" xml:space="preserve">
<value>Transition Settings</value>
</data>
<data name="CommandArgs_GROUP_SETTINGS_Peptide_Settings" xml:space="preserve">
<value>Peptide Settings</value>
</data>
<data name="CommandArgs_PATH_TO_FILE_path_to_file" xml:space="preserve">
<value>path/to/file</value>
Expand Down Expand Up @@ -970,4 +973,22 @@ greater peak area.</value>
<data name="_pep_min_length" xml:space="preserve">
<value>The minimum length of a peptide to add to the document.</value>
</data>
<data name="_background_proteome_file" xml:space="preserve">
<value>The path to the background proteome (protdb) file to apply to the opened document. The name may be optionally specified by --background-proteome-name, and if not it defaults to the filename.</value>
</data>
<data name="_background_proteome_name" xml:space="preserve">
<value>The name of a background proteome to apply to the opened document. The background proteome specifies the full set of proteins that may be present in the sample matrix to be injected into the mass spectrometer. If the name is not already defined in Skyline, the path to the protdb file must also be set by --background-proteome-file.</value>
</data>
<data name="_pep_digest_enzyme" xml:space="preserve">
<value>The protease enzyme definition used to parse peptide sequences from protein sequences added as targets to the document. Peptide lists added as targets ignore this setting other than counting missed cleavages.</value>
</data>
<data name="_pep_max_missed_cleavages" xml:space="preserve">
<value>The maximum number of missed cleavages allowed in a peptide when considering protein digestion.</value>
</data>
<data name="_pep_unique_by" xml:space="preserve">
<value>"Protein" excludes any peptide that appears in more than one protein in the background proteome.
"Gene" excludes any peptide that appears in proteins for more than one gene in the background proteome.
"Species" excludes any peptide that appears in proteins for more than one species in the background proteome.
Useful in sample mixtures including multiple species.</value>
</data>
</root>
61 changes: 55 additions & 6 deletions pwiz_tools/Skyline/CommandArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
using pwiz.Common.DataBinding.Documentation;
using pwiz.Common.SystemUtil;
using pwiz.PanoramaClient;
using pwiz.ProteomeDatabase.API;
using pwiz.ProteowizardWrapper;
using pwiz.Skyline.Model;
using pwiz.Skyline.Model.DocSettings;
Expand Down Expand Up @@ -64,6 +65,7 @@ private static string GetPathToFile(string ext)
public static readonly Func<string> PATH_TO_CSV = () => GetPathToFile(TextUtil.EXT_CSV);
public static readonly Func<string> PATH_TO_TSV = () => GetPathToFile(TextUtil.EXT_TSV);
public static readonly Func<string> PATH_TO_IRTDB = () => GetPathToFile(IrtDb.EXT);
public static readonly Func<string> PATH_TO_PROTDB = () => GetPathToFile(ProteomeDb.EXT_PROTDB);
public static readonly Func<string> PATH_TO_BLIB = () => GetPathToFile(BiblioSpecLiteSpec.EXT);
public static readonly Func<string> PATH_TO_IMSDB = () => GetPathToFile(IonMobilityDb.EXT);
public static readonly Func<string> PATH_TO_REPORT = () => GetPathToFile(ReportSpecList.EXT_REPORTS);
Expand Down Expand Up @@ -104,7 +106,7 @@ private static string GetPathToFile(string ext)
public static readonly HashSet<Func<string>> PATH_TYPE_VALUES = new HashSet<Func<string>>
{
PATH_TO_DOCUMENT, PATH_TO_FILE, PATH_TO_FOLDER, PATH_TO_ZIP, PATH_TO_REPORT, PATH_TO_TSV, PATH_TO_IMSDB,
PATH_TO_INSTALL, PATH_TO_CSV, PATH_TO_IRTDB, PATH_TO_BLIB
PATH_TO_INSTALL, PATH_TO_CSV, PATH_TO_IRTDB, PATH_TO_BLIB, PATH_TO_PROTDB
};

public static readonly HashSet<Func<string>> STRING_TYPE_VALUES = new HashSet<Func<string>>(new[]
Expand Down Expand Up @@ -1425,6 +1427,20 @@ public bool ImportingSearch
(c, p) => c.PeptideFilterExcludePotentialRaggedEnds = p.IsNameOnly || bool.Parse(p.Value))
{ OptionalValue = true };

public static readonly Argument ARG_PEPTIDE_ENZYME_NAME = new DocArgument(@"pep-digest-enzyme", () => Settings.Default.EnzymeList.Select(e => e.Name).ToArray(),
(c, p) => c.PeptideDigestEnzymeName = p.Value)
{ WrapValue = true };
public static readonly Argument ARG_PEPTIDE_MAX_MISSED_CLEAVAGES = new DocArgument(@"pep-max-missed-cleavages", INT_VALUE,
(c, p) => c.PeptideDigestMaxMissedCleavages = p.GetValueInt(DigestSettings.MIN_MISSED_CLEAVAGES, DigestSettings.MAX_MISSED_CLEAVAGES));
public static readonly Argument ARG_PEPTIDE_UNIQUE_BY = DocArgument.FromEnumType<PeptideFilter.PeptideUniquenessConstraint>(@"pep-unique-by",
(c, p) => c.PeptideDigestUniquenessConstraint = p);
public static readonly Argument ARG_BGPROTEOME_NAME = new DocArgument(@"background-proteome-name",
() => Argument.ValuesToExample(Settings.Default.BackgroundProteomeList.Select(p => p.Name)
.Append(Resources.CommandArgs_ARG_BGPROTEOME_NAME_name_to_give_protdb_imported_by___background_proteome_file)),
(c, p) => c.BackgroundProteomeName = p.Value)
{ WrapValue = true };
public static readonly Argument ARG_BGPROTEOME_PATH = new DocArgument(@"background-proteome-file", PATH_TO_PROTDB, (c, p) => c.BackgroundProteomePath = p.Value);

public static readonly Argument ARG_IMS_LIBRARY_RES = new DocArgument(@"ims-library-res", RP_VALUE,
(c, p) => c.IonMobilityLibraryRes = p.ValueDouble);

Expand All @@ -1445,7 +1461,7 @@ public bool ImportingSearch
(c, p) => c.InstrumentIsTriggeredChromatogramAcquisition = p.IsNameOnly || bool.Parse(p.Value))
{ OptionalValue = true };

private static readonly ArgumentGroup GROUP_SETTINGS = new ArgumentGroup(() => CommandArgUsage.CommandArgs_GROUP_SETTINGS_Document_Settings, false,
private static readonly ArgumentGroup GROUP_TRANSITION_SETTINGS = new ArgumentGroup(() => CommandArgUsage.CommandArgs_GROUP_SETTINGS_Transition_Settings, false,
ARG_TRAN_PRECURSOR_ION_CHARGES, ARG_TRAN_FRAGMENT_ION_CHARGES, ARG_TRAN_FRAGMENT_ION_TYPES,
ARG_TRAN_PRODUCT_START_ION, ARG_TRAN_PRODUCT_END_ION, ARG_TRAN_PRODUCT_SPECIAL_IONS_CLEAR, ARG_TRAN_PRODUCT_SPECIAL_IONS_ADD,
ARG_TRAN_PREDICT_CE, ARG_TRAN_PREDICT_DP, ARG_TRAN_PREDICT_COV, ARG_TRAN_PREDICT_OPTDB,
Expand All @@ -1457,7 +1473,6 @@ public bool ImportingSearch
ARG_FULL_SCAN_ACQUISITION_METHOD, ARG_FULL_SCAN_PRODUCT_ISOLATION_SCHEME,
ARG_FULL_SCAN_PRODUCT_ANALYZER, ARG_FULL_SCAN_PRODUCT_RES, ARG_FULL_SCAN_PRODUCT_RES_MZ,
ARG_FULL_SCAN_RT_FILTER, ARG_FULL_SCAN_RT_FILTER_TOLERANCE, ARG_IMS_LIBRARY_RES,
ARG_PEPTIDE_MIN_LENGTH, ARG_PEPTIDE_MAX_LENGTH, ARG_PEPTIDE_EXCLUDE_NTERMINAL_AAS, ARG_PEPTIDE_EXCLUDE_POTENTIAL_RAGGED_ENDS,
ARG_INST_MIN_MZ, ARG_INST_MAX_MZ, ARG_INST_DYNAMIC_MIN_MZ,
ARG_INST_METHOD_TOLERANCE, ARG_INST_MIN_TIME, ARG_INST_MAX_TIME,
ARG_INST_TRIGGERED_CHROMATOGRAMS)
Expand Down Expand Up @@ -1485,6 +1500,27 @@ public bool ImportingSearch
}
};

private static readonly ArgumentGroup GROUP_PEPTIDE_SETTINGS = new ArgumentGroup(() => CommandArgUsage.CommandArgs_GROUP_SETTINGS_Peptide_Settings, false,
ARG_PEPTIDE_ENZYME_NAME, ARG_PEPTIDE_MAX_MISSED_CLEAVAGES, ARG_PEPTIDE_UNIQUE_BY, ARG_BGPROTEOME_NAME, ARG_BGPROTEOME_PATH,
ARG_PEPTIDE_MIN_LENGTH, ARG_PEPTIDE_MAX_LENGTH, ARG_PEPTIDE_EXCLUDE_NTERMINAL_AAS, ARG_PEPTIDE_EXCLUDE_POTENTIAL_RAGGED_ENDS)
{
LeftColumnWidth = 40,
Validate = c =>
{
// if BackgroundProteomePath is not set, BackgroundProteomeName must be one of the existing BackgroundProteomeList
if (c.BackgroundProteomePath == null &&
c.BackgroundProteomeName != null &&
!Settings.Default.BackgroundProteomeList.Contains(p => p.Name == c.BackgroundProteomeName))
{
c.WriteLine(Resources.CommandArgs_ParseArgsInternal_Error____0___is_not_a_valid_value_for__1___It_must_be_one_of_the_following___2_,
c.BackgroundProteomeName, ARG_BGPROTEOME_NAME.ArgumentText, string.Join(@", ", Settings.Default.BackgroundProteomeList.Select(p => p.Name)));
return false;
}

return true;
}
};

public static string[] GetDisplayNames<TItem>(SettingsListBase<TItem> list) where TItem : IKeyContainer<string>, IXmlSerializable
{
return list.Select(list.GetDisplayName).ToArray();
Expand Down Expand Up @@ -1634,6 +1670,18 @@ public bool FullScanSettings
PeptideFilterMaxLength.HasValue ||
PeptideFilterMinLength.HasValue;

public string PeptideDigestEnzymeName { get; private set; }
public int? PeptideDigestMaxMissedCleavages { get; private set; }
public string BackgroundProteomeName { get; private set; }
public string BackgroundProteomePath { get; private set; }
public PeptideFilter.PeptideUniquenessConstraint? PeptideDigestUniquenessConstraint { get; private set; }

public bool PeptideDigestSettings => PeptideDigestEnzymeName != null ||
PeptideDigestMaxMissedCleavages.HasValue ||
BackgroundProteomeName != null ||
BackgroundProteomePath != null ||
PeptideDigestUniquenessConstraint.HasValue;

public double? IonMobilityLibraryRes { get; private set; }

public bool ImsSettings
Expand Down Expand Up @@ -2152,7 +2200,8 @@ public static IEnumerable<IUsageBlock> UsageBlocks
GROUP_EXP_GENERAL,
GROUP_EXP_INSTRUMENT,
GROUP_PANORAMA,
GROUP_SETTINGS,
GROUP_PEPTIDE_SETTINGS,
GROUP_TRANSITION_SETTINGS,
GROUP_TOOLS
};
}
Expand Down Expand Up @@ -2564,11 +2613,11 @@ public DocArgument(string name, Func<string[]> values, Action<CommandArgs, NameV
{
}

public static DocArgument FromEnumType<TEnum>(string name, Action<CommandArgs, TEnum> processValue)
public static DocArgument FromEnumType<TEnum>(string name, Action<CommandArgs, TEnum> processValue) where TEnum : Enum
{
var enumType = typeof(TEnum);
return new DocArgument(name, () => Enum.GetNames(enumType),
(c, p) => processValue(c, (TEnum) Enum.Parse(enumType, p.Value)))
(c, p) => processValue(c, (TEnum) Enum.Parse(enumType, p.Value, true)))
{ WrapValue = true };
}

Expand Down
Loading

0 comments on commit 6a818db

Please sign in to comment.