Conversation
There was a problem hiding this comment.
В целом неплохо, но есть странности ))
- нет типизации
- не везде есть докстринги
- очень странно с функцией filter_fastq_sequences, которая реализована в 2х местах (причем в файле
bioinf_script.pyона не работает и явно хуже той, что в файлеall_functions/fastq_filtration_tools.py)
А так молодец! Продолжай в том же духе ))
| weight_amino = [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.
Тут лучше словарь, где в качестве ключей идут аминоксилоты
| 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] | ||
|
|
||
| import random |
| d_names = dict(zip(short_code, long_code)) | ||
| recording = sequence.maketrans(d_names) | ||
| return sequence.translate(recording) | ||
| else: |
| recording = sequence.maketrans(d_names) | ||
| return sequence.translate(recording) | ||
| else: | ||
| len = int(input("введите желаемую длину: ")) |
| else: | ||
| len = int(input("введите желаемую длину: ")) | ||
| bases = list(amino_acid) | ||
| amino_sequencqe = ''.join(random.choice(bases) for i in range(len)) | ||
| d_names = dict(zip(short_code, long_code)) | ||
| recording = amino_sequencqe.maketrans(d_names) | ||
| return "рандомная последовательнсть", amino_sequencqe, amino_sequencqe.translate(recording) |
There was a problem hiding this comment.
Имхо, эта часть лишняя. Если нужно нагенерировать рандомную последовательность, можно просто сделать для этого другую функцию (которая как раз будет принимать длину в параметрах, а не через input)
| from all_functions.fastq_filtration_tools import filter_fastq_sequences | ||
|
|
||
| def filter_fastq_sequences(seqs, gc_bounds=(0, 100), length_bounds=(0, 2**32), quality_threshold=0): |
There was a problem hiding this comment.
0_0 )))
У тебя же уже есть эта функция (вот ты её выше импортируешь). Зачем еще одна, которая к тому же написана хуже
| def filter_fastq_sequences(seqs, gc_bounds=(0, 100), length_bounds=(0, 2**32), quality_threshold=0): | ||
| filtered_seqs = {} | ||
|
|
||
| for name, (sequence, quality) in seqs.items(): | ||
| gc_content = calculate_gc_content(sequence) | ||
| seq_length = len(sequence) | ||
| avg_quality = calculate_avg_quality(quality) | ||
|
|
||
| if is_within_bounds(gc_content, gc_bounds) and is_within_bounds(seq_length, length_bounds) and avg_quality >= quality_threshold: | ||
| filtered_seqs[name] = (sequence, quality) | ||
|
|
||
| return filtered_seqs |
There was a problem hiding this comment.
А почему это не в файле bioinf_script.py?
|
|
||
| for seq_name, (sequence, quality) in seqs.items(): | ||
| # Фильтрация по GC составу | ||
| gc_content = calculate_gc_content(sequence) |
There was a problem hiding this comment.
Ты же не импортируешь calculate_gc_content 0_0
| continue | ||
|
|
||
| # Фильтрация по качеству | ||
| average_quality = calculate_average_quality(quality) |
There was a problem hiding this comment.
Ты же не импортируешь calculate_average_quality 0_0
| amino_acid = 'ARNDCEQGHILKMFPSTWYVUOarndceqghilkmfpstwyvuo' | ||
| short_code = list(amino_acid) | ||
| long_code = ['Ala', 'Arg', 'Asn', 'Asp', 'Cys', 'Glu', 'Gln', 'Gly', 'His', 'Ile', 'Leu', 'Lys', 'Met', 'Phe', 'Pro', | ||
| 'Ser', 'Thr', 'Trp', 'Tyr', 'Val', 'Sec', 'Pyl', | ||
| 'Ala', 'Arg', 'Asn', 'Asp', 'Cys', 'Glu', 'Gln', 'Gly', 'His', 'Ile', 'Leu', 'Lys', 'Met', 'Phe', 'Pro', | ||
| 'Ser', 'Thr', 'Trp', 'Tyr', 'Val', 'Sec', 'Pyl'] | ||
| codon_table = { |
There was a problem hiding this comment.
Это все константы, поэтому нужно капсом:
AMINO_ACIDS, SHORT_CODE...
No description provided.