Skip to content

Bioinf_tools_were_made#1

Open
vladislavi27 wants to merge 2 commits into
mainfrom
tools_maker
Open

Bioinf_tools_were_made#1
vladislavi27 wants to merge 2 commits into
mainfrom
tools_maker

Conversation

@vladislavi27

Copy link
Copy Markdown
Owner

No description provided.

@nvaulin nvaulin left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Привет

Я там оставил комментарии по коду. В целом работа хорошая, где то мелочи типа неймингов и организации циклов.

Молодец!

10/10*0.5 = 5

Comment thread README.md
run_dna_rna_tools("ATGC", procedure='reverse_complement') # 'GCAT'

### run_fastq_filter
run_fastq_filter(gc_bounds=50)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Кажется тут этот пример не запустится, тут же нет данных:)

Comment thread basic_bioinf_tools.py
procedure, sequences = args[-1], args[:-1]
if procedure not in dna_rna_tools.PROCEDURES_DICT.keys():
raise ValueError("Wrong procedure")
rna_dna_tools_result_list = []

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Да просто было бы достаточно

Suggested change
rna_dna_tools_result_list = []
results = []

Comment thread basic_bioinf_tools.py
Comment on lines +11 to +15
for sequence in sequences:
dna_rna_tools.check_user_input(sequence)
rna_dna_tools_result_list.append(
dna_rna_tools.PROCEDURES_DICT[procedure](sequence)
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Вот это максимально питонично выглядит!

Comment thread basic_bioinf_tools.py
Comment on lines +6 to +7
def run_dna_rna_tools(*args):
procedure, sequences = args[-1], args[:-1]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Тут не хватает только докстринги

Comment thread basic_bioinf_tools.py
Comment on lines +22 to +67
def run_protein_tools(sequences: (str, tuple[str] or list[str]), **kwargs: str) -> dict:
"""
Process protein sequence by one of the developed tools.\n
Run one procedure at a time:
- Search for conserved amino acids residues in protein sequence
- Search for alternative frames in a protein sequences
- Convert protein sequences to RNA or DNA sequences
- Reverse the protein sequences from one-letter to three-letter format and vice-versa
- Define molecular weight of the protein sequences

All functions except *search_for_alt_frames* are letter case sensitive\n
If only one sequence provided - *sequences* can be string.\n
If more - please provide *sequences* as list or tuple.\n
Provide protein sequence in one letter code.\n
You can obtain one letter code from three letter code with *three_one_letter_code*\n
If more information needed please see README or desired docstring

Arguments:
- sequences (str, list[str] or tuple[str]): sequences to process
- procedure (str]: desired procedure:
- "search_for_motifs"
- "search_for_alt_frames"
- "convert_to_nucl_acids"
- "three_one_letter_code"
- "define_molecular_weight"

For "search_for_motif" procedure provide:
- motif (str): desired motif to check presense in every given sequence\n
Example: motif = "GA"
- overlapping (bool): count (True) or skip (False) overlapping matches. (Optional)\n
Example: overlapping = False

For "search_for_alt_frames" procedure provide:
- alt_start_aa (str): the name of an amino acid that is encoded by alternative start codon (Optional)\n
Example: alt_start_aa = "I"

For "convert_to_nucl_acids" procedure provide:
- nucl_acids (str): the nucleic acid to convert to\n
Example: nucl_acids = "RNA"\n
nucl_acids = "DNA"\n
nucl_acids = "both"

Return:
- dict: Dictionary with processed sequences. Depends on desired tool\n
Please see Readme or desired docstring
"""

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Аннотации и докумментация - крутейшие

@@ -0,0 +1,98 @@
def is_gc_in_range(sequence: str, gc_bounds: int or float or tuple(int or float)) -> bool:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

отличное название функции!

Comment on lines +17 to +23
gc_count = (
sequence.count("G")
+ sequence.count("C")
+ sequence.count("g")
+ sequence.count("c")
)
gc_percent = gc_count * 100 / len(sequence)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

С одной строны выглядит красиво, но с друой ты четырежды пробегаешь по строке, которую можно было бы обойти 1 раз. Но тогда да, это нужен был бы просто явный цикл с проверок буквы

Comment on lines +15 to +16
if isinstance(gc_bounds, int) or isinstance(gc_bounds, float):
gc_bounds = (0, gc_bounds)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

красота

Comment on lines +41 to +43
if isinstance(length_bounds, int):
length_bounds = (0, length_bounds)
return length_bounds[0] <= len(sequence) <= length_bounds[1]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍👍

Comment on lines +1 to +4
if __name__ == "__main__":
import dictionaries
else:
from bioinf_modules import dictionaries

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Хех, ты это из нашего обсуждения или сама нашла? Я не уверен кстати что так принято делать, но я сам не знаю как можно по другому. В любом случае молодец что разобралась с тем как это работает и всякое такое

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