def calcMass(self): ''' This function calculate mass from three character aminoacids sequence notation. ''' result = 0 codon = "" for char in range(len(self.sequence)): codon += self.sequence[char] if char % 3 == 2: for three, mass in mass_dict( os.path.join(os.getcwd(), "docs/baseMass.def")).items(): if three == codon: result += mass codon = "" return round(result, 2)
def calcMass(self): ''' This function calculate mass from one character aminoacid sequence notation. ''' result = 0 for char in self.sequence: for amino, letter in acronyms( os.path.join(os.getcwd(), "docs/three.def")).items(): for sign in letter: if sign == char: codon = amino for three, mass in mass_dict( os.path.join(os.getcwd(), "docs/baseMass.def")).items(): if three == codon: result += mass return round(result, 2)
def setUp(self): self.fake_mass_dict = mass_dict(os.path.join(os.getcwd(), "docs/baseMass.def"))