These method calculates a-, b-, c-, x-, y- and z-ions produced by fragmentation.

Arguments

sequence

character, peptide sequence.

object

Object of class "Spectrum2" or "missing" .

tolerance

numeric tolerance between the theoretical and measured MZ values (only available if object is not missing).

method

method used for for duplicated matches. Choose "highest" or "closest" to select the peak with the highest intensity respectively the closest MZ in the tolerance range. If "all" is given all possible matches in the tolerance range are reported (only available if object is not missing).

type

character vector of target ions; possible values: c("a", "b", "c", "x", "y", "z"); default: type=c("b", "y").

z

numeric desired charge state; default z=1.

modifications

named numeric vector of used modifications. The name must correspond to the one-letter-code of the modified amino acid and the numeric value must represent the mass that should be added to the original amino accid mass, default: Carbamidomethyl modifications=c(C=57.02146). Use Nterm or Cterm as names for modifications that should be added to the amino respectively carboxyl-terminus.

neutralLoss

list, it has to have two named elments, namely water and ammonia that contain a character vector which type of neutral loss should be calculated. Currently neutral loss on the C terminal "Cterm", at the amino acids c("D", "E", "S", "T") for "water" (shown with an _) and c("K", "N", "Q", "R") for "ammonia" (shown with an *) are supported.
There is a helper function defaultNeutralLoss that returns the correct list. It has two arguments disableWaterLoss and disableAmmoniaLoss to remove single neutral loss options. See the example section for use cases.

verbose

logical if TRUE (default) the used modifications are printed.

Methods

signature(sequence = "character", object = "missing", ...)

Calculates the theoretical fragments for a peptide sequence. Returns a data.frame with the columns c("mz", "ion", "type", "pos", "z", "seq").

signature(sequence = "character", object = "Spectrum2", ...)

Calculates and matches the theoretical fragments for a peptide sequence and a "Spectrum2" object. The ... arguments are passed to the internal functions. Currently tolerance, method and relative are supported. You could change the tolerance (default 0.1) and decide whether this tolerance should be applied relative to the target m/z (relative = TRUE) or absolute (default relative = FALSE) to match the theoretical fragment MZ with the MZ of the spectrum. When (relative = TRUE) the mass tolerance window is set to target mz +/- (target mz * tolerance) and target mz +/- tolerance otherwise. In cases of multiple matches use method to select the peak with the highest intensity (method = "highest", default) respectively closest MZ (method = "closes"). If method = "all" is set all possible matches in the current tolerance range are reported. Returns the same data.frame as above but the mz column represents the matched MZ values of the spectrum. Additionally there is a column error that contains the difference between the observed MZ (from the spectrum) to the theoretical fragment MZ.

Author

Sebastian Gibb <mail@sebastiangibb.de>

Examples

## find path to a mzXML file
file <- dir(system.file(package = "MSnbase", dir = "extdata"),
            full.name = TRUE, pattern = "mzXML$")

## create basic MSnExp
msexp <- readMSData(file, centroided = FALSE)

## centroid them
msexp <- pickPeaks(msexp)

## calculate fragments for ACE with default modification
calculateFragments("ACE", modifications=c(C=57.02146))
#>          mz ion type pos z seq
#> 1  72.04439  b1    b   1 1   A
#> 2 232.07504  b2    b   2 1  AC
#> 3 148.06043  y1    y   1 1   E
#> 4 308.09108  y2    y   2 1  CE
#> 5 130.04987 y1_   y_   1 1   E
#> 6 290.08052 y2_   y_   2 1  CE

## calculate fragments for ACE with an addition N-terminal modification
calculateFragments("ACE", modifications=c(C=57.02146, Nterm=229.1629))
#>         mz ion type pos z seq
#> 1 301.2073  b1    b   1 1   A
#> 2 461.2379  b2    b   2 1  AC
#> 3 148.0604  y1    y   1 1   E
#> 4 308.0911  y2    y   2 1  CE
#> 5 130.0499 y1_   y_   1 1   E
#> 6 290.0805 y2_   y_   2 1  CE

## calculate fragments for ACE without any modifications
calculateFragments("ACE", modifications=NULL)
#>          mz ion type pos z seq
#> 1  72.04439  b1    b   1 1   A
#> 2 175.05358  b2    b   2 1  AC
#> 3 148.06043  y1    y   1 1   E
#> 4 251.06962  y2    y   2 1  CE
#> 5 130.04987 y1_   y_   1 1   E
#> 6 233.05906 y2_   y_   2 1  CE

calculateFragments("VESITARHGEVLQLRPK",
                   type=c("a", "b", "c", "x", "y", "z"),
                   z=1:2)
