-
Notifications
You must be signed in to change notification settings - Fork 0
Final hw python bi #4
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
Open
CaptnClementine
wants to merge
91
commits into
main
Choose a base branch
from
final_hw_python_bi
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
91 commits
Select commit
Hold shift + click to select a range
607a749
Create filter_dna_utils.py
CaptnClementine d279d38
Add 'is_dna' function to check input sequence
CaptnClementine 2165478
Add 'count_gc_content' function
CaptnClementine a934e0c
Add 'is_in_gc_bounds' function to check sequence threshold
CaptnClementine 85f43f7
Add 'is_in_length_bounds' function to check sequence threshold
CaptnClementine d3a3456
Add 'check_quality' function to check sequence threshold
CaptnClementine 547e14e
Create gene_code_main_operations
CaptnClementine 44a9be2
Add 'filter_dna' to filter sequences by GC-content, length and quality
CaptnClementine 499b0e9
Create amino_analyzer_utils.py
CaptnClementine 7a35ab5
Add 'is_aa' function to check if a sequence contains only amino acids
CaptnClementine 5349b7f
Add 'choose_weight' function to choose the weight type
CaptnClementine e5d408b
Add 'aa_weight' function to calculate the protein weight
CaptnClementine f142af3
Add 'count_hydroaffinity' function to count it in protein sequence
CaptnClementine 1d0610c
Add 'peptide_cutter' to identifies cleavage sites for "trypsin" and "…
CaptnClementine 17859ad
Add 'one_to_three_letter_code' function to convert protein sequence
CaptnClementine 8e2e973
Add 'sulphur_containing_aa_counter' function
CaptnClementine 8b2a489
Add 'run_amino_analyzer' function to analyse protein sequence in one-…
CaptnClementine 167f505
Create dna_rna_tools_utils.py
CaptnClementine 9690bbd
Add 'is_dna' function to check if a sequence is DNA
CaptnClementine 9cacb05
Add 'is_rna' function to check if a sequence is RNA
CaptnClementine 11d5112
Add 'reverse' function to reverse a sequence
CaptnClementine bed0dcc
Add 'complement' function to find complement of sequence
CaptnClementine e40468c
Add 'reverse_complement' function to find reverse complement sequence
CaptnClementine d9dbaa8
Add 'reverse_transcription' function to reverse transcription of RNA
CaptnClementine 0a64a42
Add 'type_rna_or_dna' function to detect type of sequence
CaptnClementine 8855e07
Add 'has_start_codon' function to check if RNA has start codon
CaptnClementine 1af134a
Add 'is_palindrome' function to check if a sequence is a palindrome
CaptnClementine 49e1d63
Add 'transcribe' function to transcribe a DNA sequence into RNA
CaptnClementine a95b168
Add 'run_dna_rna_tools' function to make various opertaions with DNA/RNA
CaptnClementine 40b9e86
Update README.md
CaptnClementine 94751f3
Correct bounds in 'filter_dna' function
CaptnClementine 6172210
Correct bounds in GC and length filter functions
CaptnClementine f412a04
Update README.md to correct bounds descrition in 'filter_dna' function
CaptnClementine a06d117
Update README.md
CaptnClementine 5f682c4
Add typing library
CaptnClementine 7c5ab39
Add 'read_fastq_file' to read fastq from file
CaptnClementine c0f0e82
Add 'write_filtered_fastq' to write the file
CaptnClementine 5a984df
Change 'filter_dna' to read-write fastq file
CaptnClementine 01c1dd5
Add file-option description of 'filter_dna'
CaptnClementine 54de4ee
Create bio_files_processor.py and the directory for it
CaptnClementine 3ef1ba8
Add 'convert_multiline_fasta_to_oneline' function
CaptnClementine 777f05b
Add 'select_genes_from_gbk_to_fasta' function
CaptnClementine 5da5b65
Add 'change_fasta_start_pos' function to shift the start position
CaptnClementine 565bf3c
Add 'parse_blast_output' function to search and extract sequence id
CaptnClementine 3018829
Create README.md
CaptnClementine f053940
Create 'example_fasta_for_convert_multiline_fasta_to_oneline.fasta'
CaptnClementine 88e034d
Create example_for_change_fasta_start_pos
CaptnClementine 7c591a7
Create 'example_for_select_genes_from_gbk_to_fasta'
CaptnClementine 423d95d
Rename example_for_change_fasta_start_pos to example_for_change_fasta…
CaptnClementine bc5297f
Create example_for_parse_blast_output
CaptnClementine ed69608
Update 'dna_rna_tools_utils.py' for better PEP8-style
CaptnClementine 560242d
Update 'amino_analyzer_utils.py' to improve PEP8 style
CaptnClementine e820d51
Update 'filter_dna_utils.py' for better PEP8 style
CaptnClementine 0394377
Add float type for gc_bound in 'gene_code_main_operations' function
CaptnClementine 5368bb3
Update 'filter_dna' function to write output file in directory
CaptnClementine 96e99a7
Rename gene_code_main_operations to gene_code_main_operations.py
CaptnClementine 3279f69
Update gene_code_utils/filter_dna_utils.py
CaptnClementine 879cc4e
Delete gene_code_utils directory
CaptnClementine cd34610
Delete gene_code_utils functions
CaptnClementine b9a0cd4
Add filter_dna with biopyhton functions
CaptnClementine f5ec4da
Add BiologicalSequence class and subclasses
CaptnClementine 0228482
Add NotImplementedError
CaptnClementine e00b9b2
Add requirements.txt
CaptnClementine 5258e78
Add check_alphabet to class AminoAcidSequence
CaptnClementine 7401f62
Rename gene_code_main_operations.py to main.py
CaptnClementine f411c43
Add part from HW17
CaptnClementine ce7c3a5
Update README.md
CaptnClementine cc5323a
Add functions from HW15
CaptnClementine c5ebf02
Create test_bio_files_processor.py
CaptnClementine 889671c
Create test_main.py
CaptnClementine 732b84d
Create Showcases.ipynb
CaptnClementine 0aad609
Delete dir_bio_files_processor/bio_files_processor.py
CaptnClementine b7353c3
Delete dir_bio_files_processor/example_files directory
CaptnClementine b069a0b
Add docstrings
CaptnClementine 792dbfc
Add tests for functions in main
CaptnClementine 2b5601d
Add docstring
CaptnClementine 3cedfcd
Add showcases for main and bio functions
CaptnClementine 58043ef
Add bio finctions and test for it
CaptnClementine ecb4f12
Add installation info
CaptnClementine d07bf08
Add info about main functions
CaptnClementine c4e7a64
Add bio_file_processor info
CaptnClementine de0fdec
Add custom random forest
CaptnClementine 7f8e7a0
Add info about random forest
CaptnClementine 9ce72e4
Delete dir_bio_files_processor directory
CaptnClementine 599b330
Create fastq_file.fastq
CaptnClementine 68550e9
Add example files
CaptnClementine e7be971
Add info about bioinf.me
CaptnClementine 991a5a2
Add comments
CaptnClementine de1ab41
Add demonstration for random forest
CaptnClementine 5c8ebc0
Improove pep8 style
CaptnClementine c53c010
Update requirements.txt
CaptnClementine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,100 @@ | ||
| # gene_code_tools | ||
|  | ||
| # Gene code tools | ||
|
|
||
| This repository contains Python scripts for processing bioinformatics files such as FASTA, GenBank (GBK), and BLAST output files. The main scripts, `main.py` and `bio_file_processor.py`, provide functionality to parse, extract, and convert data from these file formats. It also includes a Telegram logger to send notifications when specific functions or tasks are completed. | ||
|
|
||
| Moreover, it offers a custom implementation of a Random Forest Classifier in `custom_random_forest.py`, enabling users to train and make predictions using Random Forest models. This implementation supports parallel processing, allowing for efficient utilization of multiple threads. | ||
|
|
||
| PS <span style="color: #bdc3c7;">Based on python homeworks from the [Bioinformatics Institute](https://bioinf.me/)</span> | ||
|
|
||
| ## Table of Contents | ||
| - [Description](#description) | ||
| - [Installation](#installation) | ||
| - [Script contents](#script-contents) | ||
| - main.py | ||
| - bio_file_processor.py | ||
| - custom_random_forest.py | ||
| - [Contacts](#contacts) | ||
|
|
||
| # Description | ||
|
|
||
| The repository includes three main scripts: | ||
|
|
||
| - [ ] **main.py**: Contains classes and functions for handling biological sequences, filtering DNA sequences, running GENSCAN analysis, and logging function execution with Telegram integration. | ||
| - [ ] **bio_file_processor.py**: Provides additional functions for processing biological sequence files. | ||
| - [ ] **custom_random_forest.py**: Custom Implementation of a Random Forest Classifier with support for Parallel Processing Utilizing Multiple Threads | ||
|
|
||
| For detailed documentation of each method and parameter, please refer to the docstrings within each script file. If you want to try out just one function, check the Showcases.ipnyb notebook 💜 Example files can be found in the `example_files` directory. | ||
|
|
||
| # Installation | ||
|
|
||
| Clone this repository and install all requirements: | ||
| ```bash | ||
| git clone https://github.com/your_username/bioinformatics-file-processor.git | ||
|
|
||
| cd bioinformatics-file-processor | ||
|
|
||
| pip install -r requirements.txt | ||
| ``` | ||
|
|
||
| # Script contents | ||
|
|
||
| ## ⭐ What could be found in **main.py** | ||
|
|
||
| ### Classes | ||
|
|
||
| - `BiologicalSequence`: An abstract base class representing a biological sequence. | ||
| - `NucleicAcidSequence`: Represents a nucleic acid sequence. | ||
| - `DNASequence`: Represents a DNA sequence. | ||
| - `RNASequence`: Represents an RNA sequence. | ||
| - `AminoAcidSequence`: Represents an amino acid sequence. | ||
| - `GenscanOutput`: Represents the output of a GENSCAN analysis. | ||
|
|
||
| ### Functions | ||
|
|
||
| - `filter_dna`: Filters and processes FASTQ sequences based on specified criteria like GC content, length, and quality. | ||
| - `is_in_gc_bounds`: Checks if the GC content of a DNA sequence falls within specified bounds. | ||
| - `is_in_length_bounds`: Checks if the length of a DNA sequence falls within specified bounds. | ||
| - `create_env_file`: Creates a .env file with the provided Telegram API token. | ||
| - `telegram_logger`: Decorator for logging function execution and sending logs to a Telegram chat. | ||
| - `send_telegram_message`: Sends a message to a Telegram chat. | ||
| - `send_telegram_document`: Sends a document to a Telegram chat. | ||
| - `run_genscan`: Runs GENSCAN analysis on the provided sequence or sequence file. | ||
| - `parse_introns`: Parses introns information from the status string parsed from HTML. | ||
| - `parse_exons`: Parses exons information from the status string parsed from HTML. | ||
| - `parse_proteins`: Parses protein sequences from the status string parsed from HTML. | ||
|
|
||
|
|
||
| ## ⭐ What could be found in **bio_file_processor.py** | ||
| ### Classes: | ||
|
|
||
| - `FastaRecord`: Represents a FASTA record containing sequence information. | ||
| - `OpenFasta`: Opens and iterates through a FASTA file, yielding FastaRecord objects. | ||
|
|
||
| ### Functions: | ||
|
|
||
|
|
||
| - `select_genes_from_gbk_to_fasta`: Selects specific genes from a GenBank (GBK) file and saves them as a FASTA file. | ||
| - `convert_multiline_fasta_to_oneline`: Converts a multiline FASTA file into a one-line FASTA format and saves it to a new file. | ||
| - `parse_blast_output`: Parses the output of a BLAST search and extracts sequence identifiers producing significant alignments. | ||
|
|
||
| ## ⭐ Custom Random Forest Classifier | ||
|
|
||
| This Python module provides a custom implementation of a Random Forest Classifier, built using the scikit-learn library. It allows users to train a Random Forest model with various parameters and perform predictions on new data. | ||
|
|
||
| ### Features | ||
|
|
||
| - Customizable number of estimators (trees) in the forest. | ||
| - Ability to specify maximum depth of the trees. | ||
| - Option to set the maximum number of features to consider when looking for the best split. | ||
| - Control over the randomness of the estimator through a random state parameter. | ||
| - Supports parallel processing using multiple threads. | ||
|
|
||
| # Contacts | ||
|
|
||
| <p align="center"> | ||
| <img src="https://github.com/CaptnClementine/gene_code_tools/assets/131146976/83e7d702-ba84-4e60-8ce9-d7ec3e5b7149" alt="image"> | ||
| </p> | ||
|
|
||
|
|
||
| If you have any questions, suggestions, or encounter any issues while using the amino-analyzer tool, feel free to reach out to [CaptnClementine](https://github.com/CaptnClementine) 💛. You can also contact me directly on Telegram via [this link](https://t.me/Capnclementine). |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Очень крутой README! В целом, "Script contents" не обязатольно было добавлять, кому интересно все равно посмотрит в коде, а вот докстринги для каждого класса лучше добавить (в bio_files_processor.py есть не везде)