Skip to content

Commit

Permalink
merged protein_mass calculation.
Browse files Browse the repository at this point in the history
 the integration caused a keyerror issue
  • Loading branch information
adelbke committed Mar 19, 2021
1 parent 803e1ed commit c757dd7
Show file tree
Hide file tree
Showing 14 changed files with 227 additions and 540 deletions.
Binary file modified projetsysteme/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file added projetsysteme/__pycache__/acid_mass.cpython-38.pyc
Binary file not shown.
Binary file modified projetsysteme/__pycache__/components.cpython-38.pyc
Binary file not shown.
Binary file modified projetsysteme/__pycache__/dna.cpython-38.pyc
Binary file not shown.
Binary file modified projetsysteme/__pycache__/main.cpython-38.pyc
Binary file not shown.
Binary file modified projetsysteme/__pycache__/rna_to_acid.cpython-38.pyc
Binary file not shown.
Binary file modified projetsysteme/__pycache__/settings.cpython-38.pyc
Binary file not shown.
Binary file modified projetsysteme/__pycache__/views.cpython-38.pyc
Binary file not shown.
42 changes: 42 additions & 0 deletions projetsysteme/acid_mass.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
mass_amino_acid = {'A': 71.03711,
'C': 103.00919,
'D': 115.02694,
'E': 129.04259,
'F': 147.06841,
'G': 57.02146,
'H': 137.05891,
'I': 113.08406,
'K': 128.09496,
'L': 113.04049,
'M': 131.04049,
'N': 114.04293,
'P': 97.05276,
'Q': 128.05858,
'R': 156.10111,
'S': 87.03203,
'T': 101.04768,
'V': 99.06841,
'W': 186.07931,
'Y': 163.06333,
'Z': 0}
amino_acid_abr = {'Ala': 'A',
'Cys': 'C',
'Asp': 'D',
'Glu': 'E',
'Phe': 'F',
'Gly': 'G',
'His': 'H',
'Ile': 'I',
'Lys': 'K',
'Leu': 'L',
'Met': 'M',
'Asn': 'N',
'Pro': 'P',
'Gln': 'Q',
'Arg': 'R',
'Ser': 'S',
'Thr': 'T',
'Val': 'V',
'Trp': 'W',
'Tyr': 'Y',
'---': 'Z'}
9 changes: 8 additions & 1 deletion projetsysteme/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def __init__(self, *args, **kwargs):
self.btn_comp_inv_adn.clicked.connect(self.action_comp_inv_adn)
self.btn_taux_gc_adn.clicked.connect(self.action_taux_gc_adn)
self.btn_freq_codons_adn.clicked.connect(self.action_freq_codons_adn)
self.btn_masse_proteique.clicked.connect(self.action_masse_proteique)


def action_creer_adn(self):
Expand Down Expand Up @@ -103,6 +104,11 @@ def action_freq_codons_adn(self):
DNA.taux_codons()
MainLayout._instance.output_codon_frequency.setText(str(DNA.codon_frequency))

def action_masse_proteique(self):
DNA.masse()
MainLayout._instance.output_protein_mass.setText(str(DNA.protein_mass))
pass

def setupButtons(self):
# setup buttons list
self.buttons = [
Expand Down Expand Up @@ -140,7 +146,8 @@ def __init__(self, *args, **kwargs):
('Proteine','protein_chain',chain_width),
('Comp Inv','dna_complement',chain_width),
('Taux GC','taux_gc',4),
('Fréquence Codons','codon_frequency',4)
('Fréquence Codons','codon_frequency',40),
('Masse Protéique','protein_mass',10)
]
for element in elements:
label = QLabel(element[0])
Expand Down
24 changes: 23 additions & 1 deletion projetsysteme/dna.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class DNA():
dna_complement = ""
gc_rate = 0
codon_frequency=0
protein_mass = 0



Expand All @@ -21,7 +22,6 @@ def generate_dna(cls,length: int):
for i in range(0,length):
ADN+='ACGT'[randint(0,3)]
cls.dna_chain = ADN
return cls.dna_chain

@classmethod
def translate_to_rna(cls):
Expand Down Expand Up @@ -76,6 +76,28 @@ def taux_codons(cls):
if index+3 < len(rna) and RNA_to_acido_dic[rna[index:index+3]] != "---":
freq= freq+1
cls.codon_frequency = freq

@classmethod
def masse(cls):
from .acid_mass import amino_acid_abr, mass_amino_acid
if (len(cls.protein_chain)>0):
index = 0
l = []
while index <= len(cls.protein_chain)-1:
if(len(cls.protein_chain[index:index+3]) == 3):
l.append(amino_acid_abr[cls.protein_chain[index:index+3]])

index += 3
prot_abr = ""
for ele in l:
prot_abr += ele
mass = 0
for x in prot_abr:
mass+=mass_amino_acid[x]
cls.protein_mass = mass
# print(cls.MASSE)
# else:
# cls.show_popup("vous devez creer le Proteine")



Expand Down
Loading

0 comments on commit c757dd7

Please sign in to comment.