#>             mz  ion type pos z              seq
#> 1     72.08077   a1    a   1 1                V
#> 2     36.54402   a1    a   1 2                V
#> 3    201.12336   a2    a   2 1               VE
#> 4    101.06532   a2    a   2 2               VE
#> 5    288.15539   a3    a   3 1              VES
#> 6    144.58133   a3    a   3 2              VES
#> 7    401.23945   a4    a   4 1             VESI
#> 8    201.12336   a4    a   4 2             VESI
#> 9    502.28713   a5    a   5 1            VESIT
#> 10   251.64720   a5    a   5 2            VESIT
#> 11   573.32424   a6    a   6 1           VESITA
#> 12   287.16576   a6    a   6 2           VESITA
#> 13   729.42535   a7    a   7 1          VESITAR
#> 14   365.21631   a7    a   7 2          VESITAR
#> 15   866.48426   a8    a   8 1         VESITARH
#> 16   433.74577   a8    a   8 2         VESITARH
#> 17   923.50572   a9    a   9 1        VESITARHG
#> 18   462.25650   a9    a   9 2        VESITARHG
#> 19  1052.54831  a10    a  10 1       VESITARHGE
#> 20   526.77779  a10    a  10 2       VESITARHGE
#> 21  1151.61672  a11    a  11 1      VESITARHGEV
#> 22   576.31200  a11    a  11 2      VESITARHGEV
#> 23  1264.70078  a12    a  12 1     VESITARHGEVL
#> 24   632.85403  a12    a  12 2     VESITARHGEVL
#> 25  1392.75936  a13    a  13 1    VESITARHGEVLQ
#> 26   696.88332  a13    a  13 2    VESITARHGEVLQ
#> 27  1505.84342  a14    a  14 1   VESITARHGEVLQL
#> 28   753.42535  a14    a  14 2   VESITARHGEVLQL
#> 29  1661.94453  a15    a  15 1  VESITARHGEVLQLR
#> 30   831.47590  a15    a  15 2  VESITARHGEVLQLR
#> 31  1758.99729  a16    a  16 1 VESITARHGEVLQLRP
#> 32   880.00228  a16    a  16 2 VESITARHGEVLQLRP
#> 33   100.07569   b1    b   1 1                V
#> 34    50.54148   b1    b   1 2                V
#> 35   229.11828   b2    b   2 1               VE
#> 36   115.06278   b2    b   2 2               VE
#> 37   316.15031   b3    b   3 1              VES
#> 38   158.57879   b3    b   3 2              VES
#> 39   429.23437   b4    b   4 1             VESI
#> 40   215.12082   b4    b   4 2             VESI
#> 41   530.28205   b5    b   5 1            VESIT
#> 42   265.64466   b5    b   5 2            VESIT
#> 43   601.31916   b6    b   6 1           VESITA
#> 44   301.16322   b6    b   6 2           VESITA
#> 45   757.42027   b7    b   7 1          VESITAR
#> 46   379.21377   b7    b   7 2          VESITAR
#> 47   894.47918   b8    b   8 1         VESITARH
#> 48   447.74323   b8    b   8 2         VESITARH
#> 49   951.50064   b9    b   9 1        VESITARHG
#> 50   476.25396   b9    b   9 2        VESITARHG
#> 51  1080.54323  b10    b  10 1       VESITARHGE
#> 52   540.77525  b10    b  10 2       VESITARHGE
#> 53  1179.61164  b11    b  11 1      VESITARHGEV
#> 54   590.30946  b11    b  11 2      VESITARHGEV
#> 55  1292.69570  b12    b  12 1     VESITARHGEVL
#> 56   646.85149  b12    b  12 2     VESITARHGEVL
#> 57  1420.75428  b13    b  13 1    VESITARHGEVLQ
#> 58   710.88078  b13    b  13 2    VESITARHGEVLQ
#> 59  1533.83834  b14    b  14 1   VESITARHGEVLQL
#> 60   767.42281  b14    b  14 2   VESITARHGEVLQL
#> 61  1689.93945  b15    b  15 1  VESITARHGEVLQLR
#> 62   845.47336  b15    b  15 2  VESITARHGEVLQLR
#> 63  1786.99221  b16    b  16 1 VESITARHGEVLQLRP
#> 64   893.99974  b16    b  16 2 VESITARHGEVLQLRP
#> 65   117.10224   c1    c   1 1                V
#> 66    59.05476   c1    c   1 2                V
#> 67   246.14482   c2    c   2 1               VE
#> 68   123.57605   c2    c   2 2               VE
#> 69   333.17685   c3    c   3 1              VES
#> 70   167.09207   c3    c   3 2              VES
#> 71   446.26091   c4    c   4 1             VESI
#> 72   223.63410   c4    c   4 2             VESI
#> 73   547.30860   c5    c   5 1            VESIT
#> 74   274.15794   c5    c   5 2            VESIT
#> 75   618.34571   c6    c   6 1           VESITA
#> 76   309.67649   c6    c   6 2           VESITA
#> 77   774.44682   c7    c   7 1          VESITAR
#> 78   387.72705   c7    c   7 2          VESITAR
#> 79   911.50573   c8    c   8 1         VESITARH
#> 80   456.25650   c8    c   8 2         VESITARH
#> 81   968.52719   c9    c   9 1        VESITARHG
#> 82   484.76723   c9    c   9 2        VESITARHG
#> 83  1097.56977  c10    c  10 1       VESITARHGE
#> 84   549.28853  c10    c  10 2       VESITARHGE
#> 85  1196.63819  c11    c  11 1      VESITARHGEV
#> 86   598.82273  c11    c  11 2      VESITARHGEV
#> 87  1309.72224  c12    c  12 1     VESITARHGEVL
#> 88   655.36476  c12    c  12 2     VESITARHGEVL
#> 89  1437.78083  c13    c  13 1    VESITARHGEVLQ
#> 90   719.39405  c13    c  13 2    VESITARHGEVLQ
#> 91  1550.86488  c14    c  14 1   VESITARHGEVLQL
#> 92   775.93608  c14    c  14 2   VESITARHGEVLQL
#> 93  1706.96600  c15    c  15 1  VESITARHGEVLQLR
#> 94   853.98664  c15    c  15 2  VESITARHGEVLQLR
#> 95  1804.01876  c16    c  16 1 VESITARHGEVLQLRP
#> 96   902.51302  c16    c  16 2 VESITARHGEVLQLRP
#> 97   173.09207   x1    x   1 1                K
#> 98    87.04967   x1    x   1 2                K
#> 99   270.14483   x2    x   2 1               PK
#> 100  135.57605   x2    x   2 2               PK
#> 101  426.24594   x3    x   3 1              RPK
#> 102  213.62661   x3    x   3 2              RPK
#> 103  539.33000   x4    x   4 1             LRPK
#> 104  270.16864   x4    x   4 2             LRPK
#> 105  667.38858   x5    x   5 1            QLRPK
#> 106  334.19793   x5    x   5 2            QLRPK
#> 107  780.47264   x6    x   6 1           LQLRPK
#> 108  390.73996   x6    x   6 2           LQLRPK
#> 109  879.54105   x7    x   7 1          VLQLRPK
#> 110  440.27416   x7    x   7 2          VLQLRPK
#> 111 1008.58364   x8    x   8 1         EVLQLRPK
#> 112  504.79546   x8    x   8 2         EVLQLRPK
#> 113 1065.60510   x9    x   9 1        GEVLQLRPK
#> 114  533.30619   x9    x   9 2        GEVLQLRPK
#> 115 1202.66401  x10    x  10 1       HGEVLQLRPK
#> 116  601.83564  x10    x  10 2       HGEVLQLRPK
#> 117 1358.76512  x11    x  11 1      RHGEVLQLRPK
#> 118  679.88620  x11    x  11 2      RHGEVLQLRPK
#> 119 1429.80223  x12    x  12 1     ARHGEVLQLRPK
#> 120  715.40475  x12    x  12 2     ARHGEVLQLRPK
#> 121 1530.84991  x13    x  13 1    TARHGEVLQLRPK
#> 122  765.92859  x13    x  13 2    TARHGEVLQLRPK
#> 123 1643.93397  x14    x  14 1   ITARHGEVLQLRPK
#> 124  822.47062  x14    x  14 2   ITARHGEVLQLRPK
#> 125 1730.96600  x15    x  15 1  SITARHGEVLQLRPK
#> 126  865.98664  x15    x  15 2  SITARHGEVLQLRPK
#> 127 1860.00859  x16    x  16 1 ESITARHGEVLQLRPK
#> 128  930.50793  x16    x  16 2 ESITARHGEVLQLRPK
#> 129  147.11280   y1    y   1 1                K
#> 130   74.06004   y1    y   1 2                K
#> 131  244.16556   y2    y   2 1               PK
#> 132  122.58642   y2    y   2 2               PK
#> 133  400.26667   y3    y   3 1              RPK
#> 134  200.63697   y3    y   3 2              RPK
#> 135  513.35073   y4    y   4 1             LRPK
#> 136  257.17900   y4    y   4 2             LRPK
#> 137  641.40931   y5    y   5 1            QLRPK
#> 138  321.20829   y5    y   5 2            QLRPK
#> 139  754.49337   y6    y   6 1           LQLRPK
#> 140  377.75032   y6    y   6 2           LQLRPK
#> 141  853.56178   y7    y   7 1          VLQLRPK
#> 142  427.28453   y7    y   7 2          VLQLRPK
#> 143  982.60437   y8    y   8 1         EVLQLRPK
#> 144  491.80582   y8    y   8 2         EVLQLRPK
#> 145 1039.62583   y9    y   9 1        GEVLQLRPK
#> 146  520.31655   y9    y   9 2        GEVLQLRPK
#> 147 1176.68474  y10    y  10 1       HGEVLQLRPK
#> 148  588.84601  y10    y  10 2       HGEVLQLRPK
#> 149 1332.78585  y11    y  11 1      RHGEVLQLRPK
#> 150  666.89656  y11    y  11 2      RHGEVLQLRPK
#> 151 1403.82296  y12    y  12 1     ARHGEVLQLRPK
#> 152  702.41512  y12    y  12 2     ARHGEVLQLRPK
#> 153 1504.87064  y13    y  13 1    TARHGEVLQLRPK
#> 154  752.93896  y13    y  13 2    TARHGEVLQLRPK
#> 155 1617.95470  y14    y  14 1   ITARHGEVLQLRPK
#> 156  809.48099  y14    y  14 2   ITARHGEVLQLRPK
#> 157 1704.98673  y15    y  15 1  SITARHGEVLQLRPK
#> 158  852.99700  y15    y  15 2  SITARHGEVLQLRPK
#> 159 1834.02932  y16    y  16 1 ESITARHGEVLQLRPK
#> 160  917.51830  y16    y  16 2 ESITARHGEVLQLRPK
#> 161  130.08625   z1    z   1 1                K
#> 162   65.54676   z1    z   1 2                K
#> 163  227.13901   z2    z   2 1               PK
#> 164  114.07314   z2    z   2 2               PK
#> 165  383.24012   z3    z   3 1              RPK
#> 166  192.12370   z3    z   3 2              RPK
#> 167  496.32418   z4    z   4 1             LRPK
#> 168  248.66573   z4    z   4 2             LRPK
#> 169  624.38276   z5    z   5 1            QLRPK
#> 170  312.69502   z5    z   5 2            QLRPK
#> 171  737.46682   z6    z   6 1           LQLRPK
#> 172  369.23705   z6    z   6 2           LQLRPK
#> 173  836.53523   z7    z   7 1          VLQLRPK
#> 174  418.77125   z7    z   7 2          VLQLRPK
#> 175  965.57782   z8    z   8 1         EVLQLRPK
#> 176  483.29255   z8    z   8 2         EVLQLRPK
#> 177 1022.59928   z9    z   9 1        GEVLQLRPK
#> 178  511.80328   z9    z   9 2        GEVLQLRPK
#> 179 1159.65819  z10    z  10 1       HGEVLQLRPK
#> 180  580.33273  z10    z  10 2       HGEVLQLRPK
#> 181 1315.75930  z11    z  11 1      RHGEVLQLRPK
#> 182  658.38329  z11    z  11 2      RHGEVLQLRPK
#> 183 1386.79641  z12    z  12 1     ARHGEVLQLRPK
#> 184  693.90184  z12    z  12 2     ARHGEVLQLRPK
#> 185 1487.84409  z13    z  13 1    TARHGEVLQLRPK
#> 186  744.42568  z13    z  13 2    TARHGEVLQLRPK
#> 187 1600.92815  z14    z  14 1   ITARHGEVLQLRPK
#> 188  800.96771  z14    z  14 2   ITARHGEVLQLRPK
#> 189 1687.96018  z15    z  15 1  SITARHGEVLQLRPK
#> 190  844.48373  z15    z  15 2  SITARHGEVLQLRPK
#> 191 1817.00277  z16    z  16 1 ESITARHGEVLQLRPK
#> 192  909.00502  z16    z  16 2 ESITARHGEVLQLRPK
#> 193  383.22889  a4_   a_   4 1             VESI
#> 194  183.11280  a4_   a_   4 2             VESI
#> 195  484.27657  a5_   a_   5 1            VESIT
#> 196  233.63664  a5_   a_   5 2            VESIT
#> 197  555.31368  a6_   a_   6 1           VESITA
#> 198  269.15519  a6_   a_   6 2           VESITA
#> 199  711.41479  a7_   a_   7 1          VESITAR
#> 200  347.20575  a7_   a_   7 2          VESITAR
#> 201  848.47370  a8_   a_   8 1         VESITARH
#> 202  415.73520  a8_   a_   8 2         VESITARH
#> 203  905.49516  a9_   a_   9 1        VESITARHG
#> 204  444.24593  a9_   a_   9 2        VESITARHG
#> 205 1034.53775 a10_   a_  10 1       VESITARHGE
#> 206  508.76723 a10_   a_  10 2       VESITARHGE
#> 207 1133.60616 a11_   a_  11 1      VESITARHGEV
#> 208  558.30143 a11_   a_  11 2      VESITARHGEV
#> 209 1246.69022 a12_   a_  12 1     VESITARHGEVL
#> 210  614.84346 a12_   a_  12 2     VESITARHGEVL
#> 211 1374.74880 a13_   a_  13 1    VESITARHGEVLQ
#> 212  678.87275 a13_   a_  13 2    VESITARHGEVLQ
#> 213 1487.83286 a14_   a_  14 1   VESITARHGEVLQL
#> 214  735.41478 a14_   a_  14 2   VESITARHGEVLQL
#> 215 1643.93397 a15_   a_  15 1  VESITARHGEVLQLR
#> 216  813.46534 a15_   a_  15 2  VESITARHGEVLQLR
#> 217 1740.98673 a16_   a_  16 1 VESITARHGEVLQLRP
#> 218  861.99172 a16_   a_  16 2 VESITARHGEVLQLRP
#> 219  411.22380  b4_   b_   4 1             VESI
#> 220  197.11026  b4_   b_   4 2             VESI
#> 221  512.27148  b5_   b_   5 1            VESIT
#> 222  247.63410  b5_   b_   5 2            VESIT
#> 223  583.30859  b6_   b_   6 1           VESITA
#> 224  283.15265  b6_   b_   6 2           VESITA
#> 225  739.40970  b7_   b_   7 1          VESITAR
#> 226  361.20321  b7_   b_   7 2          VESITAR
#> 227  876.46861  b8_   b_   8 1         VESITARH
#> 228  429.73266  b8_   b_   8 2         VESITARH
#> 229  933.49007  b9_   b_   9 1        VESITARHG
#> 230  458.24339  b9_   b_   9 2        VESITARHG
#> 231 1062.53266 b10_   b_  10 1       VESITARHGE
#> 232  522.76469 b10_   b_  10 2       VESITARHGE
#> 233 1161.60107 b11_   b_  11 1      VESITARHGEV
#> 234  572.29889 b11_   b_  11 2      VESITARHGEV
#> 235 1274.68513 b12_   b_  12 1     VESITARHGEVL
#> 236  628.84092 b12_   b_  12 2     VESITARHGEVL
#> 237 1402.74371 b13_   b_  13 1    VESITARHGEVLQ
#> 238  692.87021 b13_   b_  13 2    VESITARHGEVLQ
#> 239 1515.82777 b14_   b_  14 1   VESITARHGEVLQL
#> 240  749.41224 b14_   b_  14 2   VESITARHGEVLQL
#> 241 1671.92888 b15_   b_  15 1  VESITARHGEVLQLR
#> 242  827.46280 b15_   b_  15 2  VESITARHGEVLQLR
#> 243 1768.98164 b16_   b_  16 1 VESITARHGEVLQLRP
#> 244  875.98918 b16_   b_  16 2 VESITARHGEVLQLRP
#> 245  428.25035  c4_   c_   4 1             VESI
#> 246  205.62353  c4_   c_   4 2             VESI
#> 247  529.29803  c5_   c_   5 1            VESIT
#> 248  256.14737  c5_   c_   5 2            VESIT
#> 249  600.33514  c6_   c_   6 1           VESITA
#> 250  291.66593  c6_   c_   6 2           VESITA
#> 251  756.43625  c7_   c_   7 1          VESITAR
#> 252  369.71648  c7_   c_   7 2          VESITAR
#> 253  893.49516  c8_   c_   8 1         VESITARH
#> 254  438.24594  c8_   c_   8 2         VESITARH
#> 255  950.51662  c9_   c_   9 1        VESITARHG
#> 256  466.75667  c9_   c_   9 2        VESITARHG
#> 257 1079.55921 c10_   c_  10 1       VESITARHGE
#> 258  531.27796 c10_   c_  10 2       VESITARHGE
#> 259 1178.62762 c11_   c_  11 1      VESITARHGEV
#> 260  580.81217 c11_   c_  11 2      VESITARHGEV
#> 261 1291.71168 c12_   c_  12 1     VESITARHGEVL
#> 262  637.35420 c12_   c_  12 2     VESITARHGEVL
#> 263 1419.77026 c13_   c_  13 1    VESITARHGEVLQ
#> 264  701.38349 c13_   c_  13 2    VESITARHGEVLQ
#> 265 1532.85432 c14_   c_  14 1   VESITARHGEVLQL
#> 266  757.92552 c14_   c_  14 2   VESITARHGEVLQL
#> 267 1688.95543 c15_   c_  15 1  VESITARHGEVLQLR
#> 268  835.97607 c15_   c_  15 2  VESITARHGEVLQLR
#> 269 1786.00819 c16_   c_  16 1 VESITARHGEVLQLRP
#> 270  884.50245 c16_   c_  16 2 VESITARHGEVLQLRP
#> 271  990.57307  x8_   x_   8 1         EVLQLRPK
#> 272  486.78489  x8_   x_   8 2         EVLQLRPK
#> 273 1625.92340 x14_   x_  14 1   ITARHGEVLQLRPK
#> 274  804.46006 x14_   x_  14 2   ITARHGEVLQLRPK
#> 275 1712.95543 x15_   x_  15 1  SITARHGEVLQLRPK
#> 276  847.97607 x15_   x_  15 2  SITARHGEVLQLRPK
#> 277 1841.99802 x16_   x_  16 1 ESITARHGEVLQLRPK
#> 278  912.49737 x16_   x_  16 2 ESITARHGEVLQLRPK
#> 279  964.59381  y8_   y_   8 1         EVLQLRPK
#> 280  473.79526  y8_   y_   8 2         EVLQLRPK
#> 281 1599.94414 y14_   y_  14 1   ITARHGEVLQLRPK
#> 282  791.47042 y14_   y_  14 2   ITARHGEVLQLRPK
#> 283 1686.97617 y15_   y_  15 1  SITARHGEVLQLRPK
#> 284  834.98644 y15_   y_  15 2  SITARHGEVLQLRPK
#> 285 1816.01876 y16_   y_  16 1 ESITARHGEVLQLRPK
#> 286  899.50773 y16_   y_  16 2 ESITARHGEVLQLRPK
#> 287  947.56726  z8_   z_   8 1         EVLQLRPK
#> 288  465.28198  z8_   z_   8 2         EVLQLRPK
#> 289 1582.91759 z14_   z_  14 1   ITARHGEVLQLRPK
#> 290  782.95715 z14_   z_  14 2   ITARHGEVLQLRPK
#> 291 1669.94962 z15_   z_  15 1  SITARHGEVLQLRPK
#> 292  826.47316 z15_   z_  15 2  SITARHGEVLQLRPK
#> 293 1798.99221 z16_   z_  16 1 ESITARHGEVLQLRPK
#> 294  890.99446 z16_   z_  16 2 ESITARHGEVLQLRPK
#> 295  155.08150  x1_   x_   1 1                K
#> 296   69.03911  x1_   x_   1 2                K
#> 297  252.13426  x2_   x_   2 1               PK
#> 298  117.56549  x2_   x_   2 2               PK
#> 299  408.23537  x3_   x_   3 1              RPK
#> 300  195.61604  x3_   x_   3 2              RPK
#> 301  521.31943  x4_   x_   4 1             LRPK
#> 302  252.15807  x4_   x_   4 2             LRPK
#> 303  649.37801  x5_   x_   5 1            QLRPK
#> 304  316.18736  x5_   x_   5 2            QLRPK
#> 305  762.46207  x6_   x_   6 1           LQLRPK
#> 306  372.72939  x6_   x_   6 2           LQLRPK
#> 307  861.53048  x7_   x_   7 1          VLQLRPK
#> 308  422.26360  x7_   x_   7 2          VLQLRPK
#> 309 1047.59453  x9_   x_   9 1        GEVLQLRPK
#> 310  515.29562  x9_   x_   9 2        GEVLQLRPK
#> 311 1184.65344 x10_   x_  10 1       HGEVLQLRPK
#> 312  583.82508 x10_   x_  10 2       HGEVLQLRPK
#> 313 1340.75455 x11_   x_  11 1      RHGEVLQLRPK
#> 314  661.87563 x11_   x_  11 2      RHGEVLQLRPK
#> 315 1411.79166 x12_   x_  12 1     ARHGEVLQLRPK
#> 316  697.39419 x12_   x_  12 2     ARHGEVLQLRPK
#> 317 1512.83934 x13_   x_  13 1    TARHGEVLQLRPK
#> 318  747.91803 x13_   x_  13 2    TARHGEVLQLRPK
#> 319  129.10224  y1_   y_   1 1                K
#> 320   56.04947  y1_   y_   1 2                K
#> 321  226.15500  y2_   y_   2 1               PK
#> 322  104.57585  y2_   y_   2 2               PK
#> 323  382.25611  y3_   y_   3 1              RPK
#> 324  182.62641  y3_   y_   3 2              RPK
#> 325  495.34017  y4_   y_   4 1             LRPK
#> 326  239.16844  y4_   y_   4 2             LRPK
#> 327  623.39875  y5_   y_   5 1            QLRPK
#> 328  303.19773  y5_   y_   5 2            QLRPK
#> 329  736.48281  y6_   y_   6 1           LQLRPK
#> 330  359.73976  y6_   y_   6 2           LQLRPK
#> 331  835.55122  y7_   y_   7 1          VLQLRPK
#> 332  409.27396  y7_   y_   7 2          VLQLRPK
#> 333 1021.61527  y9_   y_   9 1        GEVLQLRPK
#> 334  502.30599  y9_   y_   9 2        GEVLQLRPK
#> 335 1158.67418 y10_   y_  10 1       HGEVLQLRPK
#> 336  570.83544 y10_   y_  10 2       HGEVLQLRPK
#> 337 1314.77529 y11_   y_  11 1      RHGEVLQLRPK
#> 338  648.88600 y11_   y_  11 2      RHGEVLQLRPK
#> 339 1385.81240 y12_   y_  12 1     ARHGEVLQLRPK
#> 340  684.40455 y12_   y_  12 2     ARHGEVLQLRPK
#> 341 1486.86008 y13_   y_  13 1    TARHGEVLQLRPK
#> 342  734.92839 y13_   y_  13 2    TARHGEVLQLRPK
#> 343  112.07569  z1_   z_   1 1                K
#> 344   47.53620  z1_   z_   1 2                K
#> 345  209.12845  z2_   z_   2 1               PK
#> 346   96.06258  z2_   z_   2 2               PK
#> 347  365.22956  z3_   z_   3 1              RPK
#> 348  174.11313  z3_   z_   3 2              RPK
#> 349  478.31362  z4_   z_   4 1             LRPK
#> 350  230.65516  z4_   z_   4 2             LRPK
#> 351  606.37220  z5_   z_   5 1            QLRPK
#> 352  294.68445  z5_   z_   5 2            QLRPK
#> 353  719.45626  z6_   z_   6 1           LQLRPK
#> 354  351.22648  z6_   z_   6 2           LQLRPK
#> 355  818.52467  z7_   z_   7 1          VLQLRPK
#> 356  400.76069  z7_   z_   7 2          VLQLRPK
#> 357 1004.58872  z9_   z_   9 1        GEVLQLRPK
#> 358  493.79271  z9_   z_   9 2        GEVLQLRPK
#> 359 1141.64763 z10_   z_  10 1       HGEVLQLRPK
#> 360  562.32217 z10_   z_  10 2       HGEVLQLRPK
#> 361 1297.74874 z11_   z_  11 1      RHGEVLQLRPK
#> 362  640.37272 z11_   z_  11 2      RHGEVLQLRPK
#> 363 1368.78585 z12_   z_  12 1     ARHGEVLQLRPK
#> 364  675.89128 z12_   z_  12 2     ARHGEVLQLRPK
#> 365 1469.83353 z13_   z_  13 1    TARHGEVLQLRPK
#> 366  726.41512 z13_   z_  13 2    TARHGEVLQLRPK
#> 367  849.45771  a8*   a*   8 1         VESITARH
#> 368  416.71922  a8*   a*   8 2         VESITARH
#> 369  906.47917  a9*   a*   9 1        VESITARHG
#> 370  445.22995  a9*   a*   9 2        VESITARHG
#> 371 1035.52176 a10*   a*  10 1       VESITARHGE
#> 372  509.75124 a10*   a*  10 2       VESITARHGE
#> 373 1134.59017 a11*   a*  11 1      VESITARHGEV
#> 374  559.28545 a11*   a*  11 2      VESITARHGEV
#> 375 1247.67423 a12*   a*  12 1     VESITARHGEVL
#> 376  615.82748 a12*   a*  12 2     VESITARHGEVL
#> 377 1375.73281 a13*   a*  13 1    VESITARHGEVLQ
#> 378  679.85677 a13*   a*  13 2    VESITARHGEVLQ
#> 379 1488.81687 a14*   a*  14 1   VESITARHGEVLQL
#> 380  736.39880 a14*   a*  14 2   VESITARHGEVLQL
#> 381 1644.91798 a15*   a*  15 1  VESITARHGEVLQLR
#> 382  814.44935 a15*   a*  15 2  VESITARHGEVLQLR
#> 383 1741.97074 a16*   a*  16 1 VESITARHGEVLQLRP
#> 384  862.97573 a16*   a*  16 2 VESITARHGEVLQLRP
#> 385  877.45263  b8*   b*   8 1         VESITARH
#> 386  430.71668  b8*   b*   8 2         VESITARH
#> 387  934.47409  b9*   b*   9 1        VESITARHG
#> 388  459.22741  b9*   b*   9 2        VESITARHG
#> 389 1063.51668 b10*   b*  10 1       VESITARHGE
#> 390  523.74870 b10*   b*  10 2       VESITARHGE
#> 391 1162.58509 b11*   b*  11 1      VESITARHGEV
#> 392  573.28291 b11*   b*  11 2      VESITARHGEV
#> 393 1275.66915 b12*   b*  12 1     VESITARHGEVL
#> 394  629.82494 b12*   b*  12 2     VESITARHGEVL
#> 395 1403.72773 b13*   b*  13 1    VESITARHGEVLQ
#> 396  693.85423 b13*   b*  13 2    VESITARHGEVLQ
#> 397 1516.81179 b14*   b*  14 1   VESITARHGEVLQL
#> 398  750.39626 b14*   b*  14 2   VESITARHGEVLQL
#> 399 1672.91290 b15*   b*  15 1  VESITARHGEVLQLR
#> 400  828.44681 b15*   b*  15 2  VESITARHGEVLQLR
#> 401 1769.96566 b16*   b*  16 1 VESITARHGEVLQLRP
#> 402  876.97319 b16*   b*  16 2 VESITARHGEVLQLRP
#> 403  894.47918  c8*   c*   8 1         VESITARH
#> 404  439.22995  c8*   c*   8 2         VESITARH
#> 405  951.50064  c9*   c*   9 1        VESITARHG
#> 406  467.74068  c9*   c*   9 2        VESITARHG
#> 407 1080.54323 c10*   c*  10 1       VESITARHGE
#> 408  532.26198 c10*   c*  10 2       VESITARHGE
#> 409 1179.61164 c11*   c*  11 1      VESITARHGEV
#> 410  581.79618 c11*   c*  11 2      VESITARHGEV
#> 411 1292.69570 c12*   c*  12 1     VESITARHGEVL
#> 412  638.33821 c12*   c*  12 2     VESITARHGEVL
#> 413 1420.75428 c13*   c*  13 1    VESITARHGEVLQ
#> 414  702.36750 c13*   c*  13 2    VESITARHGEVLQ
#> 415 1533.83834 c14*   c*  14 1   VESITARHGEVLQL
#> 416  758.90953 c14*   c*  14 2   VESITARHGEVLQL
#> 417 1689.93945 c15*   c*  15 1  VESITARHGEVLQLR
#> 418  836.96009 c15*   c*  15 2  VESITARHGEVLQLR
#> 419 1786.99221 c16*   c*  16 1 VESITARHGEVLQLRP
#> 420  885.48647 c16*   c*  16 2 VESITARHGEVLQLRP
#> 421  522.30345  x4*   x*   4 1             LRPK
#> 422  253.14209  x4*   x*   4 2             LRPK
#> 423  650.36203  x5*   x*   5 1            QLRPK
#> 424  317.17138  x5*   x*   5 2            QLRPK
#> 425  763.44609  x6*   x*   6 1           LQLRPK
#> 426  373.71341  x6*   x*   6 2           LQLRPK
#> 427  862.51450  x7*   x*   7 1          VLQLRPK
#> 428  423.24761  x7*   x*   7 2          VLQLRPK
#> 429  991.55709  x8*   x*   8 1         EVLQLRPK
#> 430  487.76891  x8*   x*   8 2         EVLQLRPK
#> 431 1048.57855  x9*   x*   9 1        GEVLQLRPK
#> 432  516.27964  x9*   x*   9 2        GEVLQLRPK
#> 433 1185.63746 x10*   x*  10 1       HGEVLQLRPK
#> 434  584.80909 x10*   x*  10 2       HGEVLQLRPK
#> 435 1341.73857 x11*   x*  11 1      RHGEVLQLRPK
#> 436  662.85965 x11*   x*  11 2      RHGEVLQLRPK
#> 437 1412.77568 x12*   x*  12 1     ARHGEVLQLRPK
#> 438  698.37820 x12*   x*  12 2     ARHGEVLQLRPK
#> 439 1513.82336 x13*   x*  13 1    TARHGEVLQLRPK
#> 440  748.90204 x13*   x*  13 2    TARHGEVLQLRPK
#> 441 1626.90742 x14*   x*  14 1   ITARHGEVLQLRPK
#> 442  805.44407 x14*   x*  14 2   ITARHGEVLQLRPK
#> 443 1713.93945 x15*   x*  15 1  SITARHGEVLQLRPK
#> 444  848.96009 x15*   x*  15 2  SITARHGEVLQLRPK
#> 445 1842.98204 x16*   x*  16 1 ESITARHGEVLQLRPK
#> 446  913.48138 x16*   x*  16 2 ESITARHGEVLQLRPK
#> 447  496.32418  y4*   y*   4 1             LRPK
#> 448  240.15245  y4*   y*   4 2             LRPK
#> 449  624.38276  y5*   y*   5 1            QLRPK
#> 450  304.18174  y5*   y*   5 2            QLRPK
#> 451  737.46682  y6*   y*   6 1           LQLRPK
#> 452  360.72377  y6*   y*   6 2           LQLRPK
#> 453  836.53523  y7*   y*   7 1          VLQLRPK
#> 454  410.25798  y7*   y*   7 2          VLQLRPK
#> 455  965.57782  y8*   y*   8 1         EVLQLRPK
#> 456  474.77927  y8*   y*   8 2         EVLQLRPK
#> 457 1022.59928  y9*   y*   9 1        GEVLQLRPK
#> 458  503.29000  y9*   y*   9 2        GEVLQLRPK
#> 459 1159.65819 y10*   y*  10 1       HGEVLQLRPK
#> 460  571.81946 y10*   y*  10 2       HGEVLQLRPK
#> 461 1315.75930 y11*   y*  11 1      RHGEVLQLRPK
#> 462  649.87001 y11*   y*  11 2      RHGEVLQLRPK
#> 463 1386.79641 y12*   y*  12 1     ARHGEVLQLRPK
#> 464  685.38857 y12*   y*  12 2     ARHGEVLQLRPK
#> 465 1487.84409 y13*   y*  13 1    TARHGEVLQLRPK
#> 466  735.91241 y13*   y*  13 2    TARHGEVLQLRPK
#> 467 1600.92815 y14*   y*  14 1   ITARHGEVLQLRPK
#> 468  792.45444 y14*   y*  14 2   ITARHGEVLQLRPK
#> 469 1687.96018 y15*   y*  15 1  SITARHGEVLQLRPK
#> 470  835.97045 y15*   y*  15 2  SITARHGEVLQLRPK
#> 471 1817.00277 y16*   y*  16 1 ESITARHGEVLQLRPK
#> 472  900.49175 y16*   y*  16 2 ESITARHGEVLQLRPK
#> 473  479.29763  z4*   z*   4 1             LRPK
#> 474  231.63918  z4*   z*   4 2             LRPK
#> 475  607.35621  z5*   z*   5 1            QLRPK
#> 476  295.66847  z5*   z*   5 2            QLRPK
#> 477  720.44027  z6*   z*   6 1           LQLRPK
#> 478  352.21050  z6*   z*   6 2           LQLRPK
#> 479  819.50868  z7*   z*   7 1          VLQLRPK
#> 480  401.74471  z7*   z*   7 2          VLQLRPK
#> 481  948.55127  z8*   z*   8 1         EVLQLRPK
#> 482  466.26600  z8*   z*   8 2         EVLQLRPK
#> 483 1005.57273  z9*   z*   9 1        GEVLQLRPK
#> 484  494.77673  z9*   z*   9 2        GEVLQLRPK
#> 485 1142.63164 z10*   z*  10 1       HGEVLQLRPK
#> 486  563.30619 z10*   z*  10 2       HGEVLQLRPK
#> 487 1298.73275 z11*   z*  11 1      RHGEVLQLRPK
#> 488  641.35674 z11*   z*  11 2      RHGEVLQLRPK
#> 489 1369.76986 z12*   z*  12 1     ARHGEVLQLRPK
#> 490  676.87530 z12*   z*  12 2     ARHGEVLQLRPK
#> 491 1470.81754 z13*   z*  13 1    TARHGEVLQLRPK
#> 492  727.39914 z13*   z*  13 2    TARHGEVLQLRPK
#> 493 1583.90160 z14*   z*  14 1   ITARHGEVLQLRPK
#> 494  783.94117 z14*   z*  14 2   ITARHGEVLQLRPK
#> 495 1670.93363 z15*   z*  15 1  SITARHGEVLQLRPK
#> 496  827.45718 z15*   z*  15 2  SITARHGEVLQLRPK
#> 497 1799.97622 z16*   z*  16 1 ESITARHGEVLQLRPK
#> 498  891.97848 z16*   z*  16 2 ESITARHGEVLQLRPK

