lgatto / synapter

Label-free data analysis pipeline for optimal identification and quantitation
https://lgatto.github.io/synapter/
4 stars 2 forks source link

perform rescue after transfer #93

Closed pavel-shliaha closed 8 years ago

pavel-shliaha commented 8 years ago

As discussed with Sebastian on 25.07.15 there is currently a bug with rescue functionality. It seems that if or

filterUniqueMatches filterNonUniqueMatches

are used and no EMRT has been transferred after them (i.e. either not enough fragments are present after filterUniqueMatches or not enough difference is present in filterNonUniqueMatches), then no EMRT is assigned to a peptide by synapter. But at the same time no rescue is performed, since rescue is performed before filtering on fragments functionality.

To solve this rescue needs to always be done after all filtering as the last step of synapter analysis

sgibb commented 8 years ago

I introduced rescueEMRTs (and the corresponding code in findEMRTs is removed). You have to call it manually now, e.g.:

# [...]
findEMRTs(synapterAnalysis)
# [...] further filter, e.g. fragment matching etc.
rescueEMRTs(synapterAnalysis)
# or: 
rescueEMRTs(synapterAnalysis, method="copy")
pavel-shliaha commented 8 years ago

Unfortunately still problems. I have run the following code with the files in Z:\RAW\pvs22_QTOF_DATA_data3\data_for_synapter_2.0\bug\2015_07_19_problems_with_loading_spectrum\for_synapter:

synapterAnalysis <- Synapter(l, master = TRUE) fdr <- fpr <- 0.01 ppm <- 20

filterIdentPepScore(synapterAnalysis, method="BH", fdr=fdr)
filterQuantPepScore(synapterAnalysis, method="BH", fdr=fdr)
filterIdentProtFpr(synapterAnalysis, fpr=fpr)
filterQuantProtFpr(synapterAnalysis, fpr=fpr)
filterIdentPpmError(synapterAnalysis, ppm=ppm)
filterQuantPpmError(synapterAnalysis, ppm=ppm)
filterUniqueDbPeptides (synapterAnalysis, missedCleavages = 2, IisL = TRUE)

mergePeptides(synapterAnalysis)
modelRt(synapterAnalysis, span=0.1)
searchGrid(synapterAnalysis, 
           imdiffs = seq (0.6, 1.6, 0.2), ppm = 8:12,
           nsd = seq (1, 4, 1))

plotGrid (synapterAnalysis)
setBestGridParams (synapterAnalysis)
findEMRTs(synapterAnalysis)

fragmentMatching (synapterAnalysis)
fragmentMatchingStats <- plotFragmentMatchingPerformance (synapterAnalysis)$nonunique
sel <- which(fragmentMatchingStats[, "fdr"] < 0.05)
nonUniqueThreshold <- min (fragmentMatchingStats[sel, "deltacommon"])
cat (paste ("delta selected is", nonUniqueThreshold), sep = "\n")

filterUniqueMatches   (synapterAnalysis, minNumber = 1)
filterNonUniqueMatches(synapterAnalysis, minDelta = nonUniqueThreshold)

rescueEMRTs (synapterAnalysis, method = "rescue")

setwd (dirResult)
writeMatchedEMRTs  (synapterAnalysis, what = "full", file =  paste0 (outputFileNames[i], ".csv")) 

Now it seems that synapter struggles to put the result for filterNonUniqueMatches() in (leaving NA). See the jpeg attached

28 7 15 bug

PS: not sure whether it is related to rescue functionaility recent changes so opened it here

sgibb commented 8 years ago

Was not related to the recent changes. Was a regular bug :wink: matched.quant.spectrumIDs just contains the final match. Should it contain all matches?

pavel-shliaha commented 8 years ago

Yes, please

sgibb commented 8 years ago

Should be fixed now.

pavel-shliaha commented 8 years ago

Sorry, Sebastian for not making myself clear,but there are problems again:

28 7 15 bug 2

sgibb commented 8 years ago

The plgsAgreement column is updated after findEMRTs, filterUniqueMatches and filterNonUniqueMatches automatically. Do you think we need a special user-visible function for it? (the NA you mentioned in your last comment was a result of the multiple ids in the matched.quant.spectrumIDs after my last fix of this issue; this is fixed now).

Also I reimport all Pep3D data.