Skip to content

Hw5#2

Open
dadaist2001 wants to merge 5 commits intohw4from
hw5
Open

Hw5#2
dadaist2001 wants to merge 5 commits intohw4from
hw5

Conversation

@dadaist2001
Copy link
Owner

Added FASTQ reading and file processing functions

Copy link

@eksytnik eksytnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Хорошая работа! Есть мелочи, которые не добиты в самых сложных функциях, постаралась расписать логику, как это можно исправить и в чём конкретно возникли ошибки. Но в целом здорово, проделана отличная работа.

По мелочи по оформлению: уж очень минималистичный ридми, не везде хватает аннотаций типов, докстринги не все соответствуют функциям.

Распределение баллов:

Добработка FASTQ-модуля : 15 баллов + 5 доп баллов за реализацию фильтрации.

Часть B: за каждую из двух функций (из трех предложенных)

convert_multiline_fasta_to_oneline: 35 баллов

parse_blast_output: 30 баллов
Результат в итоге не корректный, но очень разумное направление мысли и реализации.

Третья функция была не обязательна, но она также большей частью реализована - 7 доп баллов.

Обновление ридми: 8 баллов (уж очень минималистично, без версий, и упоминание функций для fastq пропало).

Общее: -5б за чтение всего файла разом.

Итоговые баллы за задание: 83 + 12 дополнительно.

Comment on lines +15 to +16
if output_fasta is None:
output_fasta = "converted_" + input_fasta.split("/")[-1]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да, хороший способ справиться. Единственное что на свой вкус я бы подписала как "oneline" или еще с каким-то более явным указанием на то, что конвертед то.

output_fasta (str, optional): path for the converted file.

Returns:
str: path to the converted FASTA file.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Неправда, не возвращает такое.

results = []

with open(input_file, "r") as f:
lines = f.readlines()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Для файлов BLAST это может быть большим объемом, не стоить загружать их целиком в память.

None
"""

results = []

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Список вместо множества. Возможны дубликаты при нескольких QUERY с одинаковым топ-хитом.

if i + 1 < len(lines):
next_line = lines[i + 1].strip()
if next_line:
results.append(next_line)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В задании нужен только Description, а тут добавится полная строка, в которой есть и другие вещи (даже если исправить комментарий выше).

if line.startswith("/gene="):
gene = line.split('"')[1]
elif line.startswith("/translation="):
translation = line.split('"')[1]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А в таком формате потеряется всегда, потому что в строке просто не будет закрывающей кавычки.

translation = ""

for line in all_lines:
line = line.rstrip()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rstrip это rights strip, он не удалит отступы слева и строка никогда не будет начинаться с того, что ищется дальше.

mode = "w" if overwrite else "a"

return filtered
with open(output_fastq, mode) as out:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Она принимает из главной фунции сиквенсы на запись и output_fastq, и сохраняет отфильтрованные данные в папку filtered (ее может и не быть) по имени output_fastq.

Не реализована часть задания. Совсем для красоты было бы еще проверить, output_fastq уже .fastq или нет, но это так.

seq = f.readline().rstrip()
f.readline() # plus line
qual = f.readline().rstrip()
yield name[1:], seq, qual # remove '@' from name

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 лайк что тут не чтение всего сразу, хорошая реализация.


# BioToolkit

This is a small bioinformatics toolkit for working with DNA and RNA sequences be dadaist2001.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This is a small bioinformatics toolkit for working with DNA and RNA sequences be dadaist2001.
This is a small bioinformatics toolkit for working with DNA and RNA sequences by dadaist2001.

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.

2 participants