calculateFragments("VESITARHGEVLQLRPK", msexp[[1]])
#>          mz intensity  ion type pos z             seq       error
#> 1  429.2563 1972344.0   b4    b   4 1            VESI -0.02189010
#> 2  512.3044  684918.0  b5_   b_   5 1           VESIT -0.03290132
#> 3  513.3047 2574137.0   y4    y   4 1            LRPK  0.04598246
#> 4  583.3300 1440833.8  b6_   b_   6 1          VESITA -0.02142609
#> 5  754.4504  537234.8   y6    y   6 1          LQLRPK  0.04293155
#> 6  982.5354  500159.1   y8    y   8 1        EVLQLRPK  0.06897061
#> 7 1080.5867  209363.7  b10    b  10 1      VESITARHGE -0.04344392
#> 8 1688.0375  136748.8 y15*   y*  15 1 SITARHGEVLQLRPK -0.07729359

## neutral loss
defaultNeutralLoss()
#> $water
#> [1] "Cterm" "D"     "E"     "S"     "T"    
#> 
#> $ammonia
#> [1] "K" "N" "Q" "R"
#> 

## disable water loss on the C terminal
defaultNeutralLoss(disableWaterLoss="Cterm")
#> $water
#> [1] "D" "E" "S" "T"
#> 
#> $ammonia
#> [1] "K" "N" "Q" "R"
#> 

