-
Notifications
You must be signed in to change notification settings - Fork 45
Hw4 chesnokova #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Hw4 chesnokova #25
Conversation
…o amino_acid_tools
Add new fuctions length, molecular weight, tree_letter_code, charge to amino_acid_tools
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Здорово!
Единственный важный момент -- по заданию нужно было все файлы поместить в HW4_...
Ну и по самому коду ... вот эта история, что есть 2 константы (например, а.к. и масса), которые соответствуют друг другу по индексу (CODE[0]
: MASS[0]
), вот это не оч хорошо.
В каких-то случаях это может быть неплохо, но здесь же лучше было бы использовать явный MAP (словарь). Что такой-то аминокислоте соответствует то-то.
А так молодцы!
if len(answer) == 1: | ||
return answer[0] | ||
else: | ||
return answer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if len(answer) == 1:
return answer[0]
return answer
MASSE = [71.08, 156.2, 114.1, 115.1, 103.1, 129.1, 128.1, 57.05, 137.1, 113.2, 113.2, 128.2, 131.2, 147.2, 97.12, 87.08, | ||
101.1, 186.2, 163.2, 99.13, 168.05, 255.3, | ||
71.08, 156.2, 114.1, 115.1, 103.1, 129.1, 128.1, 57.05, 137.1, 113.2, 113.2, 128.2, 131.2, 147.2, 97.12, 87.08, | ||
101.1, 186.2, 163.2, 99.13, 168.05, 255.3] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MASS
)))- Вот тут всё-таки лучше бы задать словарем, т.к. сейчас это просто последовательность чисел
d_mass = dict(zip(SHORT_CODE, MASSE)) | ||
m = 0 | ||
for acid in seq: | ||
m = m + d_mass[acid] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Есть такой оператор +=
))
Returns: | ||
(float) Molecular weight of tge given amino acid chain in Da | ||
""" | ||
d_mass = dict(zip(SHORT_CODE, MASSE)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ну вот вроде круто, но нет. Лучше все-таки в MASS положить словарь, где ключ -- аминокислота и значение -- масса
Returns: | ||
(str) translated in three-letter code | ||
""" | ||
d_names = dict(zip(SHORT_CODE, LONG_CODE)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
То же круто, но словарь опять же лучше ))0)0
return seq.translate(recording) | ||
|
||
|
||
def show_length(seq: str) -> int: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Почему show
? 0_0 ))
aminoacid_charge = {'R': 1, 'D': -1, 'E': -1, 'K': 1, 'O': 1, 'r': 1, 'd': -1, 'e': -1, 'k': 1, 'o': 1} | ||
charge = 0 | ||
for aminoacid in seq: | ||
if aminoacid in 'RDEKOrdeko': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Лучше if aminoacid in aminoacid_charge
. Просто если почему-то добавиться что-то в словарь, то нужно и тут в строке это добавлять
No description provided.