-
Notifications
You must be signed in to change notification settings - Fork 0
Review MRPS7 #33
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?
Review MRPS7 #33
Conversation
return sum(amino_acid_weights.get(aa, 0) for aa in self._sequence) | ||
|
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.
Код не учитывает потерю воды при образовании аминокислотной цепи. Например,
water_mw = 18
for aa in list_input_seq:
total_mw = sum(aa_weight_dict[a] for a in list_input_seq)
mw_water_removed = (total_mw - (water_mw * (len(list_input_seq)-1)))
return mw_water_removed
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.
gc_count = sum(base in {'G', 'C'} for base in self._sequence) | ||
return gc_count / len(self._sequence) |
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.
Поскольку это абстрактный класс, то методов здесь не должно быть
raise ValueError("Invalid sequence for the given type.") | ||
self._sequence = sequence | ||
|
||
@abstractmethod |
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.
Насколько я понимаю, декоратор @abstract должен быть перед def init
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.
Да, тут вообще все методы должны быть абстрактными
valid_amino_acids = {'A', 'R', 'N', 'D', 'C', 'Q', 'E', 'G', 'H', 'I', | ||
'L', 'K', 'M', 'F', 'P', 'S', 'T', 'W', 'Y', 'V'} | ||
return all(amino_acid in valid_amino_acids for amino_acid in sequence) |
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.
Можно было добавить ситуацию когда подаются не заглавные буквы, например c помощью set:
unique_chars = set(seq)
single_letter = set('GALMFWKQESPVICYHRNDTgalmfwkqespvicyhrndt')
def is_valid(self, sequence: str) -> bool: | ||
return all(nucleotide in {'A', 'C', 'G', 'T'} for nucleotide in sequence) |
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.
То же самое про заглавные и строчные буквы, можно добавить такую проверку:
nucleotides_dna = set('ATGCatgc')
nucleotides_rna = set('AUGCaugc')
Review MRPS7