Conversation
SidorinAnton
left a comment
There was a problem hiding this comment.
В целом неплохо!
Насчет всяких скриптов. Такое лучше бы было разнести по папкам. Например, в папку examples поместить все example файлы. В папку scripts -- скрипты итд
Насчет readlines. В целом это может работать, но если файл очень большой, то мы можем упасть с ошибкой типа MemoryError.
Так что всё-таки надежнее читать файлы (особенно биоинформатические) построчно ))
There was a problem hiding this comment.
Это можно было не добавлять в репу )))
There was a problem hiding this comment.
Это можно было не добавлять в репу )))
| if line.startswith('@'): | ||
| seq_id = line | ||
| id_seq.append(seq_id) |
There was a problem hiding this comment.
У тебя так может начинаться и 4 строка с качеством
| elif line.startswith('+'): | ||
| pass |
| 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.
Не оч понимаю, а почему у тебя 2 функции filter_fastq_sequences (тут и в bioinf_script.py)?
Причем к тому же и по-разному написанные ))
|
|
||
| def change_fasta_start_pos(input_fasta, shift, output_fasta): | ||
| with open(input_fasta, 'r') as input_file: | ||
| lines = input_file.readlines() |
There was a problem hiding this comment.
Не оч хорошо, т.к. если файл очень большой, то можем упасть с ошибкой ))
Лучше делать итерацию по строкам
| sequences = [] | ||
| index=[] | ||
| with open(input_file, 'r') as file: | ||
| lines = file.readlines() |
There was a problem hiding this comment.
Не оч хорошо, т.к. если файл очень большой, то можем упасть с ошибкой ))
Лучше делать итерацию по строкам
No description provided.