Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Soften calibration tolerance #2423

Merged
6 changes: 0 additions & 6 deletions MetaMorpheus/EngineLayer/Calibration/CalibrationEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@ protected override MetaMorpheusEngineResults RunSpecific()
//generate new scans
MsDataScan[] calibratedScans = new MsDataScan[originalScans.Count];

//hard copy original scans
for (int i = 0; i < originalScans.Count; i++)
{
calibratedScans[i] = originalScans[i];
}

//apply a smoothing function, so that outlier scans aren't wildly shifted
double[] ms1SmoothedErrors = SmoothErrors(ms1RelativeErrors);
double[] ms2SmoothedErrors = new double[ms2RelativeErrors.Length];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@
double theoreticalMass = matchedIon.NeutralTheoreticalProduct.NeutralMass;
//get envelopes that match
var envelopesThatMatch = isotopicEnvelopes.Where(x => ms2Tolerance.Within(x.MonoisotopicMass, theoreticalMass)).OrderBy(x => Math.Abs(x.MonoisotopicMass - theoreticalMass)).ToList();

if(envelopesThatMatch.Count == 0)
continue;

Check warning on line 241 in MetaMorpheus/EngineLayer/Calibration/DataPointAcquisitionEngine.cs

View check run for this annotation

Codecov / codecov/patch

MetaMorpheus/EngineLayer/Calibration/DataPointAcquisitionEngine.cs#L241

Added line #L241 was not covered by tests
//only allow one envelope per charge state
bool[] chargeStateFound = new bool[envelopesThatMatch.Max(x => x.Charge) + 1];

Expand Down
25 changes: 3 additions & 22 deletions MetaMorpheus/EngineLayer/Calibration/DataPointAquisitionResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

namespace EngineLayer.Calibration
{
/// <summary>
/// Returns PSMs that can be used for calibration based on tolerance limits passed from the calibration task
/// </summary>
public class DataPointAquisitionResults : MetaMorpheusEngineResults
{
public DataPointAquisitionResults(
Expand All @@ -27,19 +30,9 @@ public DataPointAquisitionResults(

var ms1Range = Ms1List.Select(b => b.ExperimentalMz - b.TheoreticalMz).ToArray();
var ms2Range = Ms2List.Select(b => b.ExperimentalMz - b.TheoreticalMz).ToArray();
Ms1InfoTh = new Tuple<double, double>(ArrayStatistics.Mean(ms1Range), ArrayStatistics.StandardDeviation(ms1Range));
Ms2InfoTh = new Tuple<double, double>(ArrayStatistics.Mean(ms2Range), ArrayStatistics.StandardDeviation(ms2Range));


var ms1PpmRange = Ms1List.Select(b => (b.ExperimentalMz - b.TheoreticalMz) / b.TheoreticalMz).ToArray();
var ms2PpmRange = Ms2List.Select(b => (b.ExperimentalMz - b.TheoreticalMz) / b.TheoreticalMz).ToArray();
Ms1InfoPpm = new Tuple<double, double>(ArrayStatistics.Mean(ms1PpmRange), ArrayStatistics.StandardDeviation(ms1PpmRange));
Ms2InfoPpm = new Tuple<double, double>(ArrayStatistics.Mean(ms2PpmRange), ArrayStatistics.StandardDeviation(ms2PpmRange));

NumMs1MassChargeCombinationsConsidered = numMs1MassChargeCombinationsConsidered;
NumMs1MassChargeCombinationsThatAreIgnoredBecauseOfTooManyPeaks = numMs1MassChargeCombinationsThatAreIgnoredBecauseOfTooManyPeaks;
NumMs2MassChargeCombinationsConsidered = numMs2MassChargeCombinationsConsidered;
NumMs2MassChargeCombinationsThatAreIgnoredBecauseOfTooManyPeaks = numMs2MassChargeCombinationsThatAreIgnoredBecauseOfTooManyPeaks;

var precursorErrors = psms.Select(p => (p.ScanPrecursorMass - p.BioPolymerWithSetModsMonoisotopicMass.Value) / p.BioPolymerWithSetModsMonoisotopicMass.Value * 1e6).ToList();
PsmPrecursorIqrPpmError = precursorErrors.InterquartileRange();
Expand All @@ -50,16 +43,6 @@ public DataPointAquisitionResults(
PsmProductMedianPpmError = productErrors.Median();
}

public Tuple<double, double> Ms1InfoTh { get; }
public Tuple<double, double> Ms2InfoTh { get; }
public Tuple<double, double> Ms1InfoPpm { get; }
public Tuple<double, double> Ms2InfoPpm { get; }

public int NumMs1MassChargeCombinationsConsidered { get; }
public int NumMs1MassChargeCombinationsThatAreIgnoredBecauseOfTooManyPeaks { get; }
public int NumMs2MassChargeCombinationsConsidered { get; }
public int NumMs2MassChargeCombinationsThatAreIgnoredBecauseOfTooManyPeaks { get; }

public List<LabeledDataPoint> Ms1List { get; }
public List<LabeledDataPoint> Ms2List { get; }

Expand All @@ -69,8 +52,6 @@ public DataPointAquisitionResults(
public readonly double PsmProductIqrPpmError;
public readonly List<SpectralMatch> Psms;

public int Count { get { return Ms1List.Count + Ms2List.Count; } }

public override string ToString()
{
var sb = new StringBuilder();
Expand Down
2 changes: 1 addition & 1 deletion MetaMorpheus/GUI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace MetaMorpheusGUI
/// </summary>
public partial class MainWindow : Window
{
private readonly ObservableCollection<RawDataForDataGrid> SpectraFiles = new ObservableCollection<RawDataForDataGrid>();
private readonly ObservableCollection<RawDataForDataGrid> SpectraFiles = new ObservableCollection<RawDataForDataGrid>();
private ObservableCollection<ProteinDbForDataGrid> ProteinDatabases = new ObservableCollection<ProteinDbForDataGrid>();
private readonly ObservableCollection<PreRunTask> PreRunTasks = new ObservableCollection<PreRunTask>();
private readonly ObservableCollection<RawDataForDataGrid> SelectedSpectraFiles = new ObservableCollection<RawDataForDataGrid>();
Expand Down
Loading