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

[WIP] Deconvolution using UniDec #625

Open
wants to merge 46 commits into
base: UniDecPort
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
eefac15
i committing a tutorial for C api integration
avcarr2 Mar 7, 2022
d683ffa
committing api tutorial
avcarr2 Mar 7, 2022
65e032a
Added unidec minimal library
avcarr2 Mar 9, 2022
3c98a3a
got rid of tutorial parts
avcarr2 Mar 9, 2022
b7aca82
minial library
avcarr2 Mar 9, 2022
3f311e5
UniDecMinimal now builds
avcarr2 Mar 10, 2022
d10b615
more files, tests, and it's almost working
avcarr2 Mar 10, 2022
fb77c72
Unidec dll ported, still working compatibility
avcarr2 Mar 11, 2022
ecdc118
updated support methods
avcarr2 Mar 12, 2022
d790288
Main decon is not working.
avcarr2 Mar 14, 2022
7f29b05
"Fixed issue where config was incorrect"
avcarr2 Mar 14, 2022
a536085
fixed crash caused by memory
avcarr2 Mar 15, 2022
f8bc2ed
added more tests
avcarr2 Mar 16, 2022
693aad7
more tests
avcarr2 Mar 17, 2022
e1f3356
more tests. Breaking at KillB function
avcarr2 Mar 18, 2022
ed1312d
new attempt at Unidec port
avcarr2 Mar 22, 2022
5a6801f
commit prior to InputUnsafe modifications
avcarr2 Mar 22, 2022
145f7dc
"pre-char byte incompatibility fix"
avcarr2 Mar 23, 2022
d2fa5fd
"changed barr from char* to byte* and updated func"
avcarr2 Mar 23, 2022
381a696
ErrFunctionSpeedy is not working
avcarr2 Mar 23, 2022
d3f3073
pre-modifications to make_isotopes
avcarr2 Mar 24, 2022
3a8a2c3
Pre-setupIsotopes modifications
avcarr2 Mar 25, 2022
34efd05
pre-modifications of inputs
avcarr2 Mar 25, 2022
b039d48
pre-changing errfunspeedy commit
avcarr2 Mar 30, 2022
4e360a3
fully functional UniDec algorithm
avcarr2 Mar 30, 2022
d13931a
"pre-changing decon commit"
avcarr2 Apr 1, 2022
dba08c4
added unsafe decon struct. In process of refactoring
avcarr2 Apr 1, 2022
b6f3851
fix median polish bug when proteins cannot be quantified (#624)
rmillikin Apr 5, 2022
2c8fabc
fixed scoring function
avcarr2 Apr 5, 2022
7db1311
pre-decon workflow method implementation
avcarr2 Apr 5, 2022
691aba4
Added unidec deconvolution method
avcarr2 Apr 8, 2022
cb98906
added homebrew UniDec algorithm
avcarr2 Apr 13, 2022
284374f
fully functioning homebrewed unidec algo
avcarr2 Apr 13, 2022
a5db13e
em commit
avcarr2 Apr 14, 2022
b5d65e0
UniDec algo homebrew kinda working
avcarr2 Apr 19, 2022
72a497e
update file structure
avcarr2 Apr 19, 2022
a7d537b
i committing a tutorial for C api integration
avcarr2 Mar 7, 2022
6225701
committing api tutorial
avcarr2 Mar 7, 2022
917ee9a
Added unidec minimal library
avcarr2 Mar 9, 2022
f6dfde0
got rid of tutorial parts
avcarr2 Mar 9, 2022
d647a61
minial library
avcarr2 Mar 9, 2022
b98b43f
UniDecMinimal now builds
avcarr2 Mar 10, 2022
f329ff1
Unidec dll ported, still working compatibility
avcarr2 Apr 19, 2022
9e32244
updated support methods
avcarr2 Apr 19, 2022
dc4c63b
updated structure
avcarr2 Apr 19, 2022
f728dda
redid the whole structure
avcarr2 Apr 19, 2022
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
415 changes: 415 additions & 0 deletions mzLib/FFTW3-LIB/fftw3.h

Large diffs are not rendered by default.

1,017 changes: 1,017 additions & 0 deletions mzLib/FFTW3-LIB/libfftw3-3.def

Large diffs are not rendered by default.

Binary file added mzLib/FFTW3-LIB/libfftw3-3.dll
Binary file not shown.
Binary file added mzLib/FFTW3-LIB/libfftw3-3.exp
Binary file not shown.
Binary file added mzLib/FFTW3-LIB/libfftw3-3.lib
Binary file not shown.
44 changes: 7 additions & 37 deletions mzLib/FlashLFQ/FlashLFQResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -346,43 +346,6 @@ public void CalculateProteinResultsMedianPolish(bool useSharedPeptides)
{
if (proteinGroupToPeptides.TryGetValue(proteinGroup, out var peptidesForThisProtein))
{
// calculate reference protein intensity (top 3 most intense peptides).
// the reference intensity is just a scaling factor because the median polish
// algorithm will return a normalized number that does not scale w/ intensity
// (it's more like a fold-change). so that number will be multiplied by this reference
// intensity to get a protein intensity
double referenceProteinIntensity = 0;
int topNPeaks = 3;

foreach (var group in filesGroupedByCondition)
{
List<double> highestIntensities = new List<double>();

foreach (var peptide in peptidesForThisProtein)
{
double max = 0;

foreach (var sample in group)
{
double peptideIntensity = peptide.GetIntensity(sample);

if (!double.IsNaN(peptideIntensity))
{
max = Math.Max(max, peptideIntensity);
}
}

highestIntensities.Add(max);
}

referenceProteinIntensity = highestIntensities.OrderByDescending(p => p).Take(topNPeaks).Sum();

if (referenceProteinIntensity > 0)
{
break;
}
}

// set up peptide intensity table
int numSamples = 0;
foreach (var condition in SpectraFiles.GroupBy(p => p.Condition))
Expand Down Expand Up @@ -451,6 +414,7 @@ public void CalculateProteinResultsMedianPolish(bool useSharedPeptides)

// do median polish protein quantification
MedianPolish(peptideIntensityMatrix, 10, 0.0001, out var rowEffects, out var columnEffects, out var overallEffect);
double referenceProteinIntensity = Math.Pow(2, overallEffect);

// set the sample protein intensities
sampleN = 0;
Expand Down Expand Up @@ -480,6 +444,12 @@ public void CalculateProteinResultsMedianPolish(bool useSharedPeptides)
if (!isMissingValue)
{
proteinGroup.SetIntensity(sample.First(), sampleProteinIntensity);

// TODO: this will fix cases where protein quantities are the identical as a result of a median polish issue
if (columnEffects[sampleN] == 0)
{
proteinGroup.SetIntensity(sample.First(), double.NaN);
}
}

sampleN++;
Expand Down
19 changes: 18 additions & 1 deletion mzLib/MassSpectrometry/MzSpectra/MzSpectrum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq;


namespace MassSpectrometry
{
Expand Down Expand Up @@ -94,6 +95,18 @@ public MzSpectrum(double[,] mzintensities)
Buffer.BlockCopy(mzintensities, sizeof(double) * count, YArray, 0, sizeof(double) * count);
peakList = new MzPeak[Size];
}
public MzSpectrum(List<MzPeak> mzPeakList)
{
XArray = mzPeakList.Select(i => i.Mz).ToArray();
YArray = mzPeakList.Select(i => i.Intensity).ToArray();
peakList = new MzPeak[Size];
}
public MzSpectrum(IEnumerable<MzPeak> mzPeakList)
{
XArray = mzPeakList.Select(i => i.Mz).ToArray();
YArray = mzPeakList.Select(i => i.Intensity).ToArray();
peakList = new MzPeak[Size];
}

public MzSpectrum(double[] mz, double[] intensities, bool shouldCopy)
{
Expand Down Expand Up @@ -811,5 +824,9 @@ private MzPeak GeneratePeak(int index)
{
return new MzPeak(XArray[index], YArray[index]);
}
public void DeconvoluteWithUniDec()
{

}
}
}
Binary file added mzLib/Test/DataFiles/LowResMS1ScanForDecon.raw
Binary file not shown.
Loading