Given a linear peptide $$p$$ and a spectrum $$s$$, we define ScoreL($$p$$, $$s$$) as the number of masses shared between the theoretical spectrum of peptide $$p$$ and the spectrum $$s$$. As an example, if
$$s$$ = {0, 99, 113, 114, 128, 227, 257, 299, 355, 356, 370, 371, 484}
then
ScoreL(NQEL, $$s$$) = 8
The scoring function should take into account the multiplicities of shared masses, i.e., how many times they occur in each spectrum. For example, suppose that $$s$$ is the theoretical spectrum of the linear peptide NQEL. For this spectrum, mass 242 has multiplicity 2. If 242 has multiplicity 1 in the theoretical spectrum of linear peptide $$p$$, then 242 contributes 1 to ScoreL($$p$$, $$s$$). If 242 has larger multiplicity in the theoretical spectrum of $$p$$, then 242 contributes 2 to ScoreL($$p$$, $$s$$).
Write a function score that takes a linear peptide $$p$$ and a spectrum $$s$$. The function must return the score of linear peptide $$p$$ against spectrum $$s$$: ScoreL($$p$$, $$s$$).
>>> score('NQEL', (0, 99, 113, 114, 128, 227, 257, 299, 355, 356, 370, 371, 484)) 8 >>> score('ICWTVCKDKSMGGNAGIWLRYYKQRKPYWTFSDKWFQR', (0, 57, 57, 57, 71, 87, 97, ..., 4640, 4683, 4796)) 274 >>> score('SFCKGRRWSQQECKVWHRVAGNELVTREESIFAILLII', (0, 57, 57, 71, 71, 87, 87, ..., 4168, 4194, 4281)) 229