Source of file ModifiableSequenceTrait.php

Size: 7,700 Bytes - Last Modified: 2019-05-10T12:24:09+01:00

src/Core/ModifiableSequenceTrait.php

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
Covered by 10 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanValidiateGetSetValidSequence
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanValidiateGetSetInvalidSequence
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass3
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass4
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMassCharge
  • pgb_liv\php_ms\Test\Unit\ProteinTest::testCanRetrieveEntry
60
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanValidiateGetSetInvalidSequence
616263
Covered by 9 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanValidiateGetSetValidSequence
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass3
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass4
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMassCharge
  • pgb_liv\php_ms\Test\Unit\ProteinTest::testCanRetrieveEntry
64
Covered by 9 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanValidiateGetSetValidSequence
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass3
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass4
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMassCharge
  • pgb_liv\php_ms\Test\Unit\ProteinTest::testCanRetrieveEntry
656667686970717273
Covered by 3 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanValidiateGetSetValidSequence
  • pgb_liv\php_ms\Test\Unit\PeptideTest::testCanGetSequence
  • pgb_liv\php_ms\Test\Unit\ProteinTest::testCanRetrieveEntry
7475767778798081828384
Covered by 9 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass3
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass4
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testObjectCanGetSetValidModification
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testObjectCanGetSetValidModifications
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testObjectCanGetIsModified2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testObjectCanClearModifications
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testObjectCanRemoveModification
85
Covered by 9 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass3
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass4
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testObjectCanGetSetValidModification
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testObjectCanGetSetValidModifications
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testObjectCanGetIsModified2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testObjectCanClearModifications
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testObjectCanRemoveModification
86878889909192939495
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testObjectCanGetSetValidModifications
96
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testObjectCanGetSetValidModifications
97
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testObjectCanGetSetValidModifications
98
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testObjectCanGetSetValidModifications
99100101102103104105106107
Covered by 3 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testObjectCanGetSetValidModification
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testObjectCanGetSetValidModifications
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testObjectCanRemoveModification
108109110111112113114115
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testObjectCanClearModifications
116
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testObjectCanClearModifications
117118119120121122123
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testObjectCanRemoveModification
124
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testObjectCanRemoveModification
125
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testObjectCanRemoveModification
126127128
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testObjectCanRemoveModification
129
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testObjectCanRemoveModification
130
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testObjectCanRemoveModification
131132133134135136137138139
Covered by 3 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testObjectCanGetIsModified1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testObjectCanGetIsModified2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testObjectCanClearModifications
140141142143144145146147148149150
Covered by 2 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanValidiateGetSetIsDecoy
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanValidiateGetSetIsDecoyInvalid
151
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanValidiateGetSetIsDecoyInvalid
152153154
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanValidiateGetSetIsDecoy
155
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanValidiateGetSetIsDecoy
156157158159160161162163164
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanValidiateGetSetIsDecoy
165166167168169170171172173174
Covered by 2 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanValidiateGetSetValidSequence
  • pgb_liv\php_ms\Test\Unit\PeptideTest::testCanGetSequence
175176177178179180181182183184185186187188189190191192193194195
Covered by 7 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass3
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass4
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMassCharge
196197
Covered by 7 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass3
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass4
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMassCharge
198199
Covered by 7 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass3
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass4
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMassCharge
200201
Covered by 7 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass3
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass4
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMassCharge
202
Covered by 7 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass3
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass4
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMassCharge
203
Covered by 7 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass3
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass4
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMassCharge
204
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMass2
205
Covered by 6 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass3
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass4
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMassCharge
206
Covered by 6 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass3
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass4
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMassCharge
207
Covered by 6 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass3
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass4
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMassCharge
208
Covered by 6 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass3
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass4
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMassCharge
209
Covered by 7 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass3
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass4
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMassCharge
210211212213
Covered by 7 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass3
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass4
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMassCharge
214
Covered by 4 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass3
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass4
215
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass1
216
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass1
217218219
Covered by 3 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass3
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass4
220
Covered by 3 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass3
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass4
221
Covered by 3 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass3
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass4
222223224
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass3
225
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass3
226
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass3
227
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass3
228229
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass3
230231
Covered by 2 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass4
232
Covered by 2 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass4
233234235
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass4
236
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass4
237
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass4
238
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass4
239240
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass4
241242
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass2
243
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass2
244
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass2
245
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass2
246
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass2
247
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass2
248
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass2
249
Covered by 3 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass3
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass4
250
Covered by 7 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass3
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass4
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMassCharge
251252
Covered by 7 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass1
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass2
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass3
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetModifiedMass4
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMassCharge
253254255256257258259260261262263264
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMassCharge
265
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMassCharge
266267
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ModifiableSequenceTraitTest::testCanGetMassCharge
268269270271272273274275276277278
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ProteinTest::testCanRetrieveEntry
279
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ProteinTest::testCanRetrieveEntry
280281
<?php
/**
 * Copyright 2018 University of Liverpool
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace pgb_liv\php_ms\Core;

use pgb_liv\php_ms\Constant\PhysicalConstants;
use pgb_liv\php_ms\Constant\ChemicalConstants;

/**
 * Trait for providing access to a sequence and set of modifications
 *
 * @author Andrew Collins
 */
trait ModifiableSequenceTrait
{

    /**
     * The amino-acid sequence that can be modified
     *
     * @var string
     */
    private $sequence;

