Skip to content
Open
Show file tree
Hide file tree
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 Oct 6, 2023
d279d38
Add 'is_dna' function to check input sequence
CaptnClementine Oct 6, 2023
2165478
Add 'count_gc_content' function
CaptnClementine Oct 6, 2023
a934e0c
Add 'is_in_gc_bounds' function to check sequence threshold
CaptnClementine Oct 6, 2023
85f43f7
Add 'is_in_length_bounds' function to check sequence threshold
CaptnClementine Oct 6, 2023
d3a3456
Add 'check_quality' function to check sequence threshold
CaptnClementine Oct 6, 2023
547e14e
Create gene_code_main_operations
CaptnClementine Oct 6, 2023
44a9be2
Add 'filter_dna' to filter sequences by GC-content, length and quality
CaptnClementine Oct 6, 2023
499b0e9
Create amino_analyzer_utils.py
CaptnClementine Oct 7, 2023
7a35ab5
Add 'is_aa' function to check if a sequence contains only amino acids
CaptnClementine Oct 7, 2023
5349b7f
Add 'choose_weight' function to choose the weight type
CaptnClementine Oct 7, 2023
e5d408b
Add 'aa_weight' function to calculate the protein weight
CaptnClementine Oct 7, 2023
f142af3
Add 'count_hydroaffinity' function to count it in protein sequence
CaptnClementine Oct 7, 2023
1d0610c
Add 'peptide_cutter' to identifies cleavage sites for "trypsin" and "…
CaptnClementine Oct 7, 2023
17859ad
Add 'one_to_three_letter_code' function to convert protein sequence
CaptnClementine Oct 7, 2023
8e2e973
Add 'sulphur_containing_aa_counter' function
CaptnClementine Oct 7, 2023
8b2a489
Add 'run_amino_analyzer' function to analyse protein sequence in one-…
CaptnClementine Oct 7, 2023
167f505
Create dna_rna_tools_utils.py
CaptnClementine Oct 7, 2023
9690bbd
Add 'is_dna' function to check if a sequence is DNA
CaptnClementine Oct 7, 2023
9cacb05
Add 'is_rna' function to check if a sequence is RNA
CaptnClementine Oct 7, 2023
11d5112
Add 'reverse' function to reverse a sequence
CaptnClementine Oct 7, 2023
bed0dcc
Add 'complement' function to find complement of sequence
CaptnClementine Oct 7, 2023
e40468c
Add 'reverse_complement' function to find reverse complement sequence
CaptnClementine Oct 7, 2023
d9dbaa8
Add 'reverse_transcription' function to reverse transcription of RNA
CaptnClementine Oct 7, 2023
0a64a42
Add 'type_rna_or_dna' function to detect type of sequence
CaptnClementine Oct 7, 2023
8855e07
Add 'has_start_codon' function to check if RNA has start codon
CaptnClementine Oct 7, 2023
1af134a
Add 'is_palindrome' function to check if a sequence is a palindrome
CaptnClementine Oct 7, 2023
49e1d63
Add 'transcribe' function to transcribe a DNA sequence into RNA
CaptnClementine Oct 7, 2023
a95b168
Add 'run_dna_rna_tools' function to make various opertaions with DNA/RNA
CaptnClementine Oct 7, 2023
40b9e86
Update README.md
CaptnClementine Oct 7, 2023
94751f3
Correct bounds in 'filter_dna' function
CaptnClementine Oct 8, 2023
6172210
Correct bounds in GC and length filter functions
CaptnClementine Oct 8, 2023
f412a04
Update README.md to correct bounds descrition in 'filter_dna' function
CaptnClementine Oct 8, 2023
a06d117
Update README.md
CaptnClementine Oct 8, 2023
5f682c4
Add typing library
CaptnClementine Oct 14, 2023
7c5ab39
Add 'read_fastq_file' to read fastq from file
CaptnClementine Oct 16, 2023
c0f0e82
Add 'write_filtered_fastq' to write the file
CaptnClementine Oct 16, 2023
5a984df
Change 'filter_dna' to read-write fastq file
CaptnClementine Oct 16, 2023
01c1dd5
Add file-option description of 'filter_dna'
CaptnClementine Oct 16, 2023
54de4ee
Create bio_files_processor.py and the directory for it
CaptnClementine Oct 16, 2023
3ef1ba8
Add 'convert_multiline_fasta_to_oneline' function
CaptnClementine Oct 16, 2023
777f05b
Add 'select_genes_from_gbk_to_fasta' function
CaptnClementine Oct 16, 2023
5da5b65
Add 'change_fasta_start_pos' function to shift the start position
CaptnClementine Oct 16, 2023
565bf3c
Add 'parse_blast_output' function to search and extract sequence id
CaptnClementine Oct 16, 2023
3018829
Create README.md
CaptnClementine Oct 17, 2023
f053940
Create 'example_fasta_for_convert_multiline_fasta_to_oneline.fasta'
CaptnClementine Oct 17, 2023
88e034d
Create example_for_change_fasta_start_pos
CaptnClementine Oct 17, 2023
7c591a7
Create 'example_for_select_genes_from_gbk_to_fasta'
CaptnClementine Oct 17, 2023
423d95d
Rename example_for_change_fasta_start_pos to example_for_change_fasta…
CaptnClementine Oct 17, 2023
bc5297f
Create example_for_parse_blast_output
CaptnClementine Oct 17, 2023
ed69608
Update 'dna_rna_tools_utils.py' for better PEP8-style
CaptnClementine Oct 17, 2023
560242d
Update 'amino_analyzer_utils.py' to improve PEP8 style
CaptnClementine Oct 17, 2023
e820d51
Update 'filter_dna_utils.py' for better PEP8 style
CaptnClementine Oct 17, 2023
0394377
Add float type for gc_bound in 'gene_code_main_operations' function
CaptnClementine Oct 17, 2023
5368bb3
Update 'filter_dna' function to write output file in directory
CaptnClementine Oct 18, 2023
96e99a7
Rename gene_code_main_operations to gene_code_main_operations.py
CaptnClementine Oct 31, 2023
3279f69
Update gene_code_utils/filter_dna_utils.py
CaptnClementine Oct 31, 2023
879cc4e
Delete gene_code_utils directory
CaptnClementine Feb 23, 2024
cd34610
Delete gene_code_utils functions
CaptnClementine Feb 23, 2024
b9a0cd4
Add filter_dna with biopyhton functions
CaptnClementine Feb 23, 2024
f5ec4da
Add BiologicalSequence class and subclasses
CaptnClementine Feb 24, 2024
0228482
Add NotImplementedError
CaptnClementine Feb 24, 2024
e00b9b2
Add requirements.txt
CaptnClementine Feb 24, 2024
5258e78
Add check_alphabet to class AminoAcidSequence
CaptnClementine Feb 25, 2024
7401f62
Rename gene_code_main_operations.py to main.py
CaptnClementine Apr 28, 2024
f411c43
Add part from HW17
CaptnClementine Apr 28, 2024
ce7c3a5
Update README.md
CaptnClementine Apr 28, 2024
cc5323a
Add functions from HW15
CaptnClementine Apr 28, 2024
c5ebf02
Create test_bio_files_processor.py
CaptnClementine Apr 28, 2024
889671c
Create test_main.py
CaptnClementine Apr 28, 2024
732b84d
Create Showcases.ipynb
CaptnClementine Apr 28, 2024
0aad609
Delete dir_bio_files_processor/bio_files_processor.py
CaptnClementine Apr 30, 2024
b7353c3
Delete dir_bio_files_processor/example_files directory
CaptnClementine Apr 30, 2024
b069a0b
Add docstrings
CaptnClementine Apr 30, 2024
792dbfc
Add tests for functions in main
CaptnClementine Apr 30, 2024
2b5601d
Add docstring
CaptnClementine Apr 30, 2024
3cedfcd
Add showcases for main and bio functions
CaptnClementine Apr 30, 2024
58043ef
Add bio finctions and test for it
CaptnClementine Apr 30, 2024
ecb4f12
Add installation info
CaptnClementine Apr 30, 2024
d07bf08
Add info about main functions
CaptnClementine Apr 30, 2024
c4e7a64
Add bio_file_processor info
CaptnClementine Apr 30, 2024
de0fdec
Add custom random forest
CaptnClementine May 1, 2024
7f8e7a0
Add info about random forest
CaptnClementine May 1, 2024
9ce72e4
Delete dir_bio_files_processor directory
CaptnClementine May 1, 2024
599b330
Create fastq_file.fastq
CaptnClementine May 1, 2024
68550e9
Add example files
CaptnClementine May 1, 2024
e7be971
Add info about bioinf.me
CaptnClementine May 1, 2024
991a5a2
Add comments
CaptnClementine May 1, 2024
de1ab41
Add demonstration for random forest
CaptnClementine May 1, 2024
5c8ebc0
Improove pep8 style
CaptnClementine May 1, 2024
c53c010
Update requirements.txt
CaptnClementine May 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 100 additions & 1 deletion README.md

Copy link
Copy Markdown

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 есть не везде)

Original file line number Diff line number Diff line change
@@ -1 +1,100 @@
# gene_code_tools
![image](https://github.com/CaptnClementine/gene_code_tools/assets/131146976/68f2999b-5b6e-4668-9865-fae0d4e0b778)
# 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).
Loading