lgatto/synapter — pull request #58 by sgibb (2014-04-29 15:00:31+00:00)
Title: summary plot for ion mobility

Dear Laurent,

this PR adds the `.plotIonMobilitySummary` function (regarding #33). As we had discussed it is hidden and undocumented for now.

Best wishes,

Sebastian

Rmd file: https://gist.github.com/sgibb/11402829
Output:
# Ion Mobility Example

## Default Synapter Preprocessing

(same as in `synergise`)

```s
suppressPackageStartupMessages(library("synapter"))
```

### File Import

```s
dataPath <- file.path("..", "..", "..", "playground", "data",
"biological_replicas_for_synapter")
iaPath <- file.path(dataPath, "HDMSE", "ia")
apexPath <- file.path(dataPath, "HDMSE", "apex")

input <- list(
identpeptide=file.path(iaPath,
"fermentor_02_sample_15_HDMSE_01_20140303114821",
"fermentor_02_sample_15_HDMSE_01_IA_final_peptide.csv"),
quantpeptide=file.path(iaPath,
"fermentor_03_sample_15_HDMSE_01_20140303120343",
"fermentor_03_sample_15_HDMSE_01_IA_final_peptide.csv"),
quantpep3d=file.path(apexPath,
"fermentor_03_sample_15_HDMSE_01_20140302183822",
"fermentor_03_sample_15_HDMSE_01_Pep3DAMRT.csv"),
fasta=file.path(dataPath,
"S.cerevisiae_uniprot_reference_canonical_16_09_13.fasta"))

## only for reproducibility
set.seed(1)
system.time(s <- Synapter(input))
```

```
## Reading identification final peptide file...
## Reading quantitation final peptide file...
## Reading quantitation Pep3D file...
## Filtering...
## Computing identification statistics...
```

```
## user system elapsed
## 128.976 1.328 130.902
```

### Filtering

```s
filterUniqueDbPeptides(s, verbose=TRUE)
```

```
## Fasta file: 6621 proteins
## 179685 out of 192291 tryptic peptides are proteotypic.
```

```s
fdr <- fpr <- 0.05
ppm <- 20

filterIdentPepScore(s, method="BH", fdr=fdr)
filterQuantPepScore(s, method="BH", fdr=fdr)
filterIdentProtFpr(s, fpr=fpr)
filterQuantProtFpr(s, fpr=fpr)
filterIdentPpmError(s, ppm=ppm)
filterQuantPpmError(s, ppm=ppm)
```

### RT Model and Grid Search

```s
mergePeptides(s)

modelRt(s, span=0.05)

system.time(searchGrid(s, verbose=FALSE))
```

```
## user system elapsed
## 31.622 0.556 32.301
```

```s

setBestGridParams(s)

findEMRTs(s)
s
```

```
## Object of class "Synapter"
## Package version 1.7.2
## Data files:
## + Quantitation pep file: fermentor_03_sample_15_HDMSE_01_IA_final_peptide.csv
## + Identification pep file: fermentor_02_sample_15_HDMSE_01_IA_final_peptide.csv
## + Quantitation Pep3DAMRT file: fermentor_03_sample_15_HDMSE_01_Pep3DAMRT.csv
## + Fasta file: S.cerevisiae_uniprot_reference_canonical_16_09_13.fasta
## Log:
## [1] "Instance created on Tue Apr 29 15:50:41 2014"
## [2] "Read identification peptide data [32308,66]"
## [ 29 lines ]
## [32] "Set 'nsd' and 'ppm error' to 2 and 8 (best 'auto')"
## [33] "Matched identification peptides and quantitation EMRTs [6388,127] (rescue)"
```

## Ion Mobility

```s
set.seed(1) # only for demonstration
m <- synapter:::.plotIonMobilitySummary(s)
```

```
## create flat EMRTs data.frame
```

![imsummary](https://cloud.githubusercontent.com/assets/1828443/2830444/b6a6ad50-cfae-11e3-86ca-6c0185b5a6e3.png)

```s
kable(m[1:25,], row.names=FALSE)
```

| ncommon| tp| fp| tn| fn| accuracy| precision| recall| fdr| f1|
|--------:|----:|----:|----:|----:|---------:|----------:|-------:|-------:|-------:|
| 0.0| 5| 0| 838| 833| 0.5030| 1.0000| 0.0060| 0.0000| 0.0119|
| 0.5| 647| 222| 616| 191| 0.7536| 0.7445| 0.7721| 0.2555| 0.7581|
| 1.0| 651| 282| 556| 187| 0.7202| 0.6977| 0.7768| 0.3023| 0.7352|
| 1.5| 651| 308| 530| 187| 0.7047| 0.6788| 0.7768| 0.3212| 0.7245|
| 2.0| 651| 333| 505| 187| 0.6897| 0.6616| 0.7768| 0.3384| 0.7146|
| 2.5| 651| 354| 484| 187| 0.6772| 0.6478| 0.7768| 0.3522| 0.7065|
| 3.0| 652| 366| 472| 186| 0.6706| 0.6405| 0.7780| 0.3595| 0.7026|
| 3.5| 652| 382| 456| 186| 0.6611| 0.6306| 0.7780| 0.3694| 0.6966|
| 4.0| 652| 393| 445| 186| 0.6545| 0.6239| 0.7780| 0.3761| 0.6925|
| 4.5| 652| 407| 431| 186| 0.6462| 0.6157| 0.7780| 0.3843| 0.6874|
| 5.0| 652| 422| 416| 186| 0.6372| 0.6071| 0.7780| 0.3929| 0.6820|
| 5.5| 652| 439| 399| 186| 0.6271| 0.5976| 0.7780| 0.4024| 0.6760|
| 6.0| 652| 453| 385| 186| 0.6187| 0.5900| 0.7780| 0.4100| 0.6711|
| 6.5| 652| 466| 372| 186| 0.6110| 0.5832| 0.7780| 0.4168| 0.6667|
| 7.0| 654| 476| 362| 184| 0.6062| 0.5788| 0.7804| 0.4212| 0.6646|
| 7.5| 654| 489| 349| 184| 0.5984| 0.5722| 0.7804| 0.4278| 0.6603|
| 8.0| 654| 508| 330| 184| 0.5871| 0.5628| 0.7804| 0.4372| 0.6540|
| 8.5| 654| 529| 309| 184| 0.5746| 0.5528| 0.7804| 0.4472| 0.6472|
| 9.0| 654| 539| 299| 184| 0.5686| 0.5482| 0.7804| 0.4518| 0.6440|
| 9.5| 655| 553| 285| 183| 0.5609| 0.5422| 0.7816| 0.4578| 0.6403|
| 10.0| 655| 570| 268| 183| 0.5507| 0.5347| 0.7816| 0.4653| 0.6350|
| 10.5| 655| 581| 257| 183| 0.5442| 0.5299| 0.7816| 0.4701| 0.6316|
| 11.0| 656| 599| 239| 182| 0.5340| 0.5227| 0.7828| 0.4773| 0.6269|
| 11.5| 657| 605| 233| 181| 0.5310| 0.5206| 0.7840| 0.4794| 0.6257|
| 12.0| 657| 619| 219| 181| 0.5227| 0.5149| 0.7840| 0.4851| 0.6216|