Skip to content

Commit

Permalink
Change decoy generation to complementary
Browse files Browse the repository at this point in the history
Use fixed npv
Fix npv denominator
  • Loading branch information
danielgeiszler committed May 29, 2024
1 parent 26ff7f2 commit 776ec32
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,13 @@ private void fitMatchedIonDistribution() throws Exception {
float[] reducedInts = reducedIons[1];

// Get sites that are/would be shifted
ArrayList<Float> sitePepFrags = DownstreamPepFragGenerator.calculatePeptideFragments(
targetPep, this.ionTypes, mutationSite, 1);
ArrayList<Float> decoySitePepFrags = DownstreamPepFragGenerator.calculatePeptideFragments(
decoyPep, this.ionTypes, mutationSite, 1);
//ArrayList<Float> sitePepFrags = DownstreamPepFragGenerator.calculatePeptideFragments(
// targetPep, this.ionTypes, mutationSite, 1);
//ArrayList<Float> decoySitePepFrags = DownstreamPepFragGenerator.calculatePeptideFragments(
// decoyPep, this.ionTypes, mutationSite, 1);
// Generate target and decoy fragments
//ArrayList<Float> sitePepFrags = targetPep.calculatePeptideFragments(this.ionTypes, 1);
//ArrayList<Float> decoySitePepFrags = decoyPep.calculateComplementaryFragments(this.ionTypes, mutatedMassShift, mutationSite, 1);
ArrayList<Float> sitePepFrags = targetPep.calculatePeptideFragments(this.ionTypes, 1);
ArrayList<Float> decoySitePepFrags = targetPep.calculateComplementaryFragments(this.ionTypes, mutatedMassShift, mutationSite, 1);

// Score over all possible sites
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public void calculateNegativePredictiveValue() { // todo see if adding 1 here he

this.ionPosterior = new double[((int) (100.0 * this.binMult + 1))];
for (int i = 0; i < this.ionPosterior.length; i++) {
this.ionPosterior[i] = (double) ((this.pdf[i] + 1) / (double) (this.pdf[i] + this.pdfDecoy[i] + 2));
this.ionPosterior[i] = (double) ((this.pdf[i]) / (double) (this.pdf[i] + this.pdfDecoy[i]));
System.out.println(this.ionPosterior[i]);
}
//this.negPredictiveValue = Math.max(this.negPredictiveValue, 0.01);
Expand Down Expand Up @@ -442,9 +442,10 @@ public double calcIonProbability(float intensity, float massError) {
public double calculateIonProbabilityLda(float intensity, float massError) {
double projVal;
double prob;
if (intensity < 0)
prob = this.ionPosterior[(int) (intensity * -1 * this.binMult)];
else {
if (intensity < 0) {
//prob = this.ionPosterior[(int) (intensity * -1 * this.binMult)];
prob = this.negPredictiveValue;
} else {
projVal = this.ldaProcessor.projectData(massError, intensity).getEntry(0,0);
int projValIndex = translateLdaValToIndex(projVal);
prob = 1.0 - this.qVals[projValIndex];
Expand Down

0 comments on commit 776ec32

Please sign in to comment.