Skip to content

Development#1

Open
nikavvv57 wants to merge 4 commits into
mainfrom
development
Open

Development#1
nikavvv57 wants to merge 4 commits into
mainfrom
development

Conversation

@nikavvv57

Copy link
Copy Markdown
Owner

modules, readme, main script for modules

@SidorinAnton SidorinAnton left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Красиво!
Единственное, название файла Nika_modules -- такое себе )))

Comment on lines +5 to +7
for nuc in seq:
if nuc not in dna_nucleotide_alphabet:
raise ValueError(f"{nuc} this is not a nucleotide in your sequence")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Имхо, эта проверка тут лишняя. К тому же в следующих функциях-фильтрах ты её не делаешь.
Такое имеет смысл выносить в отдельную функцию

@@ -0,0 +1,28 @@
dna_nucleotide_alphabet = {'A', 'T', 'G', 'C'}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это константа, поэтому капсом (DNA_NUCLEOTIDE_ALPHABET)

Comment on lines +1 to +50
single_letter_alphabet = {'G', 'A', 'V', 'L', 'I', 'M', 'P', 'F', 'W', 'S', 'T', 'N', 'Q', 'Y', 'C', 'K', 'R', 'H',
'D', 'E',
'g', 'a', 'v', 'l', 'i', 'm', 'p', 'f', 'w', 's', 't', 'n', 'q', 'y', 'c', 'k', 'r', 'h',
'd', 'e'}

three_letter_alphabet = {'GLY', 'ALA', 'VAL', 'LEU', 'ILE', 'MET', 'PRO', 'PHE', 'TRP', 'SER', 'THR', 'ASN', 'GLN',
'TYR', 'CYS', 'LYS', 'ARG', 'HIS', 'ASP', 'GLU',
'gly', 'ala', 'val', 'leu', 'ile', 'met', 'pro', 'phe', 'trp', 'ser', 'thr', 'asn', 'gln',
'tyr', 'cys', 'lys', 'arg', 'his', 'asp', 'glu',
}

amino_acid_weights = {
'A': 89, 'R': 174, 'N': 132, 'D': 133, 'C': 121,
'E': 147, 'Q': 146, 'G': 75, 'H': 155, 'I': 131,
'L': 131, 'K': 146, 'M': 149, 'F': 165, 'P': 115,
'S': 105, 'T': 119, 'W': 204, 'Y': 181, 'V': 117
}

most_frequent_codon_for_amino_acid_e_coli = {
'A': 'GCT', 'R': 'CGT', 'N': 'AAC', 'D': 'GAC', 'C': 'TGC',
'E': 'GAA', 'Q': 'CAG', 'G': 'GGC', 'H': 'CAC', 'I': 'ATC',
'L': 'CTG', 'K': 'AAA', 'M': 'ATG', 'F': 'TTC', 'P': 'CCG',
'S': 'TCT', 'T': 'ACC', 'W': 'TGG', 'Y': 'TAC', 'V': 'GTT',
'a': 'gct', 'r': 'cgt', 'n': 'aac', 'd': 'gac', 'c': 'tgc',
'e': 'gaa', 'q': 'cag', 'g': 'ggc', 'h': 'cac', 'i': 'atc',
'l': 'ctg', 'k': 'aaa', 'm': 'atg', 'f': 'ttc', 'p': 'ccg',
's': 'tct', 't': 'acc', 'w': 'tgg', 'y': 'tac', 'v': 'gtt'
}
dict_charge_acid = {
'negative_charge': ['E', 'D', 'e', 'd'],
'positive_charge': ['K', 'R', 'H', 'k', 'r', 'h'],
'neutral_charge': ['V', 'W', 'P', 'w', 'v', 'p', 'i', 'F', 'f', 'm', 'A',
'a', 'L', 'M', 'l', 'I', 'S', 's', 'T', 't', 'N', 'n',
'Q', 'q', 'C', 'c', 'Y', 'y', 'G', 'g']}

dict_class_acid = {
'hydrophilic': ['t', 'q', 'r', 's', 'y', 'd', 'e', 'g',
'c', 'n', 'h', 'k', 'T', 'Q', 'R', 'S',
'Y', 'D', 'E', 'G', 'C', 'N', 'H', 'K'],
'hydrophobic': ['V', 'W', 'P', 'w', 'v', 'p', 'i', 'F',
'f', 'm', 'A', 'a', 'L', 'M', 'l', 'I']}

aminoacid_dict = {
'GLY': 'G', 'ALA': 'A', 'VAL': 'V', 'LEU': 'L', 'ILE': 'I', 'MET': 'M',
'PRO': 'P', 'PHE': 'F', 'TRP': 'W', 'SER': 'S', 'THR': 'T', 'ASN': 'N', 'GLN': 'Q',
'TYR': 'Y', 'CYS': 'C', 'LYS': 'K', 'ARG': 'R', 'HIS': 'H', 'ASP': 'D', 'GLU': 'E',
'gly': 'g', 'ala': 'a', 'val': 'v', 'leu': 'l', 'ile': 'i', 'met': 'm',
'pro': 'p', 'phe': 'f', 'trp': 'w', 'ser': 's', 'thr': 't', 'asn': 'n', 'gln': 'q',
'tyr': 'y', 'cys': 'c', 'lys': 'k', 'arg': 'r', 'his': 'h', 'asp': 'd', 'glu': 'e',
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это всё константы, поэтому нужно капсом

:return: int
"""
sequence_upper = sequence.upper()
molecular_weight = sum(amino_acid_weights.get(aa, 0) for aa in sequence_upper)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Почему .get вместо []? )))

Comment on lines +121 to +130
if percent:
result_dict = {"Percentage of positive charged amino acids": (round((amount_positive * 100) / len(amino_seq))),
"Percentage of neutrally charged amino acids":
(round((amount_neutral * 100) / len(amino_seq))),
"Percentage of negative charged amino acids":
(round((amount_negative * 100) / len(amino_seq)))}
else:
result_dict = {"Positive charged amino acids": amount_positive,
"Neutrally charged amino acids": amount_neutral,
"Negative charged amino acids": amount_negative}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не оч хорошо, что возвращается словарь с разными ключами. Ты же скорее всего эту функцию будешь вызывать не только для отображения. Соответственно, в другой функции тебе нужно будет доставать значение по ключу

return gc_content_percent


def transcribe(sequence):

@SidorinAnton SidorinAnton Oct 30, 2023

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

потеряла типизацию ))

return rna_seq


def reverse(sequence):

@SidorinAnton SidorinAnton Oct 30, 2023

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

потеряла типизацию ))

return sequence[::-1]


def complement(sequence):

@SidorinAnton SidorinAnton Oct 30, 2023

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

потеряла типизацию ))

return complement_seq


def reverse_complement(sequence):

@SidorinAnton SidorinAnton Oct 30, 2023

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

потеряла типизацию ))

Comment on lines +57 to +58
dna_nucleotide_alphabet = {'A', 'T', 'G', 'C', 'a', 't', 'g', 'c'}
rna_nucleotide_alphabet = {'A', 'U', 'G', 'C', 'a', 'u', 'g', 'c'}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Константы ))
Нужно капсом + перенести наверх

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants