Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
root = true

[*]
insert_final_newline = true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -234,4 +234,6 @@ _Pvt_Extensions

# Macintosh files
**/.DS_Store
/.opencode/
/AGENTS.md
/.serena
6 changes: 5 additions & 1 deletion MetaMorpheus/CMD/CMD.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<PackageReference Include="Microsoft.ML.CpuMath" Version="3.0.1" />
<PackageReference Include="Microsoft.ML.FastTree" Version="3.0.1" />
<PackageReference Include="Microsoft.NETCore.App" Version="2.2.8" />
<PackageReference Include="mzLib" Version="1.0.574" />
<PackageReference Include="mzLib" Version="1.0.576" />
<PackageReference Include="Nett" Version="0.15.0" />
<PackageReference Include="SQLite.Interop.dll" Version="1.0.103" />
<PackageReference Include="System.Data.SQLite" Version="1.0.118" />
Expand All @@ -36,4 +36,8 @@
<ProjectReference Include="..\TaskLayer\TaskLayer.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>

</Project>
11 changes: 11 additions & 0 deletions MetaMorpheus/CMD/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"profiles": {
"CMD": {
"commandName": "Project"
},
"WSL": {
"commandName": "WSL2",
"distributionName": ""
}
}
}
4 changes: 2 additions & 2 deletions MetaMorpheus/EngineLayer/ClassicSearch/ClassicSearchEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ protected override MetaMorpheusEngineResults RunSpecific()
// check if we've already generated theoretical fragments for this peptide+dissociation type
if (peptideTheorProducts.Count == 0)
{
specificBioPolymer.Fragment(dissociationType, CommonParameters.DigestionParams.FragmentationTerminus, peptideTheorProducts);
specificBioPolymer.Fragment(dissociationType, CommonParameters.DigestionParams.FragmentationTerminus, peptideTheorProducts, CommonParameters.FragmentationParameters);
}