## real example
calculateFragments("PQR")
#>          mz ion type pos z seq
#> 1  98.06004  b1    b   1 1   P
#> 2 226.11862  b2    b   2 1  PQ
#> 3 175.11895  y1    y   1 1   R
#> 4 303.17753  y2    y   2 1  QR
#> 5 157.10839 y1_   y_   1 1   R
#> 6 285.16697 y2_   y_   2 1  QR
#> 7 286.15098 y2*   y*   2 1  QR
calculateFragments("PQR",
                   neutralLoss=defaultNeutralLoss(disableWaterLoss="Cterm"))
#>          mz ion type pos z seq
#> 1  98.06004  b1    b   1 1   P
#> 2 226.11862  b2    b   2 1  PQ
#> 3 175.11895  y1    y   1 1   R
#> 4 303.17753  y2    y   2 1  QR
#> 5 286.15098 y2*   y*   2 1  QR
calculateFragments("PQR",
                   neutralLoss=defaultNeutralLoss(disableAmmoniaLoss="Q"))
#>          mz ion type pos z seq
#> 1  98.06004  b1    b   1 1   P
#> 2 226.11862  b2    b   2 1  PQ
#> 3 175.11895  y1    y   1 1   R
#> 4 303.17753  y2    y   2 1  QR
#> 5 157.10839 y1_   y_   1 1   R
#> 6 285.16697 y2_   y_   2 1  QR

## disable neutral loss completely
calculateFragments("PQR", neutralLoss=NULL)
#>          mz ion type pos z seq
#> 1  98.06004  b1    b   1 1   P
#> 2 226.11862  b2    b   2 1  PQ
#> 3 175.11895  y1    y   1 1   R
#> 4 303.17753  y2    y   2 1  QR