Skip to content

Commit

Permalink
#91 Doco changes while exploring code
Browse files Browse the repository at this point in the history
  • Loading branch information
weka511 committed May 1, 2024
1 parent e5c786c commit 24f459d
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def bfs(adj,paths = [[(0,'')]]):

def linearSpectrum(peptide):
'''
This is a hack to make the test pass (otherwise other tests dpending on spectrum.linearSpectrum fail
This is a hack to make the test pass (otherwise other tests depending on spectrum.linearSpectrum fail
'''
def get_pairs():
return [(i,j) for i in range(len(peptide)) for j in range(len(peptide)+1) if i<j]
Expand Down Expand Up @@ -140,32 +140,32 @@ def create_extended():

def CreatePeptideVector(peptide):
'''
CreatePeptideVector
Convert a Peptide into a Peptide Vector
BA11C Convert a Peptide into a Peptide Vector
Convert a peptide into a binary peptide vector.
Convert a peptide into a binary peptide vector.
Given an amino acid string Peptide = a1 . . . an of length n, we will represent its
prefix masses using a binary peptide vector Peptide' with mass(Peptide) coordinates.
This vector contains a 1 at each of the n prefix coordinates
Given an amino acid string Peptide = a1 . . . an of length n, we will represent its
prefix masses using a binary peptide vector Peptide' with mass(Peptide) coordinates.
This vector contains a 1 at each of the n prefix coordinates
mass(a1), mass(a1 a2), . . . , mass(a1 a2 . . . an ),
and it contains a 0 in each of the remaining noise coordinates.
mass(a1), mass(a1 a2), . . . , mass(a1 a2 . . . an ) ,
and it contains a 0 in each of the remaining noise coordinates.
Input: A peptide P.
Parameters:
peptide
Return: The peptide vector of P.
Returns:
The peptide vector of P.
Note: In this chapter, all dataset problems implicitly use the standard integer-valued mass
table for the regular twenty amino acids. Examples sometimes use imaginary amino
acids X and Z having respective integer masses 4 and 5.
Note: In this chapter, all dataset problems implicitly use the standard integer-valued mass
table for the regular twenty amino acids. Examples sometimes use imaginary amino
acids X and Z having respective integer masses 4 and 5.
'''
extended_masses = create_extended()
masses = [extended_masses[p] for p in peptide]
result = []
for m in masses:
result = result + ([0]*(m-1))
result = result + [0]*(m-1)
result.append(1)
return result

Expand Down

0 comments on commit 24f459d

Please sign in to comment.