// match theoretical target ions to spectrum
Expand Down Expand Up @@ -205,7 +205,7 @@ private void DecoyScoreForSpectralLibrarySearch(ScanWithIndexAndNotchInfo scan,

if (decoyTheoreticalFragments.Count == 0)
{
reversedOnTheFlyDecoy.Fragment(dissociationType, CommonParameters.DigestionParams.FragmentationTerminus, decoyTheoreticalFragments);
reversedOnTheFlyDecoy.Fragment(dissociationType, CommonParameters.DigestionParams.FragmentationTerminus, decoyTheoreticalFragments, CommonParameters.FragmentationParameters);
}
Ms2ScanWithSpecificMass theScan = ArrayOfSortedMS2Scans[scan.ScanIndex];
var decoyMatchedIons = MatchFragmentIons(theScan, decoyTheoreticalFragments, CommonParameters,
Expand Down
21 changes: 16 additions & 5 deletions MetaMorpheus/EngineLayer/CommonParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
using System.Reflection;
using Nett;
using Omics.Digestion;
using Omics.Fragmentation.Peptide;
using Transcriptomics.Digestion;
using EngineLayer.DIA;
using Transcriptomics;

namespace EngineLayer
{
Expand Down Expand Up @@ -47,7 +47,8 @@ public CommonParameters(
bool trimMs1Peaks = false,
bool trimMsMsPeaks = true,
Tolerance productMassTolerance = null,
Tolerance precursorMassTolerance = null,
Tolerance precursorMassTolerance = null,
Tolerance productMassTolerance_LowRes = null,
Tolerance deconvolutionMassTolerance = null,
int maxThreadsToUsePerFile = -1,
IDigestionParams digestionParams = null,
Expand All @@ -60,7 +61,8 @@ public CommonParameters(
DeconvolutionParameters precursorDeconParams = null,
DeconvolutionParameters productDeconParams = null,
bool useMostAbundantPrecursorIntensity = true,
DIAparameters diaParameters = null)
DIAparameters diaParameters = null,
IFragmentationParams fragmentationParams = null)

{
TaskDescriptor = taskDescriptor;
Expand All @@ -84,6 +86,7 @@ public CommonParameters(
MaxThreadsToUsePerFile = maxThreadsToUsePerFile == -1 ? Environment.ProcessorCount > 1 ? Environment.ProcessorCount - 1 : 1 : maxThreadsToUsePerFile;
ProductMassTolerance = productMassTolerance ?? new PpmTolerance(20);
PrecursorMassTolerance = precursorMassTolerance ?? new PpmTolerance(5);
ProductMassTolerance_LowRes = productMassTolerance_LowRes ?? ProductMassTolerance;
DeconvolutionMassTolerance = deconvolutionMassTolerance ?? new PpmTolerance(4);
DigestionParams = digestionParams ?? new DigestionParams();
DissociationType = dissociationType;
Expand Down Expand Up @@ -119,11 +122,13 @@ public CommonParameters(
ListOfModsFixed = listOfModsFixed ?? new List<(string, string)>();
PrecursorDeconvolutionParameters.AverageResidueModel = new OxyriboAveragine();
ProductDeconvolutionParameters.AverageResidueModel = new OxyriboAveragine();
FragmentationParameters = fragmentationParams ?? RnaFragmentationParams.Default;
}
else
{
ListOfModsVariable = listOfModsVariable ?? new List<(string, string)> { ("Common Variable", "Oxidation on M") };
ListOfModsFixed = listOfModsFixed ?? new List<(string, string)> { ("Common Fixed", "Carbamidomethyl on C"), ("Common Fixed", "Carbamidomethyl on U") };
FragmentationParameters = fragmentationParams ?? new FragmentationParams();
}

CustomIons = digestionParams.ProductsFromDissociationType()[DissociationType.Custom];
Expand Down Expand Up @@ -157,8 +162,9 @@ public int DeconvolutionMaxAssumedChargeState
[TomlIgnore] public Tolerance DeconvolutionMassTolerance { get; private set; }
public int TotalPartitions { get; set; }
public Tolerance ProductMassTolerance { get; set; } // public setter required for calibration task
public Tolerance ProductMassTolerance_LowRes { get; set; }// Wider mass tolerance for lower resolution analyzer (e.g. ion trap). For now, this is a independent parameter, will not be modified by the calibration task.
public Tolerance PrecursorMassTolerance { get; set; } // public setter required for calibration task
public bool AddCompIons { get; private set; }
public bool AddCompIons { get; set; }
/// <summary>
/// Only peptides/PSMs with Q-Value and Q-Value Notch below this threshold are used for quantification and
/// spectral library generation. If SearchParameters.WriteHighQValuePsms is set to false, only
Expand Down Expand Up @@ -199,6 +205,7 @@ public int DeconvolutionMaxAssumedChargeState

public bool UseMostAbundantPrecursorIntensity { get; set; }
public DIAparameters? DIAparameters { get; set; } //only for DIA analysis involving pseudo ms2 scan generation
public IFragmentationParams FragmentationParameters { get; set; }

public CommonParameters Clone()
{
Expand Down Expand Up @@ -257,6 +264,7 @@ public CommonParameters CloneWithNewTerminus(FragmentationTerminus? terminus = n
TrimMsMsPeaks,
ProductMassTolerance,
PrecursorMassTolerance,
ProductMassTolerance_LowRes,
DeconvolutionMassTolerance,
MaxThreadsToUsePerFile,
DigestionParams.Clone(terminus),
Expand All @@ -267,7 +275,10 @@ public CommonParameters CloneWithNewTerminus(FragmentationTerminus? terminus = n
MinVariantDepth,
AddTruncations,
PrecursorDeconvolutionParameters,
ProductDeconvolutionParameters);
ProductDeconvolutionParameters,
UseMostAbundantPrecursorIntensity,
DIAparameters,
FragmentationParameters);
}

public void SetCustomProductTypes()
Expand Down
2 changes: 1 addition & 1 deletion MetaMorpheus/EngineLayer/EngineLayer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<PackageReference Include="Microsoft.ML.CpuMath" Version="3.0.1" />
<PackageReference Include="Microsoft.ML.FastTree" Version="3.0.1" />
<PackageReference Include="Microsoft.NETCore.App" Version="2.2.8" />
<PackageReference Include="mzLib" Version="1.0.574" />
<PackageReference Include="mzLib" Version="1.0.576" />
<PackageReference Include="NETStandard.Library" Version="2.0.3" />
<PackageReference Include="Nett" Version="0.15.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
Expand Down
14 changes: 9 additions & 5 deletions MetaMorpheus/EngineLayer/GlycoSearch/GlycoSearchEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public GlycoSearchEngine(List<GlycoSpectralMatch>[] globalCsms, Ms2ScanWithSpeci
this.OxoniumIonFilter = oxoniumIonFilter;
this._oglycanDatabase = oglycanDatabase;
this._nglycanDatabase = nglycanDatabase;

SecondFragmentIndex = secondFragmentIndex;
PrecusorSearchMode = commonParameters.PrecursorMassTolerance;
ProductSearchMode = new SinglePpmAroundZeroSearchMode(20); //For Oxonium ion only
Expand Down Expand Up @@ -324,7 +323,8 @@ private GlycoSpectralMatch CreateGsm(Ms2ScanWithSpecificMass theScan, int scanIn

var PeptideScore = score - DiagnosticIonScore;

var p = theScan.TheScan.MassSpectrum.Size * CommonParameters.ProductMassTolerance.GetRange(1000).Width / theScan.TheScan.MassSpectrum.Range.Width;
var parentProductTolerance = IsLowResolutionScan(theScan) ? CommonParameters.ProductMassTolerance_LowRes : CommonParameters.ProductMassTolerance;
var p = theScan.TheScan.MassSpectrum.Size * parentProductTolerance.GetRange(1000).Width / theScan.TheScan.MassSpectrum.Range.Width;

int n = fragmentsForEachGlycoPeptide.Where(v => v.ProductType == ProductType.c || v.ProductType == ProductType.zDot).Count();

Expand All @@ -333,7 +333,6 @@ private GlycoSpectralMatch CreateGsm(Ms2ScanWithSpecificMass theScan, int scanIn
foreach (var childScan in theScan.ChildScans)
{
var childFragments = GlycoPeptides.OGlyGetTheoreticalFragments(CommonParameters.MS2ChildScanDissociationType, CommonParameters.CustomIons, peptide, peptideWithMod);

var matchedChildIons = MatchFragmentIons(childScan, childFragments, CommonParameters);

n += childFragments.Where(v => v.ProductType == ProductType.c || v.ProductType == ProductType.zDot).Count();
Expand All @@ -356,7 +355,8 @@ private GlycoSpectralMatch CreateGsm(Ms2ScanWithSpecificMass theScan, int scanIn
//TO THINK:may think a different way to use childScore
score += childScore;

p += childScan.TheScan.MassSpectrum.Size * CommonParameters.ProductMassTolerance.GetRange(1000).Width / childScan.TheScan.MassSpectrum.Range.Width;
var productTolerance = IsLowResolutionScan(childScan) ? CommonParameters.ProductMassTolerance_LowRes : CommonParameters.ProductMassTolerance;
p += childScan.TheScan.MassSpectrum.Size * productTolerance.GetRange(1000).Width / childScan.TheScan.MassSpectrum.Range.Width;

}

Expand Down Expand Up @@ -439,12 +439,16 @@ private void FindOGlycan(Ms2ScanWithSpecificMass theScan, int scanIndex, int sco
SortedDictionary<int, string> modPos = GlycoSpectralMatch.GetPossibleModSites(theScanBestPeptide, Motifs); //list all of the possible glycoslation site/postition

var localizationScan = theScan;
var toleranceForLocalizationScan = CommonParameters.ProductMassTolerance;
List<Product> products = new List<Product>(); // product list for the theoretical fragment ions

//For HCD-pd-ETD or CD-pd-EThcD type of data, we generate the different rpoducts.
if (theScan.ChildScans.Count > 0 && GlycoPeptides.DissociationTypeContainETD(CommonParameters.MS2ChildScanDissociationType, CommonParameters.CustomIons))
{
localizationScan = theScan.ChildScans.First();
// For the localization scan, if it is from ion trap, we will use a wider tolerance for the localization.
toleranceForLocalizationScan = localizationScan.TheScan.MzAnalyzer == MZAnalyzerType.IonTrap2D ||
localizationScan.TheScan.MzAnalyzer == MZAnalyzerType.IonTrap3D ? CommonParameters.ProductMassTolerance_LowRes : CommonParameters.ProductMassTolerance;
theScanBestPeptide.Fragment(DissociationType.ETD, FragmentationTerminus.Both, products);
}

Expand Down Expand Up @@ -477,7 +481,7 @@ private void FindOGlycan(Ms2ScanWithSpecificMass theScan, int scanIndex, int sco
if (GraphCheck(modPos, GlycanBoxes[iDLow])) // the glycosite number should be larger than the possible glycan number.
{
LocalizationGraph localizationGraph = new LocalizationGraph(modPos, GlycanBoxes[iDLow], GlycanBoxes[iDLow].ChildGlycanBoxes, iDLow);
LocalizationGraph.LocalizeOGlycan(localizationGraph, localizationScan, CommonParameters.ProductMassTolerance, products); //create the localization graph with the glycan mass and the possible glycosite.
LocalizationGraph.LocalizeOGlycan(localizationGraph, localizationScan, toleranceForLocalizationScan, products); //create the localization graph with the glycan mass and the possible glycosite.

double currentLocalizationScore = localizationGraph.TotalScore;
if (currentLocalizationScore > bestLocalizedScore) //Try to find the best glycanBox with the highest score.
Expand Down
2 changes: 1 addition & 1 deletion MetaMorpheus/EngineLayer/Gptmd/GptmdEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ protected override MetaMorpheusEngineResults RunSpecific()

var newPep = pepWithSetMods.Localize(pepSeqIndex, mod.MonoisotopicMass.Value);
peptideTheorProducts.Clear();
newPep.Fragment(dissociationType, CommonParameters.DigestionParams.FragmentationTerminus, peptideTheorProducts);
newPep.Fragment(dissociationType, CommonParameters.DigestionParams.FragmentationTerminus, peptideTheorProducts, CommonParameters.FragmentationParameters);

ms2ScanWithSpecificMass ??= new Ms2ScanWithSpecificMass(scan, precursorMass, precursorCharge, fileName, CommonParameters);
var matchedIons = MatchFragmentIons(ms2ScanWithSpecificMass, peptideTheorProducts, CommonParameters, matchAllCharges: false);
Expand Down
2 changes: 1 addition & 1 deletion MetaMorpheus/EngineLayer/Indexing/IndexingEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ protected override MetaMorpheusEngineResults RunSpecific()

for (int peptideId = 0; peptideId < peptides.Count; peptideId++)
{
peptides[peptideId].Fragment(CommonParameters.DissociationType, CommonParameters.DigestionParams.FragmentationTerminus, fragments);
peptides[peptideId].Fragment(CommonParameters.DissociationType, CommonParameters.DigestionParams.FragmentationTerminus, fragments, CommonParameters.FragmentationParameters);

foreach (var theoreticalFragment in fragments)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected override MetaMorpheusEngineResults RunSpecific()
var peptideWithLocalizedMassDiff = peptide.Localize(r, massDifference);

// this is the list of theoretical products for this peptide with mass-difference on this residue
peptideWithLocalizedMassDiff.Fragment(CommonParameters.DissociationType, CommonParameters.DigestionParams.FragmentationTerminus, productsWithLocalizedMassDiff);
peptideWithLocalizedMassDiff.Fragment(CommonParameters.DissociationType, CommonParameters.DigestionParams.FragmentationTerminus, productsWithLocalizedMassDiff, CommonParameters.FragmentationParameters);

var matchedIons = MatchFragmentIons(scanWithSpecificMass, productsWithLocalizedMassDiff, CommonParameters);

Expand Down
Loading