-
Notifications
You must be signed in to change notification settings - Fork 0
Hw5 modules #1
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?
Hw5 modules #1
Conversation
| import protein_dict as prd | ||
| from random import choice |
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.
Вот тут все супер, protein_dict лежит в той же директории. что и программа, все импортируется, красота
| seq = seq.upper() | ||
| sequence = "".join(prd.AA_ONE_TO_THREE_LETTER[aa] for aa in seq) | ||
| return sequence[:-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.
Тоже нет улучшения, но при этом в словаре "-" в конце каждой а\к отсутствует, получается, от последней а\к будет откусываться буква?...
| @@ -0,0 +1,95 @@ | |||
| # Import dna_rna_dict.py containing dictionaries for working with dna and rna sequences | |||
| import dna_rna_dict as drd | |||
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.
Вот тут все тоже сработает, тк словарь лежит в той же директории. что и программа, все импортируется
| action = args[-1].lower() | ||
| sequences = args[:-1] | ||
| results = [] |
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.
ой, а где улучшение кода (не критично)
| """ | ||
| total_offset = 0 | ||
| for char in quality_string: | ||
| offset = ord(char) - 33 # Assuming 33 as the default encoding offset |
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 not isinstance(gc_bounds, tuple): | ||
| gc_bounds = (0, gc_bounds) | ||
|
|
||
| if not isinstance(length_bounds, tuple): | ||
| length_bounds = (0, length_bounds) |
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 not all(letter in drd.DNA_LETTERS for letter in sequence): | ||
| print(f"Skipping non-fastq sequence: {seq_name}") | ||
| continue |
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.
Хорошая проверка! В целом, когда потом будет туда подгружать fastq-файлы, она не столь обязательна (но можно оставить), вообще хорошая идея проверять все и вся
| print(filtered_seqs) | ||
|
|
||
| return filtered_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.
Ой, а зачем нам и выводить, и возвращать? В задании же только вернуть словарь надо
| from data_processing_scripts.dna_rna_tools import main_dna_rna_tools | ||
| from data_processing_scripts.das_protein_tools import main_protein_tools | ||
| from data_processing_scripts.fastq_tools import main_fastq_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.
импорты корректные, даже после отделены двумя пустыми строками. все по PEP8, здорово
А вот дальше когда вызываются функции, то они обращаются к словарям и пытаются их импортировать. а в этой папке словарей нет, и все падает
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.
То есть сюда же нужно прописать импорт словарей? Или же словари поднять на директорию выше, где лежит скрипт вызова функций?
| result = main_dna_rna_tools("ATcg", "reverse") | ||
| print(result) | ||
|
|
||
| # Call the main_protein_tools function with the necessary arguments. | ||
| result = main_protein_tools("ACDE", "protein_mass") | ||
| print(result) | ||
|
|
||
| # Call the main_fastq_tools function with the necessary arguments. | ||
| EXAMPLE_FASTQ = { | ||
| '@SRX079804:1:SRR292678:1:1101:21885:21885': ( | ||
| 'ACAGCAACATAAACATGATGGGATGGCGTAAGCCCCCGAGATATCAGTTTACCCAGGATAAGAGATTAAATTATGAGCAACATTATTAA', | ||
| 'FGGGFGGGFGGGFGDFGCEBB@CCDFDDFFFFBFFGFGEFDFFFF;D@DD>C@DDGGGDFGDGG?GFGFEGFGGEF@FDGGGFGFBGGD'), | ||
| } | ||
| filtered_sequences = main_fastq_tools( | ||
| seqs=EXAMPLE_FASTQ, | ||
| gc_bounds=(0, 80), # GC content от 40% до 60% | ||
| length_bounds=(10, 100), # Длина последовательности от 10 до 100 | ||
| quality_threshold=0 # Порог качества | ||
| ) | ||
|
|
||
| print(filtered_sequences) |
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.
Но даже если бы не падало - пользователь при запуске скрипта сразу получит... Выводы тестовых запусков? Зачем?
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.
Это было скорее для примера работы, чтобы при проверке посмотреть. Как это лучше оформить?
|
Комментарии:
Итог:
Бонусы и штрафы:
Итог: 6.4 |
No description provided.