-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
complete remodeling of the Application with dna generation working on…
… the UI all all other features working under the hood
- Loading branch information
Showing
9 changed files
with
298 additions
and
62 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,113 @@ | ||
|
||
|
||
from random import randint | ||
class DNA(): | ||
chain= "" | ||
|
||
# read from fasta file | ||
def __init__(self, path: str): | ||
pass | ||
|
||
# this metaclass is here to implement getters | ||
# and setters for these static variables | ||
|
||
class __metaclass__(): | ||
@property | ||
def dna_chain(cls): | ||
return cls._dna_chain | ||
|
||
@dna_chain.setter | ||
def dna_chain(cls, value): | ||
cls._dna_chain = value | ||
|
||
@property | ||
def rna_chain(cls): | ||
return cls._rna_chain | ||
|
||
@rna_chain.setter | ||
def rna_chain(cls, value): | ||
cls._rna_chain = value | ||
|
||
@property | ||
def protein_chain(cls): | ||
return cls._protein_chain | ||
|
||
@protein_chain.setter | ||
def protein_chain(cls, value): | ||
cls._protein_chain = value | ||
|
||
@property | ||
def dna_complement(cls): | ||
return cls._dna_complement | ||
|
||
@dna_complement.setter | ||
def dna_complement(cls, value): | ||
cls._dna_complement = value | ||
|
||
@property | ||
def gc_rate(cls): | ||
return cls._gc_rate | ||
|
||
@gc_rate.setter | ||
def gc_rate(cls, value): | ||
cls._gc_rate = value | ||
|
||
_dna_chain= "" | ||
_rna_chain = "" | ||
_protein_chain = "" | ||
_dna_complement = "" | ||
_gc_rate = 0 | ||
|
||
|
||
|
||
# generate DNA Sequence from length | ||
def __init__(slef, length: int): | ||
pass | ||
@classmethod | ||
def generate_dna(cls,length: int): | ||
ADN = '' | ||
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): | ||
cls.rna_chain = cls.dna_chain.replace("T", "U") | ||
|
||
@classmethod | ||
def rna_to_prot(cls): | ||
from .rna_to_acid import RNA_to_acido_dic | ||
rna = cls.rna_chain | ||
index = 0 | ||
l = [] | ||
while index <= len(rna)-1: | ||
if(len(rna[index:index+3]) == 3): | ||
l.append(RNA_to_acido_dic[rna[index:index+3]]) | ||
|
||
index += 3 | ||
prot='' | ||
print(l) | ||
for ele in l: | ||
prot += ele+' ' | ||
cls.protein_chain = prot | ||
|
||
@classmethod | ||
def get_dna_complement(cls): | ||
adn = cls.dna_chain | ||
dna_comp='' | ||
for i in range(len(adn)): | ||
if adn[i] == 'A': | ||
dna_comp += 'T' | ||
elif adn[i] == 'T': | ||
dna_comp += 'A' | ||
elif adn[i] == 'C': | ||
dna_comp += 'G' | ||
elif adn[i] == 'G': | ||
dna_comp += 'C' | ||
dna_comp=dna_comp[::-1] | ||
|
||
cls.dna_complement = dna_comp | ||
|
||
@classmethod | ||
def taux_gc(cls): | ||
adn = cls.dna_chain | ||
gc= int((adn.count("C")+adn.count("G")) / len(adn) * 100) | ||
cls.gc_rate=gc | ||
|
||
|
||
DNA.generate_dna(15) | ||
DNA.translate_to_rna() | ||
print(DNA.rna_chain) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
|
||
RNA_to_acido_dic = {'UUU': 'Phe', | ||
'UCU': 'Ser', | ||
'UAU': 'Tyr', | ||
'UGU': 'Cys', | ||
'UUC': 'Phe', | ||
'UCC': 'Ser', | ||
'UAC': 'Tyr', | ||
'UGC': 'Cys', | ||
'UUA': 'Leu', | ||
'UCA': 'Ser', | ||
'UAA': '---', | ||
'UGA': '---', | ||
'UUG': 'Leu', | ||
'UCG': 'Ser', | ||
'UAG': '---', | ||
'UGG': 'Trp', | ||
'CUU': 'Leu', | ||
'CCU': 'Pro', | ||
'CAU': 'His', | ||
'CGU': 'Arg', | ||
'CUC': 'Leu', | ||
'CCC': 'Pro', | ||
'CAC': 'His', | ||
'CGC': 'Arg', | ||
'CUA': 'Leu', | ||
'CCA': 'Pro', | ||
'CAA': 'Gln', | ||
'CGA': 'Arg', | ||
'CUG': 'Leu', | ||
'CCG': 'Pro', | ||
'CAG': 'Gln', | ||
'CGG': 'Arg', | ||
'AUU': 'Ile', | ||
'ACU': 'Thr', | ||
'AAU': 'Asn', | ||
'AGU': 'Ser', | ||
'AUC': 'Ile', | ||
'ACC': 'Thr', | ||
'AAC': 'Asn', | ||
'AGC': 'Ser', | ||
'AUA': 'Ile', | ||
'ACA': 'Thr', | ||
'AAA': 'Lys', | ||
'AGA': 'Arg', | ||
'AUG': 'Met', | ||
'ACG': 'Thr', | ||
'AAG': 'Lys', | ||
'AGG': 'Arg', | ||
'GUU': 'Val', | ||
'GCU': 'Ala', | ||
'GAU': 'Asp', | ||
'GGU': 'Gly', | ||
'GUC': 'Val', | ||
'GCC': 'Ala', | ||
'GAC': 'Asp', | ||
'GGC': 'Gly', | ||
'GUA': 'Val', | ||
'GCA': 'Ala', | ||
'GAA': 'Glu', | ||
'GGA': 'Gly', | ||
'GUG': 'Val', | ||
'GCG': 'Ala', | ||
'GAG': 'Glu', | ||
'GGG': 'Gly'} |
Oops, something went wrong.