-
Notifications
You must be signed in to change notification settings - Fork 0
Hw 18 #4
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?
Conversation
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.
Алиса, добрый день!
1. Рефакторинг
Readme и в целом репозиторий весьма опрятные.
Разве что примеры в ноутбуке было бы здорово снадбить пояснениями.
К коду есть ряд претензий: не везде проаннтированы типы, кое-где форматирование поехало, импорты не в правильном порядке; для последнего советую настроить и использовать isort или ruff. Тут -3б
Ещё -1б из-за неточного содержания requirements.txt
11/15
2. Лес
-1б за усложнение/дублирование кода: лучше запускать pool с одним потоком вместо отдельного if-а.
В остальном всё здорово!
24/25
3. Тесты
Тут всё хорошо, только на 2 меньше чем просили в задании, поэтому 8.4/10 баллов.
Итого у вас 43.4/50 за это дз, хорошая работа!
Успехов с защитой в ИБ и в дальнейшей карьере!
| To install fast_seqs tools you need to clone the git repository using the following command: | ||
| ```bash | ||
| git clone git@github.com:Alisa411/fast_seqs.git \ | ||
| cd fast_seqs |
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.
этого недостаточно чтоб заработало - нужно ещё зависимости через pip поставить
| import requests | ||
| import os | ||
| import sys | ||
| import io | ||
| import datetime | ||
| from abc import ABC, abstractmethod | ||
| from dataclasses import dataclass | ||
| from random import choice | ||
| from Bio import SeqIO | ||
| from Bio.SeqUtils import gc_fraction | ||
| from bs4 import BeautifulSoup |
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.
| import requests | |
| import os | |
| import sys | |
| import io | |
| import datetime | |
| from abc import ABC, abstractmethod | |
| from dataclasses import dataclass | |
| from random import choice | |
| from Bio import SeqIO | |
| from Bio.SeqUtils import gc_fraction | |
| from bs4 import BeautifulSoup | |
| import datetime | |
| import io | |
| import os | |
| import sys | |
| from abc import ABC, abstractmethod | |
| from dataclasses import dataclass | |
| from random import choice | |
| import requests | |
| from Bio import SeqIO | |
| from Bio.SeqUtils import gc_fraction | |
| from bs4 import BeautifulSoup |
| Methods: | ||
| __len__(): Returns the length of the biological sequence. | ||
| __getitem__(index): Gets the character at the specified index or returns a subsequence. | ||
| __str__(): Returns a string representation of the biological sequence. |
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.
в целом эти дандеры можно наверное было особо не комментировать, они делают плюс-минус то, что от них всегда ожидается (особенно это касается __str__)
| gc_count = sum(base in 'GCgc' for base in self.sequence) | ||
| total_count = len(self.sequence) | ||
| gc_content = gc_count / total_count if total_count > 0 else 0 | ||
| return gc_content * 100 if as_percentage else gc_content |
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.
в этих классах не хватает type hint-ов
|
|
||
| def transcribe(self): | ||
| transcribed_seq = ''.join(self.TRANSCRIBE_DICT.get(base, base) for base in self.sequence) | ||
| return transcribed_seq |
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.
дело вкуса, но я бы сразу return делал без временной переменной
к слову, прикольное использование второго аргумента в dict.get !
| results = [self._fit_tree(arg) for arg in args] | ||
| else: | ||
| with Pool(n_jobs) as pool: | ||
| results = pool.map(self._fit_tree, args) |
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-ать, Pool при n_jobs == 1 должен корректно отрабатывать
| args = [(tree, feat_ids, X) for tree, feat_ids in zip(self.trees, self.feat_ids_by_tree)] | ||
| with Pool(n_jobs) as pool: | ||
| results = pool.map(self._predict_proba_tree, args) | ||
| probas = np.sum(results, axis=0) |
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-а визуально прям сильно усложняет код
| n_jobs = self.n_jobs if n_jobs is None else n_jobs | ||
| probas = self.predict_proba(X, n_jobs) | ||
| predictions = np.argmax(probas, axis=1) | ||
| return predictions |
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.
в этом файле не достаёт аннтотаций типов
| urllib3==2.2.1 | ||
|
|
||
|
|
||
|
|
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.
пустые строки ни к чему
и вроде бы здесь много лишнего (кажется, вы не используете pandas или scipy)
| url = "http://argonaute.mit.edu/cgi-bin/genscanw_py.cgi" | ||
| response = requests.post(url) | ||
|
|
||
| assert response.status_code == 200 No newline at end of file |
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.
здесь либо переименовать тест (мол что он что именно доступность сервера проверяет), либо использовать ту же самую (глобальную) переменную , которая используется в run_genscan
потому из того, что в тесте вы захордкодили правильную ссылку, не обязательно следует, что в другом месте вы захардкодили тоже правильную ссылку)
No description provided.