Conversation
ailiskab-hub
left a comment
There was a problem hiding this comment.
Хорошая работа, все выполнено четко)
| min_gc_bound = 0 | ||
| max_gc_bound = gc_bounds | ||
| else: | ||
| return print("Incorrect gc_bounds input") |
There was a problem hiding this comment.
Круто, что учли момент с вводом не числа
There was a problem hiding this comment.
Но return print кажется это что-то странное... Что он вернёт?
| elif isinstance(index, (list, tuple)) and len(index) == 2: | ||
| return self.seq[index[0]:index[1]] | ||
|
|
||
| def __str__(self): |
There was a problem hiding this comment.
Мне кажется, неплохо было бы использовать repr
There was a problem hiding this comment.
Обрати внимане - у тебя маркдаун распознал __ как обозначение жирного текста. Чтобы было как ты хотела - надо ставить штрихи с двух сторон (они на букве ё) - так будет отображено как код
| return gc_fraction(self.seq) | ||
|
|
||
|
|
||
| class DNASequence(NucleicAcidSequence): |
There was a problem hiding this comment.
было бы неплохо провести проверку на то что последовательность является ДНК
greenbergM
left a comment
There was a problem hiding this comment.
Работа аккуратная, код понятный!) Но все таки, мне кажется, с наследованием у аминокислотных последовательностей можно было реализовать больше
| max_len_bound = length_bounds | ||
| else: | ||
| return print("Incorrect length_bounds input") | ||
|
|
There was a problem hiding this comment.
Очень подробная проверка, но немного громоздко. Мне кажется хватило бы просто проверки на то, что вводится одно число - тогда можно было бы на основе него создать новый тюпл и обращаться к нему по его элементам.
| max_len_bound = length_bounds[1] | ||
| elif type(length_bounds) is tuple and len(length_bounds) == 0: | ||
| min_len_bound = 0 | ||
| max_len_bound = 2**32 |
There was a problem hiding this comment.
В шапке функции уже же есть значения по умолчанию...
| seq_quality = sum(record.letter_annotations["phred_quality"]) / len(record) | ||
|
|
||
| if (min_len_bound <= seq_length <= max_len_bound) and (min_gc_bound <= seq_gc_content <= max_gc_bound) and (seq_quality >= quality_threshold): | ||
| filtered_dict_key.append(record) |
| with open(output_filename, 'w') as output_handle: | ||
| SeqIO.write(filtered_dict_key, output_handle, 'fastq') | ||
|
|
||
| print(f"Filtered FastQ sequences saved to '{output_filename}'") |
There was a problem hiding this comment.
Мелочь, а приятно, что выводит это)
| return str(self.seq) | ||
|
|
||
| def check_alphabet(self): | ||
| return set(str(self.seq)) <= set("ACGTUacgtu") |
There was a problem hiding this comment.
Не учитывает аминокислотные последовательности, хотя они от этого класса наследуются!
| else: | ||
| using_dict = DNA_COMPLEMENT | ||
| for nucl in self.seq: | ||
| complement_seq.append(using_dict[nucl]) |
There was a problem hiding this comment.
Классно сделана проверка на тип нуклеиновой кислоты!
Review UBC