Skip to content

Hw4 chesnokova#25

Open
anisssum wants to merge 10 commits into
Python-BI-2023:mainfrom
anisssum:HW4_Chesnokova
Open

Hw4 chesnokova#25
anisssum wants to merge 10 commits into
Python-BI-2023:mainfrom
anisssum:HW4_Chesnokova

Conversation

@anisssum
Copy link
Copy Markdown

@anisssum anisssum commented Oct 1, 2023

No description provided.

Copy link
Copy Markdown

@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
Copy link
Copy Markdown

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]
Copy link
Copy Markdown

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]
Copy link
Copy Markdown

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))
Copy link
Copy Markdown

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

return seq.translate(recording)


def show_length(seq: str) -> int:
Copy link
Copy Markdown

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':
Copy link
Copy Markdown

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