bitser 0.3.96__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bitser-0.3.96/LICENSE.txt +22 -0
- bitser-0.3.96/MANIFEST.in +13 -0
- bitser-0.3.96/PKG-INFO +161 -0
- bitser-0.3.96/README.md +132 -0
- bitser-0.3.96/bitser/__init__.py +2 -0
- bitser-0.3.96/bitser/cli.py +392 -0
- bitser-0.3.96/bitser/data_preprocessing.py +39 -0
- bitser-0.3.96/bitser/feature_extraction.py +128 -0
- bitser-0.3.96/bitser/file_utils.py +127 -0
- bitser-0.3.96/bitser/genetic_texture_analysis.cpp +15106 -0
- bitser-0.3.96/bitser/genetic_texture_analysis.pyx +229 -0
- bitser-0.3.96/bitser/genetic_utils.h +57 -0
- bitser-0.3.96/bitser/metadata_utils.py +169 -0
- bitser-0.3.96/bitser/model_training.py +382 -0
- bitser-0.3.96/bitser/sequence_utils.py +21 -0
- bitser-0.3.96/bitser.egg-info/PKG-INFO +161 -0
- bitser-0.3.96/bitser.egg-info/SOURCES.txt +23 -0
- bitser-0.3.96/bitser.egg-info/dependency_links.txt +1 -0
- bitser-0.3.96/bitser.egg-info/entry_points.txt +2 -0
- bitser-0.3.96/bitser.egg-info/not-zip-safe +1 -0
- bitser-0.3.96/bitser.egg-info/requires.txt +14 -0
- bitser-0.3.96/bitser.egg-info/top_level.txt +1 -0
- bitser-0.3.96/pyproject.toml +102 -0
- bitser-0.3.96/setup.cfg +4 -0
- bitser-0.3.96/setup.py +38 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 heuristictree
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
include bitser/genetic_texture_analysis.pyx
|
|
2
|
+
include bitser/genetic_texture_analysis.cpp
|
|
3
|
+
recursive-include bitser *.pyx *.pxd *.cpp *.h
|
|
4
|
+
|
|
5
|
+
prune tests
|
|
6
|
+
prune alt_codes
|
|
7
|
+
prune datasets
|
|
8
|
+
prune datasets_val
|
|
9
|
+
prune datasets_metadata
|
|
10
|
+
prune results_compare
|
|
11
|
+
prune scores
|
|
12
|
+
|
|
13
|
+
global-exclude __pycache__ *.py[cod]
|
bitser-0.3.96/PKG-INFO
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: bitser
|
|
3
|
+
Version: 0.3.96
|
|
4
|
+
Summary: Binary Pattern Sequence Recognition for biological sequences
|
|
5
|
+
Author-email: LCostaF <lucascostafuganti@alunos.utfpr.edu.br>
|
|
6
|
+
Maintainer-email: LCostaF <lucascostafuganti@alunos.utfpr.edu.br>
|
|
7
|
+
License: MIT
|
|
8
|
+
Project-URL: Homepage, https://github.com/LCostaF/BITSER
|
|
9
|
+
Project-URL: Repository, https://github.com/LCostaF/BITSER
|
|
10
|
+
Keywords: bioinformatics,machine learning,DNA,RNA,protein,classification
|
|
11
|
+
Requires-Python: <4.0,>=3.13
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE.txt
|
|
14
|
+
Requires-Dist: numpy<3.0.0,>=2.2.3
|
|
15
|
+
Requires-Dist: bio<2.0.0,>=1.7.1
|
|
16
|
+
Requires-Dist: rich<14.0.0,>=13.9.4
|
|
17
|
+
Requires-Dist: typer<0.16.0,>=0.15.2
|
|
18
|
+
Requires-Dist: scikit-learn<2.0.0,>=1.6.1
|
|
19
|
+
Requires-Dist: xgboost<3.0.0,>=2.1.4
|
|
20
|
+
Requires-Dist: joblib<2.0.0,>=1.4.2
|
|
21
|
+
Requires-Dist: matplotlib<4.0.0,>=3.10.1
|
|
22
|
+
Requires-Dist: seaborn<0.14.0,>=0.13.2
|
|
23
|
+
Requires-Dist: pandas<3.0.0,>=2.2.3
|
|
24
|
+
Requires-Dist: cython<4.0.0,>=3.0.10
|
|
25
|
+
Requires-Dist: setuptools<81.0.0,>=80.4.0
|
|
26
|
+
Requires-Dist: wheel<0.46.0,>=0.45.1
|
|
27
|
+
Requires-Dist: scipy<2.0.0,>=1.16.1
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
<div align="center" style="display: display_block">
|
|
32
|
+
|
|
33
|
+
# **BITSER**
|
|
34
|
+
|
|
35
|
+
#### **BI**nary pa**T**tern **S**equenc**E** **R**ecognition
|
|
36
|
+
|
|
37
|
+

