Skip to content

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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Conversation

anisssum
Copy link

@anisssum anisssum commented Oct 1, 2023

No description provided.

Copy link

@SidorinAnton SidorinAnton left a 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 (словарь). Что такой-то аминокислоте соответствует то-то.

А так молодцы!

Comment on lines +159 to +162
if len(answer) == 1:
return answer[0]
else:
return answer

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

Comment on lines +7 to +10
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]

Choose a reason for hiding this comment

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

  1. MASS )))
  2. Вот тут всё-таки лучше бы задать словарем, т.к. сейчас это просто последовательность чисел

d_mass = dict(zip(SHORT_CODE, MASSE))
m = 0
for acid in seq:
m = m + d_mass[acid]

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))

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))

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:

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':

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. Просто если почему-то добавиться что-то в словарь, то нужно и тут в строке это добавлять

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.

3 participants