diff --git a/MetaMorpheus/EngineLayer/GlobalVariables.cs b/MetaMorpheus/EngineLayer/GlobalVariables.cs index 96efe5960..bf3c7516a 100644 --- a/MetaMorpheus/EngineLayer/GlobalVariables.cs +++ b/MetaMorpheus/EngineLayer/GlobalVariables.cs @@ -1,5 +1,6 @@ using Chemistry; using MassSpectrometry; +using MzLibUtil; using Nett; using Proteomics; using Proteomics.AminoAcidPolymer; @@ -14,6 +15,7 @@ using Omics.Modifications; using TopDownProteomics; using UsefulProteomicsDatabases; +using Omics.Digestion; namespace EngineLayer { @@ -79,6 +81,7 @@ public static void SetUpGlobalVariables() SetUpGlobalSettings(); LoadDissociationTypes(); LoadAvailableProteomes(); + LoadCustomProtease(); } public static void AddMods(IEnumerable modifications, bool modsAreFromTheTopOfProteinXml) @@ -202,6 +205,32 @@ public static void LoadCustomAminoAcids() } } + public static void LoadCustomProtease() + { + string ProtDirectory = Path.Combine(DataDir, @"ProteolyticDigestion"); + string customProteasePath = Path.Combine(ProtDirectory, @"CustomProtease.tsv"); + //load proteases from customProtease file or the original file to Protease dictionary + if (File.Exists(customProteasePath)) + { + string[] proteaseToAdd = File.ReadAllLines(customProteasePath); + for (int i = 1; i < proteaseToAdd.Length; i++) + { + string[] array = proteaseToAdd[i].Split('\t'); + List motifList = DigestionMotif.ParseDigestionMotifsFromString(array[1]); + string name = array[0]; + CleavageSpecificity cleavageSpecificity = (CleavageSpecificity)Enum.Parse(typeof(CleavageSpecificity), array[4], ignoreCase: true); + string psiMSAccessionNumber = array[5]; + string psiMSName = array[6]; + string proteaseModDetails = array[8]; + Protease protease = new Protease(name, cleavageSpecificity, psiMSAccessionNumber, psiMSName, motifList); + if (!ProteaseDictionary.Dictionary.ContainsKey(protease.Name)) + { + ProteaseDictionary.Dictionary.Add(protease.Name, protease); + } + } + } + } + public static void WriteAminoAcidsFile() { string directory = Path.Combine(DataDir, @"CustomAminoAcids"); diff --git a/MetaMorpheus/GUI/MainWindow.xaml b/MetaMorpheus/GUI/MainWindow.xaml index 7c33fd33b..eaa62dcfc 100644 --- a/MetaMorpheus/GUI/MainWindow.xaml +++ b/MetaMorpheus/GUI/MainWindow.xaml @@ -732,16 +732,19 @@