bio-shark 1.2.1__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.
- bio_shark-1.2.1/LICENSE +29 -0
- bio_shark-1.2.1/PKG-INFO +212 -0
- bio_shark-1.2.1/README.md +237 -0
- bio_shark-1.2.1/bio_shark.egg-info/PKG-INFO +212 -0
- bio_shark-1.2.1/bio_shark.egg-info/SOURCES.txt +25 -0
- bio_shark-1.2.1/bio_shark.egg-info/dependency_links.txt +1 -0
- bio_shark-1.2.1/bio_shark.egg-info/entry_points.txt +3 -0
- bio_shark-1.2.1/bio_shark.egg-info/requires.txt +6 -0
- bio_shark-1.2.1/bio_shark.egg-info/top_level.txt +1 -0
- bio_shark-1.2.1/setup.cfg +4 -0
- bio_shark-1.2.1/setup.py +66 -0
- bio_shark-1.2.1/src/VERSION +1 -0
- bio_shark-1.2.1/src/__init__.py +5 -0
- bio_shark-1.2.1/src/core/__init__.py +0 -0
- bio_shark-1.2.1/src/core/alf_scoring.py +33 -0
- bio_shark-1.2.1/src/core/sequence_pair_similarity.py +295 -0
- bio_shark-1.2.1/src/core/utils.py +120 -0
- bio_shark-1.2.1/src/data/dive_pred_model_v2.pkl +0 -0
- bio_shark-1.2.1/src/data/grantham.tsv +21 -0
- bio_shark-1.2.1/src/data/sample_fasta_file.fasta +20 -0
- bio_shark-1.2.1/src/data/substitution_matrix_grantham.tsv +21 -0
- bio_shark-1.2.1/src/dive/__init__.py +0 -0
- bio_shark-1.2.1/src/dive/prediction.py +193 -0
- bio_shark-1.2.1/src/dive/run.py +98 -0
- bio_shark-1.2.1/src/dive/visualize.py +185 -0
- bio_shark-1.2.1/src/exceptions.py +13 -0
- bio_shark-1.2.1/src/settings.py +13 -0
bio_shark-1.2.1/LICENSE
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023, ATPlab
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
17
|
+
contributors may be used to endorse or promote products derived from
|
|
18
|
+
this software without specific prior written permission.
|
|
19
|
+
|
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
bio_shark-1.2.1/PKG-INFO
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: bio-shark
|
|
3
|
+
Version: 1.2.1
|
|
4
|
+
Summary: SHARK (Similarity/Homology Assessment by Relating K-mers)
|
|
5
|
+
Home-page: https://git.mpi-cbg.de/tothpetroczylab/shark
|
|
6
|
+
Author: Willis Chow <chow@mpi-cbg.de>, Soumyadeep Ghosh <soumyadeep11194@gmail.com>, Anna Hadarovich <hadarovi@mpi-cbg.de>, Agnes Toth-Petroczy <tothpet@mpi-cbg.de>, Maxim Scheremetjew <schereme@mpi-cbg.de>
|
|
7
|
+
Author-email: chow@mpi-cbg.de
|
|
8
|
+
Project-URL: Homepage, https://git.mpi-cbg.de/tothpetroczylab/shark
|
|
9
|
+
Project-URL: Documentation, https://git.mpi-cbg.de/tothpetroczylab/shark/-/blob/master/README.md
|
|
10
|
+
Project-URL: Funding, https://www.mpi-cbg.de/
|
|
11
|
+
Project-URL: Repository, https://git.mpi-cbg.de/tothpetroczylab/shark
|
|
12
|
+
Project-URL: Issue tracker, https://git.mpi-cbg.de/tothpetroczylab/shark/-/issues
|
|
13
|
+
Keywords: intrinsically disordered protein regions,motif detection,IDRs,sequence-to-function,alignment-free,machine learning,homology detection
|
|
14
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
18
|
+
Classifier: Programming Language :: Python
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
24
|
+
Classifier: Operating System :: Unix
|
|
25
|
+
Classifier: Operating System :: MacOS
|
|
26
|
+
Requires-Python: >=3.9,<3.12
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
License-File: LICENSE
|
|
29
|
+
Requires-Dist: requests~=2.31.0
|
|
30
|
+
Requires-Dist: catboost~=1.2
|
|
31
|
+
Requires-Dist: matplotlib~=3.8.2
|
|
32
|
+
Requires-Dist: pandas~=2.1.3
|
|
33
|
+
Requires-Dist: logomaker~=0.8
|
|
34
|
+
Requires-Dist: alfpy~=1.0.6
|
|
35
|
+
|
|
36
|
+
<h1 align="center">
|
|
37
|
+
<img src="https://git.mpi-cbg.de/tothpetroczylab/shark/-/raw/master/branding/logo/SharkDive_logo.png" width="300">
|
|
38
|
+
</h1><br>
|
|
39
|
+
|
|
40
|
+
# SHARK (Similarity/Homology Assessment by Relating K-mers)
|
|
41
|
+
|
|
42
|
+
To accurately assess homology between unalignable sequences, we developed an alignment-free sequence comparison algorithm, SHARK (Similarity/Homology Assessment by Relating K-mers).
|
|
43
|
+
|
|
44
|
+
## SHARK-dive
|
|
45
|
+
|
|
46
|
+
We trained SHARK-dive, a machine learning homology classifier, which achieved superior performance to standard alignment in assessing homology in unalignable sequences, and correctly identified dissimilar IDRs capable of functional rescue in IDR-replacement experiments reported in the literature.
|
|
47
|
+
|
|
48
|
+
### 1. Dive-Score
|
|
49
|
+
Scoring the similarity between a pair of sequence
|
|
50
|
+
|
|
51
|
+
Variants:
|
|
52
|
+
1. Normal (`SHARK-score (T)`)
|
|
53
|
+
2. Sparse (`SHARK-score (best)`)
|
|
54
|
+
|
|
55
|
+
### 2. Dive-Predict
|
|
56
|
+
Find sequences similar to a given query from a target set
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
## User Section
|
|
60
|
+
|
|
61
|
+
### Installation
|
|
62
|
+
|
|
63
|
+
SHARK officially supports Python versions >=3.9,<3.12.
|
|
64
|
+
|
|
65
|
+
**Recommended** Use within a local python virtual environment
|
|
66
|
+
|
|
67
|
+
```shell
|
|
68
|
+
python3 -m venv /path/to/new/virtual/environment
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
#### SHARK is installable from PyPI soon
|
|
72
|
+
|
|
73
|
+
```shell
|
|
74
|
+
$ pip install bio-shark
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
#### SHARK is also installable from source
|
|
78
|
+
|
|
79
|
+
* This allows users to import functionalities as a python package
|
|
80
|
+
* This also allows user to run the functionalities as a command line utility
|
|
81
|
+
|
|
82
|
+
```shell
|
|
83
|
+
$ git clone git@git.mpi-cbg.de:tothpetroczylab/shark.git
|
|
84
|
+
```
|
|
85
|
+
Once you have a copy of the source, you can embed it in your own Python package, or install it into your site-packages easily.
|
|
86
|
+
|
|
87
|
+
```shell
|
|
88
|
+
# Make sure you have the required Python version installed
|
|
89
|
+
$ python3 --version
|
|
90
|
+
Python 3.11.5
|
|
91
|
+
|
|
92
|
+
$ cd shark
|
|
93
|
+
$ python3 -m venv shark-env
|
|
94
|
+
$ source shark-env/bin/activate
|
|
95
|
+
$ (shark-env) % python -m pip install .
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
#### SHARK is also installable from GitLab source directly
|
|
99
|
+
|
|
100
|
+
```shell
|
|
101
|
+
$ pip install git+https://git.mpi-cbg.de/tothpetroczylab/shark.git
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### How to use?
|
|
105
|
+
|
|
106
|
+
### 1. Dive
|
|
107
|
+
|
|
108
|
+
#### 1.1. Scoring: Given two protein sequences and a k-mer length (1 to 20), score the similarity b/w them
|
|
109
|
+
|
|
110
|
+
##### Inputs
|
|
111
|
+
|
|
112
|
+
1. Protein Sequence 1
|
|
113
|
+
2. Protein Sequence 2
|
|
114
|
+
3. Scoring-variant: Normal (`SHARK-score (T)`)/ Sparse (`SHARK-score (best)`)
|
|
115
|
+
1. Threshold (for "Normal")
|
|
116
|
+
4. K-Mer Length (Should be <= smallest_len(sequences))
|
|
117
|
+
|
|
118
|
+
##### 1.1.1. As a command-line utility
|
|
119
|
+
* Run the command `shark-score`
|
|
120
|
+
* Enter sequences when command prompts
|
|
121
|
+
* Enter the variant (1/2) when the command prompts
|
|
122
|
+
|
|
123
|
+
```shell
|
|
124
|
+
% shark-score
|
|
125
|
+
Enter Sequence 1:
|
|
126
|
+
> SSSSPINTHGVSTTVPSSNNTIIPSSDGVSLSQTDYFDTVHNRQSPSRRESPVTVFRQPSLSHSKSLHKDSKNKVPQISTNQSHPSAVSTANTPGPSPN
|
|
127
|
+
Enter Sequence 2:
|
|
128
|
+
> VAEREFNGRSNSLHANFTSPVPRTVLDHHRHELTFCNPNNTTGFKTITPSPPTQHQSILPTAVDNVPRSKSVSSLPVSGFPPLIVKQQQQQQLNSSSSASALPSIHSPLTNEH
|
|
129
|
+
Enter k-mer length (integer 1 - 10): > 5
|
|
130
|
+
Press: 1. Normal; 2. Sparse
|
|
131
|
+
> 1
|
|
132
|
+
Enter threshold:
|
|
133
|
+
>0.8
|
|
134
|
+
Similarity Score: 0.6552442773
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
##### 1.1.2. As an imported python package
|
|
138
|
+
|
|
139
|
+
```python
|
|
140
|
+
from bio_shark.core import utils
|
|
141
|
+
from bio_shark.dive.run import run_normal, run_sparse
|
|
142
|
+
|
|
143
|
+
dive_t_score = run_normal(
|
|
144
|
+
sequence1="LASIDPTFKAN",
|
|
145
|
+
sequence2="ERQKNGGKSDSDDDEPAAKKKVEYPIAAAPPMMMP",
|
|
146
|
+
k=3,
|
|
147
|
+
threshold=0.8
|
|
148
|
+
) # Compute SHARK-score (T)
|
|
149
|
+
|
|
150
|
+
dive_best_score = run_sparse(
|
|
151
|
+
sequence1="LASIDPTFKAN",
|
|
152
|
+
sequence2="ERQKNGGKSDSDDDEPAAKKKVEYPIAAAPPMMMP",
|
|
153
|
+
k=3,
|
|
154
|
+
) # Compute SHARK-score (best)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
#### 1.2. Similarity Prediction
|
|
158
|
+
|
|
159
|
+
##### 1.2.1. As an imported python package
|
|
160
|
+
|
|
161
|
+
```python
|
|
162
|
+
from bio_shark.dive.prediction import Prediction
|
|
163
|
+
|
|
164
|
+
predictor = Prediction(q_sequence_id_map=<dict-fasta-id-seq>, t_sequence_id_map=<dict-fasta-id-seq>)
|
|
165
|
+
|
|
166
|
+
expected_out_keys = ['seq_id1', 'sequence1', 'seq_id2', 'sequence2', 'similarity_scores_k', 'pred_label', 'pred_proba']
|
|
167
|
+
output = predictor.predict() # List of output objects; Each element is for one pair
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
##### 1.2.2. As a command-line utility
|
|
171
|
+
- Run the command `shark-dive` with the absolute path of the sequence fasta files as only argument
|
|
172
|
+
- Sequences should be of length > 10, since `prediction` is always based on scores of k = [1..10]
|
|
173
|
+
- _You may use the `sample_fasta_file.fasta` from `data` folder (Owncloud link)_
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
```shell
|
|
177
|
+
usage: shark-dive [-h] [--output_dir OUTPUT_DIR] query target
|
|
178
|
+
|
|
179
|
+
DIVE-Predict: Given some query sequences, compute their similarity from the list of target sequences;Target is
|
|
180
|
+
supposed to be major database of protein sequences
|
|
181
|
+
|
|
182
|
+
positional arguments:
|
|
183
|
+
query Absolute path to fasta file for the query set of input sequences
|
|
184
|
+
target Absolute path to fasta file for the target set of input sequences
|
|
185
|
+
|
|
186
|
+
options:
|
|
187
|
+
-h, --help show this help message and exit
|
|
188
|
+
--output_dir OUTPUT_DIR
|
|
189
|
+
Output folder (default: current working directory)
|
|
190
|
+
|
|
191
|
+
$ shark-dive "<query-fasta-file>.fasta" "<target-fasta-file>.fasta"
|
|
192
|
+
Read fasta file from path <query-fasta-file>.fasta; Found 4 sequences; Skipped 0 sequences for having X
|
|
193
|
+
Read fasta file from path <target-fasta-file>.fasta; Found 6 sequences; Skipped 0 sequences for having X
|
|
194
|
+
Output stored at <OUTPUT_DIR>/<path-to-sequence-fasta-file>.fasta.csv
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
- Output CSV has the following column headers:
|
|
198
|
+
- (1) "Query": Fasta ID of sequence from Query list
|
|
199
|
+
- (2) "Target": Fasta ID of sequence from Target list
|
|
200
|
+
- (3..12) "SHARK-Score (k=*)": Similarity score between the two sequences for specific k-value
|
|
201
|
+
- (13) "SHARK-Dive": Aggregated similarity score over all lengths of k-mer
|
|
202
|
+
|
|
203
|
+
## Publication
|
|
204
|
+
### SHARK enables homology assessment in unalignable and disordered sequences
|
|
205
|
+
`Chi Fung Willis Chow, Soumyadeep Ghosh, Anna Hadarovich, Agnes Toth-Petroczy*`
|
|
206
|
+
|
|
207
|
+
_Accepted_
|
|
208
|
+
|
|
209
|
+
Biorxiv link: https://www.biorxiv.org/content/10.1101/2023.06.26.546490v1
|
|
210
|
+
|
|
211
|
+
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.
|
|
212
|
+
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
<img src="https://git.mpi-cbg.de/tothpetroczylab/shark/-/raw/master/branding/logo/SharkDive_logo.png" width="300">
|
|
3
|
+
</h1><br>
|
|
4
|
+
|
|
5
|
+
# SHARK (Similarity/Homology Assessment by Relating K-mers)
|
|
6
|
+
|
|
7
|
+
To accurately assess homology between unalignable sequences, we developed an alignment-free sequence comparison algorithm, SHARK (Similarity/Homology Assessment by Relating K-mers).
|
|
8
|
+
|
|
9
|
+
## SHARK-dive
|
|
10
|
+
|
|
11
|
+
We trained SHARK-dive, a machine learning homology classifier, which achieved superior performance to standard alignment in assessing homology in unalignable sequences, and correctly identified dissimilar IDRs capable of functional rescue in IDR-replacement experiments reported in the literature.
|
|
12
|
+
|
|
13
|
+
### 1. Dive-Score
|
|
14
|
+
Scoring the similarity between a pair of sequence
|
|
15
|
+
|
|
16
|
+
Variants:
|
|
17
|
+
1. Normal (`SHARK-score (T)`)
|
|
18
|
+
2. Sparse (`SHARK-score (best)`)
|
|
19
|
+
|
|
20
|
+
### 2. Dive-Predict
|
|
21
|
+
Find sequences similar to a given query from a target set
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## User Section
|
|
25
|
+
|
|
26
|
+
### Installation
|
|
27
|
+
|
|
28
|
+
SHARK officially supports Python versions >=3.9,<3.12.
|
|
29
|
+
|
|
30
|
+
**Recommended** Use within a local python virtual environment
|
|
31
|
+
|
|
32
|
+
```shell
|
|
33
|
+
python3 -m venv /path/to/new/virtual/environment
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
#### SHARK is installable from PyPI soon
|
|
37
|
+
|
|
38
|
+
```shell
|
|
39
|
+
$ pip install bio-shark
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
#### SHARK is also installable from source
|
|
43
|
+
|
|
44
|
+
* This allows users to import functionalities as a python package
|
|
45
|
+
* This also allows user to run the functionalities as a command line utility
|
|
46
|
+
|
|
47
|
+
```shell
|
|
48
|
+
$ git clone git@git.mpi-cbg.de:tothpetroczylab/shark.git
|
|
49
|
+
```
|
|
50
|
+
Once you have a copy of the source, you can embed it in your own Python package, or install it into your site-packages easily.
|
|
51
|
+
|
|
52
|
+
```shell
|
|
53
|
+
# Make sure you have the required Python version installed
|
|
54
|
+
$ python3 --version
|
|
55
|
+
Python 3.11.5
|
|
56
|
+
|
|
57
|
+
$ cd shark
|
|
58
|
+
$ python3 -m venv shark-env
|
|
59
|
+
$ source shark-env/bin/activate
|
|
60
|
+
$ (shark-env) % python -m pip install .
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
#### SHARK is also installable from GitLab source directly
|
|
64
|
+
|
|
65
|
+
```shell
|
|
66
|
+
$ pip install git+https://git.mpi-cbg.de/tothpetroczylab/shark.git
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### How to use?
|
|
70
|
+
|
|
71
|
+
### 1. Dive
|
|
72
|
+
|
|
73
|
+
#### 1.1. Scoring: Given two protein sequences and a k-mer length (1 to 20), score the similarity b/w them
|
|
74
|
+
|
|
75
|
+
##### Inputs
|
|
76
|
+
|
|
77
|
+
1. Protein Sequence 1
|
|
78
|
+
2. Protein Sequence 2
|
|
79
|
+
3. Scoring-variant: Normal (`SHARK-score (T)`)/ Sparse (`SHARK-score (best)`)
|
|
80
|
+
1. Threshold (for "Normal")
|
|
81
|
+
4. K-Mer Length (Should be <= smallest_len(sequences))
|
|
82
|
+
|
|
83
|
+
##### 1.1.1. As a command-line utility
|
|
84
|
+
* Run the command `shark-score`
|
|
85
|
+
* Enter sequences when command prompts
|
|
86
|
+
* Enter the variant (1/2) when the command prompts
|
|
87
|
+
|
|
88
|
+
```shell
|
|
89
|
+
% shark-score
|
|
90
|
+
Enter Sequence 1:
|
|
91
|
+
> SSSSPINTHGVSTTVPSSNNTIIPSSDGVSLSQTDYFDTVHNRQSPSRRESPVTVFRQPSLSHSKSLHKDSKNKVPQISTNQSHPSAVSTANTPGPSPN
|
|
92
|
+
Enter Sequence 2:
|
|
93
|
+
> VAEREFNGRSNSLHANFTSPVPRTVLDHHRHELTFCNPNNTTGFKTITPSPPTQHQSILPTAVDNVPRSKSVSSLPVSGFPPLIVKQQQQQQLNSSSSASALPSIHSPLTNEH
|
|
94
|
+
Enter k-mer length (integer 1 - 10): > 5
|
|
95
|
+
Press: 1. Normal; 2. Sparse
|
|
96
|
+
> 1
|
|
97
|
+
Enter threshold:
|
|
98
|
+
>0.8
|
|
99
|
+
Similarity Score: 0.6552442773
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
##### 1.1.2. As an imported python package
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
from bio_shark.core import utils
|
|
106
|
+
from bio_shark.dive.run import run_normal, run_sparse
|
|
107
|
+
|
|
108
|
+
dive_t_score = run_normal(
|
|
109
|
+
sequence1="LASIDPTFKAN",
|
|
110
|
+
sequence2="ERQKNGGKSDSDDDEPAAKKKVEYPIAAAPPMMMP",
|
|
111
|
+
k=3,
|
|
112
|
+
threshold=0.8
|
|
113
|
+
) # Compute SHARK-score (T)
|
|
114
|
+
|
|
115
|
+
dive_best_score = run_sparse(
|
|
116
|
+
sequence1="LASIDPTFKAN",
|
|
117
|
+
sequence2="ERQKNGGKSDSDDDEPAAKKKVEYPIAAAPPMMMP",
|
|
118
|
+
k=3,
|
|
119
|
+
) # Compute SHARK-score (best)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
#### 1.2. Similarity Prediction
|
|
123
|
+
|
|
124
|
+
##### 1.2.1. As an imported python package
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
from bio_shark.dive.prediction import Prediction
|
|
128
|
+
|
|
129
|
+
predictor = Prediction(q_sequence_id_map=<dict-fasta-id-seq>, t_sequence_id_map=<dict-fasta-id-seq>)
|
|
130
|
+
|
|
131
|
+
expected_out_keys = ['seq_id1', 'sequence1', 'seq_id2', 'sequence2', 'similarity_scores_k', 'pred_label', 'pred_proba']
|
|
132
|
+
output = predictor.predict() # List of output objects; Each element is for one pair
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
##### 1.2.2. As a command-line utility
|
|
136
|
+
- Run the command `shark-dive` with the absolute path of the sequence fasta files as only argument
|
|
137
|
+
- Sequences should be of length > 10, since `prediction` is always based on scores of k = [1..10]
|
|
138
|
+
- _You may use the `sample_fasta_file.fasta` from `data` folder (Owncloud link)_
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
```shell
|
|
142
|
+
usage: shark-dive [-h] [--output_dir OUTPUT_DIR] query target
|
|
143
|
+
|
|
144
|
+
DIVE-Predict: Given some query sequences, compute their similarity from the list of target sequences;Target is
|
|
145
|
+
supposed to be major database of protein sequences
|
|
146
|
+
|
|
147
|
+
positional arguments:
|
|
148
|
+
query Absolute path to fasta file for the query set of input sequences
|
|
149
|
+
target Absolute path to fasta file for the target set of input sequences
|
|
150
|
+
|
|
151
|
+
options:
|
|
152
|
+
-h, --help show this help message and exit
|
|
153
|
+
--output_dir OUTPUT_DIR
|
|
154
|
+
Output folder (default: current working directory)
|
|
155
|
+
|
|
156
|
+
$ shark-dive "<query-fasta-file>.fasta" "<target-fasta-file>.fasta"
|
|
157
|
+
Read fasta file from path <query-fasta-file>.fasta; Found 4 sequences; Skipped 0 sequences for having X
|
|
158
|
+
Read fasta file from path <target-fasta-file>.fasta; Found 6 sequences; Skipped 0 sequences for having X
|
|
159
|
+
Output stored at <OUTPUT_DIR>/<path-to-sequence-fasta-file>.fasta.csv
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
- Output CSV has the following column headers:
|
|
163
|
+
- (1) "Query": Fasta ID of sequence from Query list
|
|
164
|
+
- (2) "Target": Fasta ID of sequence from Target list
|
|
165
|
+
- (3..12) "SHARK-Score (k=*)": Similarity score between the two sequences for specific k-value
|
|
166
|
+
- (13) "SHARK-Dive": Aggregated similarity score over all lengths of k-mer
|
|
167
|
+
|
|
168
|
+
## Publication
|
|
169
|
+
### SHARK enables homology assessment in unalignable and disordered sequences
|
|
170
|
+
`Chi Fung Willis Chow, Soumyadeep Ghosh, Anna Hadarovich, Agnes Toth-Petroczy*`
|
|
171
|
+
|
|
172
|
+
_Accepted_
|
|
173
|
+
|
|
174
|
+
Biorxiv link: https://www.biorxiv.org/content/10.1101/2023.06.26.546490v1
|
|
175
|
+
|
|
176
|
+
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.
|
|
177
|
+
|
|
178
|
+
## Developer section
|
|
179
|
+
|
|
180
|
+
The following directory structure allows a developer to understand the codebase
|
|
181
|
+
|
|
182
|
+
### Directory Structure
|
|
183
|
+
```
|
|
184
|
+
|-- src # Package root
|
|
185
|
+
|-- core # Core logic of sequence similarity matrix and common utilities
|
|
186
|
+
|-- dive # Source code/logic functions related to "Dive"
|
|
187
|
+
|-- data # Local folder: Data directory
|
|
188
|
+
|-- tests # Unit tests
|
|
189
|
+
|-- requirements.txt # Packages required for the project
|
|
190
|
+
|-- README.md
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
#### Simply run all unit-tests
|
|
195
|
+
1. Install test dependencies `pip install -r test-requirements.txt`
|
|
196
|
+
2. Run `python3 -m unittest`
|
|
197
|
+
|
|
198
|
+
Generate coverage:
|
|
199
|
+
|
|
200
|
+
```shell
|
|
201
|
+
$ coverage run -m unittest
|
|
202
|
+
$ coverage report
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
#### Packaging and distribution
|
|
207
|
+
|
|
208
|
+
The project can be found here https://pypi.org/project/bio-shark/. An API token is required from PyPI to upload a distribution.
|
|
209
|
+
|
|
210
|
+
##### How to build the bio-shark package from the project root directory?
|
|
211
|
+
|
|
212
|
+
```shell
|
|
213
|
+
(packaging) $ python3 -m pip install --upgrade build
|
|
214
|
+
(packaging) $ python3 -m build
|
|
215
|
+
|
|
216
|
+
(packaging) $ ls -l dist
|
|
217
|
+
bio-shark-1.0.0b1.tar.gz
|
|
218
|
+
bio-shark-1.0.0b1-py3-none-any.whl
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### How to upload distribution files to PyPI?
|
|
222
|
+
|
|
223
|
+
Finally, we need to upload these files to PyPI using Twine. Use the following command from the project root
|
|
224
|
+
directory. Enter the PyPI credentials to complete uploading the package.
|
|
225
|
+
|
|
226
|
+
```shell
|
|
227
|
+
(packaging) $ python3 -m pip install --upgrade twine
|
|
228
|
+
|
|
229
|
+
# Run a check on the distribution files
|
|
230
|
+
(packaging) $ twine check dist/*
|
|
231
|
+
|
|
232
|
+
# Perform a test upload on testPyPI
|
|
233
|
+
(packaging) $ twine upload --repository testpypi dist/*
|
|
234
|
+
|
|
235
|
+
# Finally upload the distribution to PyPI
|
|
236
|
+
(packaging) $ twine upload dist/*
|
|
237
|
+
```
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: bio-shark
|
|
3
|
+
Version: 1.2.1
|
|
4
|
+
Summary: SHARK (Similarity/Homology Assessment by Relating K-mers)
|
|
5
|
+
Home-page: https://git.mpi-cbg.de/tothpetroczylab/shark
|
|
6
|
+
Author: Willis Chow <chow@mpi-cbg.de>, Soumyadeep Ghosh <soumyadeep11194@gmail.com>, Anna Hadarovich <hadarovi@mpi-cbg.de>, Agnes Toth-Petroczy <tothpet@mpi-cbg.de>, Maxim Scheremetjew <schereme@mpi-cbg.de>
|
|
7
|
+
Author-email: chow@mpi-cbg.de
|
|
8
|
+
Project-URL: Homepage, https://git.mpi-cbg.de/tothpetroczylab/shark
|
|
9
|
+
Project-URL: Documentation, https://git.mpi-cbg.de/tothpetroczylab/shark/-/blob/master/README.md
|
|
10
|
+
Project-URL: Funding, https://www.mpi-cbg.de/
|
|
11
|
+
Project-URL: Repository, https://git.mpi-cbg.de/tothpetroczylab/shark
|
|
12
|
+
Project-URL: Issue tracker, https://git.mpi-cbg.de/tothpetroczylab/shark/-/issues
|
|
13
|
+
Keywords: intrinsically disordered protein regions,motif detection,IDRs,sequence-to-function,alignment-free,machine learning,homology detection
|
|
14
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
18
|
+
Classifier: Programming Language :: Python
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
24
|
+
Classifier: Operating System :: Unix
|
|
25
|
+
Classifier: Operating System :: MacOS
|
|
26
|
+
Requires-Python: >=3.9,<3.12
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
License-File: LICENSE
|
|
29
|
+
Requires-Dist: requests~=2.31.0
|
|
30
|
+
Requires-Dist: catboost~=1.2
|
|
31
|
+
Requires-Dist: matplotlib~=3.8.2
|
|
32
|
+
Requires-Dist: pandas~=2.1.3
|
|
33
|
+
Requires-Dist: logomaker~=0.8
|
|
34
|
+
Requires-Dist: alfpy~=1.0.6
|
|
35
|
+
|
|
36
|
+
<h1 align="center">
|
|
37
|
+
<img src="https://git.mpi-cbg.de/tothpetroczylab/shark/-/raw/master/branding/logo/SharkDive_logo.png" width="300">
|
|
38
|
+
</h1><br>
|
|
39
|
+
|
|
40
|
+
# SHARK (Similarity/Homology Assessment by Relating K-mers)
|
|
41
|
+
|
|
42
|
+
To accurately assess homology between unalignable sequences, we developed an alignment-free sequence comparison algorithm, SHARK (Similarity/Homology Assessment by Relating K-mers).
|
|
43
|
+
|
|
44
|
+
## SHARK-dive
|
|
45
|
+
|
|
46
|
+
We trained SHARK-dive, a machine learning homology classifier, which achieved superior performance to standard alignment in assessing homology in unalignable sequences, and correctly identified dissimilar IDRs capable of functional rescue in IDR-replacement experiments reported in the literature.
|
|
47
|
+
|
|
48
|
+
### 1. Dive-Score
|
|
49
|
+
Scoring the similarity between a pair of sequence
|
|
50
|
+
|
|
51
|
+
Variants:
|
|
52
|
+
1. Normal (`SHARK-score (T)`)
|
|
53
|
+
2. Sparse (`SHARK-score (best)`)
|
|
54
|
+
|
|
55
|
+
### 2. Dive-Predict
|
|
56
|
+
Find sequences similar to a given query from a target set
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
## User Section
|
|
60
|
+
|
|
61
|
+
### Installation
|
|
62
|
+
|
|
63
|
+
SHARK officially supports Python versions >=3.9,<3.12.
|
|
64
|
+
|
|
65
|
+
**Recommended** Use within a local python virtual environment
|
|
66
|
+
|
|
67
|
+
```shell
|
|
68
|
+
python3 -m venv /path/to/new/virtual/environment
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
#### SHARK is installable from PyPI soon
|
|
72
|
+
|
|
73
|
+
```shell
|
|
74
|
+
$ pip install bio-shark
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
#### SHARK is also installable from source
|
|
78
|
+
|
|
79
|
+
* This allows users to import functionalities as a python package
|
|
80
|
+
* This also allows user to run the functionalities as a command line utility
|
|
81
|
+
|
|
82
|
+
```shell
|
|
83
|
+
$ git clone git@git.mpi-cbg.de:tothpetroczylab/shark.git
|
|
84
|
+
```
|
|
85
|
+
Once you have a copy of the source, you can embed it in your own Python package, or install it into your site-packages easily.
|
|
86
|
+
|
|
87
|
+
```shell
|
|
88
|
+
# Make sure you have the required Python version installed
|
|
89
|
+
$ python3 --version
|
|
90
|
+
Python 3.11.5
|
|
91
|
+
|
|
92
|
+
$ cd shark
|
|
93
|
+
$ python3 -m venv shark-env
|
|
94
|
+
$ source shark-env/bin/activate
|
|
95
|
+
$ (shark-env) % python -m pip install .
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
#### SHARK is also installable from GitLab source directly
|
|
99
|
+
|
|
100
|
+
```shell
|
|
101
|
+
$ pip install git+https://git.mpi-cbg.de/tothpetroczylab/shark.git
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### How to use?
|
|
105
|
+
|
|
106
|
+
### 1. Dive
|
|
107
|
+
|
|
108
|
+
#### 1.1. Scoring: Given two protein sequences and a k-mer length (1 to 20), score the similarity b/w them
|
|
109
|
+
|
|
110
|
+
##### Inputs
|
|
111
|
+
|
|
112
|
+
1. Protein Sequence 1
|
|
113
|
+
2. Protein Sequence 2
|
|
114
|
+
3. Scoring-variant: Normal (`SHARK-score (T)`)/ Sparse (`SHARK-score (best)`)
|
|
115
|
+
1. Threshold (for "Normal")
|
|
116
|
+
4. K-Mer Length (Should be <= smallest_len(sequences))
|
|
117
|
+
|
|
118
|
+
##### 1.1.1. As a command-line utility
|
|
119
|
+
* Run the command `shark-score`
|
|
120
|
+
* Enter sequences when command prompts
|
|
121
|
+
* Enter the variant (1/2) when the command prompts
|
|
122
|
+
|
|
123
|
+
```shell
|
|
124
|
+
% shark-score
|
|
125
|
+
Enter Sequence 1:
|
|
126
|
+
> SSSSPINTHGVSTTVPSSNNTIIPSSDGVSLSQTDYFDTVHNRQSPSRRESPVTVFRQPSLSHSKSLHKDSKNKVPQISTNQSHPSAVSTANTPGPSPN
|
|
127
|
+
Enter Sequence 2:
|
|
128
|
+
> VAEREFNGRSNSLHANFTSPVPRTVLDHHRHELTFCNPNNTTGFKTITPSPPTQHQSILPTAVDNVPRSKSVSSLPVSGFPPLIVKQQQQQQLNSSSSASALPSIHSPLTNEH
|
|
129
|
+
Enter k-mer length (integer 1 - 10): > 5
|
|
130
|
+
Press: 1. Normal; 2. Sparse
|
|
131
|
+
> 1
|
|
132
|
+
Enter threshold:
|
|
133
|
+
>0.8
|
|
134
|
+
Similarity Score: 0.6552442773
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
##### 1.1.2. As an imported python package
|
|
138
|
+
|
|
139
|
+
```python
|
|
140
|
+
from bio_shark.core import utils
|
|
141
|
+
from bio_shark.dive.run import run_normal, run_sparse
|
|
142
|
+
|
|
143
|
+
dive_t_score = run_normal(
|
|
144
|
+
sequence1="LASIDPTFKAN",
|
|
145
|
+
sequence2="ERQKNGGKSDSDDDEPAAKKKVEYPIAAAPPMMMP",
|
|
146
|
+
k=3,
|
|
147
|
+
threshold=0.8
|
|
148
|
+
) # Compute SHARK-score (T)
|
|
149
|
+
|
|
150
|
+
dive_best_score = run_sparse(
|
|
151
|
+
sequence1="LASIDPTFKAN",
|
|
152
|
+
sequence2="ERQKNGGKSDSDDDEPAAKKKVEYPIAAAPPMMMP",
|
|
153
|
+
k=3,
|
|
154
|
+
) # Compute SHARK-score (best)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
#### 1.2. Similarity Prediction
|
|
158
|
+
|
|
159
|
+
##### 1.2.1. As an imported python package
|
|
160
|
+
|
|
161
|
+
```python
|
|
162
|
+
from bio_shark.dive.prediction import Prediction
|
|
163
|
+
|
|
164
|
+
predictor = Prediction(q_sequence_id_map=<dict-fasta-id-seq>, t_sequence_id_map=<dict-fasta-id-seq>)
|
|
165
|
+
|
|
166
|
+
expected_out_keys = ['seq_id1', 'sequence1', 'seq_id2', 'sequence2', 'similarity_scores_k', 'pred_label', 'pred_proba']
|
|
167
|
+
output = predictor.predict() # List of output objects; Each element is for one pair
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
##### 1.2.2. As a command-line utility
|
|
171
|
+
- Run the command `shark-dive` with the absolute path of the sequence fasta files as only argument
|
|
172
|
+
- Sequences should be of length > 10, since `prediction` is always based on scores of k = [1..10]
|
|
173
|
+
- _You may use the `sample_fasta_file.fasta` from `data` folder (Owncloud link)_
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
```shell
|
|
177
|
+
usage: shark-dive [-h] [--output_dir OUTPUT_DIR] query target
|
|
178
|
+
|
|
179
|
+
DIVE-Predict: Given some query sequences, compute their similarity from the list of target sequences;Target is
|
|
180
|
+
supposed to be major database of protein sequences
|
|
181
|
+
|
|
182
|
+
positional arguments:
|
|
183
|
+
query Absolute path to fasta file for the query set of input sequences
|
|
184
|
+
target Absolute path to fasta file for the target set of input sequences
|
|
185
|
+
|
|
186
|
+
options:
|
|
187
|
+
-h, --help show this help message and exit
|
|
188
|
+
--output_dir OUTPUT_DIR
|
|
189
|
+
Output folder (default: current working directory)
|
|
190
|
+
|
|
191
|
+
$ shark-dive "<query-fasta-file>.fasta" "<target-fasta-file>.fasta"
|
|
192
|
+
Read fasta file from path <query-fasta-file>.fasta; Found 4 sequences; Skipped 0 sequences for having X
|
|
193
|
+
Read fasta file from path <target-fasta-file>.fasta; Found 6 sequences; Skipped 0 sequences for having X
|
|
194
|
+
Output stored at <OUTPUT_DIR>/<path-to-sequence-fasta-file>.fasta.csv
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
- Output CSV has the following column headers:
|
|
198
|
+
- (1) "Query": Fasta ID of sequence from Query list
|
|
199
|
+
- (2) "Target": Fasta ID of sequence from Target list
|
|
200
|
+
- (3..12) "SHARK-Score (k=*)": Similarity score between the two sequences for specific k-value
|
|
201
|
+
- (13) "SHARK-Dive": Aggregated similarity score over all lengths of k-mer
|
|
202
|
+
|
|
203
|
+
## Publication
|
|
204
|
+
### SHARK enables homology assessment in unalignable and disordered sequences
|
|
205
|
+
`Chi Fung Willis Chow, Soumyadeep Ghosh, Anna Hadarovich, Agnes Toth-Petroczy*`
|
|
206
|
+
|
|
207
|
+
_Accepted_
|
|
208
|
+
|
|
209
|
+
Biorxiv link: https://www.biorxiv.org/content/10.1101/2023.06.26.546490v1
|
|
210
|
+
|
|
211
|
+
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.
|
|
212
|
+
|