|
|
38
|
+
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
<div align="center">
|
|
43
|
+
<img src="https://cdn.jsdelivr.net/gh/devicons/devicon@latest/icons/python/python-original.svg" width="100" height="100" />
|
|
44
|
+
<img src="https://cdn.jsdelivr.net/gh/devicons/devicon@latest/icons/poetry/poetry-original.svg" width="100" height="100" />
|
|
45
|
+
<img src="https://cdn.jsdelivr.net/gh/devicons/devicon@latest/icons/scikitlearn/scikitlearn-original.svg" width="100" height="100" />
|
|
46
|
+
<img src="https://cdn.jsdelivr.net/gh/devicons/devicon@latest/icons/numpy/numpy-original.svg" width="100" height="100" />
|
|
47
|
+
<img src="https://cdn.jsdelivr.net/gh/devicons/devicon@latest/icons/pandas/pandas-original.svg" width="100" height="100" />
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
## Overview
|
|
52
|
+
|
|
53
|
+
BITSER (Binary Pattern Sequence Recognition) is a software tool built with the Python language that extracts features segments of each genetic sequence at a local level.
|
|
54
|
+
|
|
55
|
+
The method for feature extraction utilizes the concept of Local Binary Pattern (LBP), as well as adapted versions of the Texture Unit and Texture Unit Number from the field of computer vision, to obtain informative features from sequences organized in FASTA files.
|
|
56
|
+
|
|
57
|
+
A k-mer window (default size 9) slides over each genetic sequence, comparing the leftmost nucleotide or aminoacid in the window with the 8 other members.
|
|
58
|
+
|
|
59
|
+
This tool is targeted for usage by biologists, researchers and other professionals in the field of bioinformatics.
|
|
60
|
+
|
|
61
|
+
## Installation
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pip install bitser
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
After the installation, run `bitser --help` to see all the available commands.
|
|
68
|
+
|
|
69
|
+
## CLI commands
|
|
70
|
+
|
|
71
|
+
BITSER offers the following commands:
|
|
72
|
+
|
|
73
|
+
| COMMAND | FUNCTION |
|
|
74
|
+
|---------|--------------------------------------------------|
|
|
75
|
+
| `metadata` | Parse FASTA headers and create `metadata.tsv` with train/test splits |
|
|
76
|
+
| `train` | Extract features and train a classification model |
|
|
77
|
+
| `predict` | Load a trained model and predict classes on new sequences |
|
|
78
|
+
|
|
79
|
+
### `metadata` command
|
|
80
|
+
|
|
81
|
+
This command must be run on your training dataset directory.
|
|
82
|
+
|
|
83
|
+
The dataset directory **must contain a `sequences/` subfolder** with the FASTA files.
|
|
84
|
+
|
|
85
|
+
The command scans all `.fasta` files in the `sequences/` subfolder, parses headers to extract class labels, and creates a `metadata.tsv` file, which is used for the `train` and `predict` commands.
|
|
86
|
+
|
|
87
|
+
Example structure:
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
dataset/
|
|
91
|
+
├── sequences/
|
|
92
|
+
│ ├── class_a.fasta
|
|
93
|
+
│ └── class_b.fasta
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
After executing the command:
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
dataset/
|
|
100
|
+
├── sequences/
|
|
101
|
+
│ ├── class_a.fasta
|
|
102
|
+
│ └── class_b.fasta
|
|
103
|
+
└──metadata.tsv
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### `train` command
|
|
107
|
+
|
|
108
|
+
This command initiates the feature extraction and model training workflow.
|
|
109
|
+
|
|
110
|
+
Training performs the following steps:
|
|
111
|
+
|
|
112
|
+
1. Feature extraction using sliding windows;
|
|
113
|
+
2. Construction of the training feature matrix;
|
|
114
|
+
3. Model training using cross-validation;
|
|
115
|
+
4. Saving the trained model.
|
|
116
|
+
|
|
117
|
+
#### Parameters
|
|
118
|
+
|
|
119
|
+
| Parameter | Description | Required | Default |
|
|
120
|
+
|---|---|:--:|---|
|
|
121
|
+
| `--input`, `-i` | Path to the dataset directory containing `metadata.tsv` and `sequences/` | ✔ | |
|
|
122
|
+
| `--output`, `-o` | Path to save the trained model | | `model.pkl` |
|
|
123
|
+
| `--classifier`, `-c` | Classifier algorithm | | `xgb` |
|
|
124
|
+
| `--flank`, `-f` | Number of neighbors compared to the reference character in the sliding window | | `8` |
|
|
125
|
+
| `--translate / --no-translate` | Translate nucleotide sequences to proteins before feature extraction | | `False` |
|
|
126
|
+
| `--splits`, `-s` | Number of folds used for cross-validation | | `10` |
|
|
127
|
+
| `--repeats`, `-r` | Number of cross-validation repetitions | | `10` |
|
|
128
|
+
| `--seed` | Random seed for reproducibility | | `7` |
|
|
129
|
+
|
|
130
|
+
#### Output
|
|
131
|
+
|
|
132
|
+
- Trained model file (`.pkl`);
|
|
133
|
+
- Training evaluation results stored in the `results/` directory.
|
|
134
|
+
|
|
135
|
+
### `predict` command
|
|
136
|
+
|
|
137
|
+
Uses a trained model to classify sequences from a testing dataset.
|
|
138
|
+
|
|
139
|
+
Feature extraction settings must match those used during training.
|
|
140
|
+
|
|
141
|
+
#### Parameters
|
|
142
|
+
|
|
143
|
+
| Parameter | Description | Required | Default |
|
|
144
|
+
|---|---|:--:|---|
|
|
145
|
+
| `--model`, `-m` | Path to the trained model file | ✔ | |
|
|
146
|
+
| `--data`, `-d` | Dataset directory containing `metadata.tsv` and `sequences/` | ✔ | |
|
|
147
|
+
| `--flank`, `-f` | Number of neighbors compared to the reference character in the sliding window, must match value used during training | | `8` |
|
|
148
|
+
| `--translate / --no-translate` | Must match the translation setting used during training | | `False` |
|
|
149
|
+
|
|
150
|
+
#### Output
|
|
151
|
+
|
|
152
|
+
The prediction step generates:
|
|
153
|
+
|
|
154
|
+
- Classification results;
|
|
155
|
+
- Per-class performance metrics;
|
|
156
|
+
- Feature importance;
|
|
157
|
+
- Prediction report (CSV).
|
|
158
|
+
|
|
159
|
+
##### Acknowledgements
|
|
160
|
+
|
|
161
|
+
* This study was supported by national funds through the Coordenação de Aperfeiçoamento de Pessoal de Nível Superior (CAPES) - Finance Code 001, Fundação Araucária (Grant number 035/2019, 138/2021 and NAPI - Bioinformática), CNPq 440412/2022-6 and 408312/2023-8.
|
bitser-0.3.96/README.md
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
|
|
2
|
+
<div align="center" style="display: display_block">
|
|
3
|
+
|
|
4
|
+
# **BITSER**
|
|
5
|
+
|
|
6
|
+
#### **BI**nary pa**T**tern **S**equenc**E** **R**ecognition
|
|
7
|
+
|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
<div align="center">
|
|
14
|
+
<img src="https://cdn.jsdelivr.net/gh/devicons/devicon@latest/icons/python/python-original.svg" width="100" height="100" />
|
|
15
|
+
<img src="https://cdn.jsdelivr.net/gh/devicons/devicon@latest/icons/poetry/poetry-original.svg" width="100" height="100" />
|
|
16
|
+
<img src="https://cdn.jsdelivr.net/gh/devicons/devicon@latest/icons/scikitlearn/scikitlearn-original.svg" width="100" height="100" />
|
|
17
|
+
<img src="https://cdn.jsdelivr.net/gh/devicons/devicon@latest/icons/numpy/numpy-original.svg" width="100" height="100" />
|
|
18
|
+
<img src="https://cdn.jsdelivr.net/gh/devicons/devicon@latest/icons/pandas/pandas-original.svg" width="100" height="100" />
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## Overview
|
|
23
|
+
|
|
24
|
+
BITSER (Binary Pattern Sequence Recognition) is a software tool built with the Python language that extracts features segments of each genetic sequence at a local level.
|
|
25
|
+
|
|
26
|
+
The method for feature extraction utilizes the concept of Local Binary Pattern (LBP), as well as adapted versions of the Texture Unit and Texture Unit Number from the field of computer vision, to obtain informative features from sequences organized in FASTA files.
|
|
27
|
+
|
|
28
|
+
A k-mer window (default size 9) slides over each genetic sequence, comparing the leftmost nucleotide or aminoacid in the window with the 8 other members.
|
|
29
|
+
|
|
30
|
+
This tool is targeted for usage by biologists, researchers and other professionals in the field of bioinformatics.
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install bitser
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
After the installation, run `bitser --help` to see all the available commands.
|
|
39
|
+
|
|
40
|
+
## CLI commands
|
|
41
|
+
|
|
42
|
+
BITSER offers the following commands:
|
|
43
|
+
|
|
44
|
+
| COMMAND | FUNCTION |
|
|
45
|
+
|---------|--------------------------------------------------|
|
|
46
|
+
| `metadata` | Parse FASTA headers and create `metadata.tsv` with train/test splits |
|
|
47
|
+
| `train` | Extract features and train a classification model |
|
|
48
|
+
| `predict` | Load a trained model and predict classes on new sequences |
|
|
49
|
+
|
|
50
|
+
### `metadata` command
|
|
51
|
+
|
|
52
|
+
This command must be run on your training dataset directory.
|
|
53
|
+
|
|
54
|
+
The dataset directory **must contain a `sequences/` subfolder** with the FASTA files.
|
|
55
|
+
|
|
56
|
+
The command scans all `.fasta` files in the `sequences/` subfolder, parses headers to extract class labels, and creates a `metadata.tsv` file, which is used for the `train` and `predict` commands.
|
|
57
|
+
|
|
58
|
+
Example structure:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
dataset/
|
|
62
|
+
├── sequences/
|
|
63
|
+
│ ├── class_a.fasta
|
|
64
|
+
│ └── class_b.fasta
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
After executing the command:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
dataset/
|
|
71
|
+
├── sequences/
|
|
72
|
+
│ ├── class_a.fasta
|
|
73
|
+
│ └── class_b.fasta
|
|
74
|
+
└──metadata.tsv
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### `train` command
|
|
78
|
+
|
|
79
|
+
This command initiates the feature extraction and model training workflow.
|
|
80
|
+
|
|
81
|
+
Training performs the following steps:
|
|
82
|
+
|
|
83
|
+
1. Feature extraction using sliding windows;
|
|
84
|
+
2. Construction of the training feature matrix;
|
|
85
|
+
3. Model training using cross-validation;
|
|
86
|
+
4. Saving the trained model.
|
|
87
|
+
|
|
88
|
+
#### Parameters
|
|
89
|
+
|
|
90
|
+
| Parameter | Description | Required | Default |
|
|
91
|
+
|---|---|:--:|---|
|
|
92
|
+
| `--input`, `-i` | Path to the dataset directory containing `metadata.tsv` and `sequences/` | ✔ | |
|
|
93
|
+
| `--output`, `-o` | Path to save the trained model | | `model.pkl` |
|
|
94
|
+
| `--classifier`, `-c` | Classifier algorithm | | `xgb` |
|
|
95
|
+
| `--flank`, `-f` | Number of neighbors compared to the reference character in the sliding window | | `8` |
|
|
96
|
+
| `--translate / --no-translate` | Translate nucleotide sequences to proteins before feature extraction | | `False` |
|
|
97
|
+
| `--splits`, `-s` | Number of folds used for cross-validation | | `10` |
|
|
98
|
+
| `--repeats`, `-r` | Number of cross-validation repetitions | | `10` |
|
|
99
|
+
| `--seed` | Random seed for reproducibility | | `7` |
|
|
100
|
+
|
|
101
|
+
#### Output
|
|
102
|
+
|
|
103
|
+
- Trained model file (`.pkl`);
|
|
104
|
+
- Training evaluation results stored in the `results/` directory.
|
|
105
|
+
|
|
106
|
+
### `predict` command
|
|
107
|
+
|
|
108
|
+
Uses a trained model to classify sequences from a testing dataset.
|
|
109
|
+
|
|
110
|
+
Feature extraction settings must match those used during training.
|
|
111
|
+
|
|
112
|
+
#### Parameters
|
|
113
|
+
|
|
114
|
+
| Parameter | Description | Required | Default |
|
|
115
|
+
|---|---|:--:|---|
|
|
116
|
+
| `--model`, `-m` | Path to the trained model file | ✔ | |
|
|
117
|
+
| `--data`, `-d` | Dataset directory containing `metadata.tsv` and `sequences/` | ✔ | |
|
|
118
|
+
| `--flank`, `-f` | Number of neighbors compared to the reference character in the sliding window, must match value used during training | | `8` |
|
|
119
|
+
| `--translate / --no-translate` | Must match the translation setting used during training | | `False` |
|
|
120
|
+
|
|
121
|
+
#### Output
|
|
122
|
+
|
|
123
|
+
The prediction step generates:
|
|
124
|
+
|
|
125
|
+
- Classification results;
|
|
126
|
+
- Per-class performance metrics;
|
|
127
|
+
- Feature importance;
|
|
128
|
+
- Prediction report (CSV).
|
|
129
|
+
|
|
130
|
+
##### Acknowledgements
|
|
131
|
+
|
|
132
|
+
* This study was supported by national funds through the Coordenação de Aperfeiçoamento de Pessoal de Nível Superior (CAPES) - Finance Code 001, Fundação Araucária (Grant number 035/2019, 138/2021 and NAPI - Bioinformática), CNPq 440412/2022-6 and 408312/2023-8.
|