    /**
     * Array of modifications on this protein sequence
     *
     * @var Modification[]
     */
    private $modifications = array();

    /**
     * Sets whether this sequence is a decoy or not
     *
     * @var bool
     */
    private $isDecoy;

    /**
     * Sets the sequence for this object
     *
     * @param string $sequence
     *            The amino-acid sequence to set
     */
    public function setSequence($sequence)
    {
        if (preg_match('/^[A-Z]+$/', $sequence) !== 1) {
            throw new \InvalidArgumentException('Argument 1 must be a valid peptide sequence.');
        }

        $this->sequence = $sequence;
    }

    /**
     * Gets the sequence for this object
     *
     * @return string
     */
    public function getSequence()
    {
        return $this->sequence;
    }

    /**
     * Adds the specified modification to this protein
     *
     * @param Modification $modification
     *            Modification object to apply
     */
    public function addModification(Modification $modification)
    {
        $this->modifications[] = $modification;
    }

    /**
     * Adds the specified modifications to this protein
     *
     * @param array $modifications
     *            Modifications to apply
     */
    public function addModifications(array $modifications)
    {
        foreach ($modifications as $modification) {
            $this->addModification($modification);
        }
    }

    /**
     * Gets the modifications
     *
     * @return Modification[]
     */
    public function getModifications()
    {
        return $this->modifications;
    }

    /**
     * Clears the modifications
     */
    public function clearModifications()
    {
        $this->modifications = array();
    }

    /**
     * Remove a modification
     */
    public function removeModification(Modification $searchModification)
    {
        foreach ($this->modifications as $key => $modification) {
            if ($modification !== $searchModification) {
                continue;
            }

            unset($this->modifications[$key]);
        }
    }

    /**
     * Returns whether this protein contains modifications or not
     *
     * @return boolean True if the object contains modifications
     */
    public function isModified()
    {
        return count($this->modifications) != 0;
    }

    /**
     * Sets whether this sequence is a decoy sequence
     *
     * @param bool $bool
     *            Value to set to
     */
    public function setIsDecoy($bool)
    {
        if (! is_bool($bool)) {
            throw new \InvalidArgumentException('Argument 1 must be a boolean value');
        }

        $this->isDecoy = $bool;
    }

    /**
     * Gets whether this sequence is a decoy sequence
     *
     * @return boolean
     */
    public function isDecoy()
    {
        return $this->isDecoy;
    }

    /**
     * Gets the length of the sequence in this object
     *
     * @return int
     */
    public function getLength()
    {
        return strlen($this->getSequence());
    }

    /**
     * Gets the theoretical monoisotopic neutral mass for this sequence and it's modifications
     *
     * @return float The neutral mass of the sequence
     * @deprecated Use getMonoisotopicMass() directly
     */
    public function getMass()
    {
        return $this->getMonoisotopicMass();
    }

    /**
     * Gets the theoretical monoisotopic neutral mass for this sequence and it's modifications
     *
     * @return float The neutral mass of the sequence
     */
    public function getMonoisotopicMass()
    {
        $acids = str_split($this->getSequence(), 1);

        $mass = ChemicalConstants::HYDROGEN_MASS + ChemicalConstants::HYDROGEN_MASS + ChemicalConstants::OXYGEN_MASS;

        foreach ($acids as $acid) {
            switch ($acid) {
                case 'X':
                case 'B':
                case 'Z':
                    continue;
                default:
                    $mass += AminoAcidMono::getMonoisotopicMass($acid);
                    break;
            }
        }

        // Add modification mass
        // Catch modification on position, residue or terminus
        foreach ($this->getModifications() as $modification) {
            if (! is_null($modification->getLocation())) {
                $mass += $modification->getMonoisotopicMass();
                continue;
            }

            switch ($modification->getPosition()) {
                case Modification::POSITION_NTERM:
                case Modification::POSITION_PROTEIN_NTERM:
                    // TODO: Handle protein level safely
                    // A peptide can be both at protein n-term and not since multiple proteins supported
                    $nTerm = $this->sequence[0];
                    if (in_array($nTerm, $modification->getResidues())) {
                        $mass += $modification->getMonoisotopicMass();
                    }

                    break;

                case Modification::POSITION_CTERM:
                case Modification::POSITION_PROTEIN_CTERM:
                    // TODO: Handle protein level safely
                    // A peptide can be both at protein n-term and not since multiple proteins supported
                    $cTerm = $this->sequence[strlen($this->sequence) - 1];
                    if (in_array($cTerm, $modification->getResidues())) {
                        $mass += $modification->getMonoisotopicMass();
                    }

                    break;

                default:
                    foreach ($acids as $acid) {
                        if (in_array($acid, $modification->getResidues())) {
                            $mass += $modification->getMonoisotopicMass();
                        }
                    }
                    break;
            }
        }

        return $mass;
    }

    /**
     * Calculates the theoretical mass/charge value for this sequence.
     * Note: To get the experimental value, check the PrecursorIon data that this peptide might be a child of.
     *
     * @param int $charge
     *            The charge value to use for the calculation
     */
    public function getMonoisotopicMassCharge($charge)
    {
        $massCharge = $this->getMonoisotopicMass();
        $massCharge += PhysicalConstants::PROTON_MASS * $charge;

        return $massCharge / $charge;
    }

    /**
     * Reverses the current sequence.
     * Suitable for creating decoy sequences
     *
     * @todo This method does not yet respect modification absolute location data
     */
    public function reverseSequence()
    {
        $this->sequence = strrev($this->sequence);
    }
}