metapredict 2.4.2__tar.gz → 2.5__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.
Files changed (90) hide show
  1. {metapredict-2.4.2 → metapredict-2.5}/PKG-INFO +50 -3
  2. {metapredict-2.4.2 → metapredict-2.5}/README.md +49 -2
  3. {metapredict-2.4.2 → metapredict-2.5}/metapredict/.DS_Store +0 -0
  4. {metapredict-2.4.2 → metapredict-2.5}/metapredict/_version.py +3 -3
  5. {metapredict-2.4.2 → metapredict-2.5}/metapredict/backend/.DS_Store +0 -0
  6. {metapredict-2.4.2 → metapredict-2.5}/metapredict/backend/meta_tools.py +72 -2
  7. {metapredict-2.4.2 → metapredict-2.5}/metapredict/meta.py +16 -1
  8. {metapredict-2.4.2 → metapredict-2.5}/metapredict.egg-info/PKG-INFO +50 -3
  9. {metapredict-2.4.2 → metapredict-2.5}/metapredict.egg-info/SOURCES.txt +1 -0
  10. metapredict-2.5/scripts/metapredict-multipredict +108 -0
  11. {metapredict-2.4.2 → metapredict-2.5}/scripts/metapredict-predict-idrs +14 -5
  12. {metapredict-2.4.2 → metapredict-2.5}/setup.py +2 -1
  13. {metapredict-2.4.2 → metapredict-2.5}/.codecov.yml +0 -0
  14. {metapredict-2.4.2 → metapredict-2.5}/.gitignore +0 -0
  15. {metapredict-2.4.2 → metapredict-2.5}/.lgtm.yml +0 -0
  16. {metapredict-2.4.2 → metapredict-2.5}/.travis.yml +0 -0
  17. {metapredict-2.4.2 → metapredict-2.5}/CODE_OF_CONDUCT.md +0 -0
  18. {metapredict-2.4.2 → metapredict-2.5}/LICENSE +0 -0
  19. {metapredict-2.4.2 → metapredict-2.5}/MANIFEST.in +0 -0
  20. {metapredict-2.4.2 → metapredict-2.5}/devtools/README.md +0 -0
  21. {metapredict-2.4.2 → metapredict-2.5}/devtools/conda-envs/test_env.yaml +0 -0
  22. {metapredict-2.4.2 → metapredict-2.5}/devtools/scripts/create_conda_env.py +0 -0
  23. {metapredict-2.4.2 → metapredict-2.5}/devtools/travis-ci/before_install.sh +0 -0
  24. {metapredict-2.4.2 → metapredict-2.5}/docs/.DS_Store +0 -0
  25. {metapredict-2.4.2 → metapredict-2.5}/docs/Makefile +0 -0
  26. {metapredict-2.4.2 → metapredict-2.5}/docs/README.md +0 -0
  27. {metapredict-2.4.2 → metapredict-2.5}/docs/_static/README.md +0 -0
  28. {metapredict-2.4.2 → metapredict-2.5}/docs/_templates/README.md +0 -0
  29. {metapredict-2.4.2 → metapredict-2.5}/docs/changes.rst +0 -0
  30. {metapredict-2.4.2 → metapredict-2.5}/docs/conf.py +0 -0
  31. {metapredict-2.4.2 → metapredict-2.5}/docs/getting_started.rst +0 -0
  32. {metapredict-2.4.2 → metapredict-2.5}/docs/how_to_cite.rst +0 -0
  33. {metapredict-2.4.2 → metapredict-2.5}/docs/images/confidence_scores_disorder.png +0 -0
  34. {metapredict-2.4.2 → metapredict-2.5}/docs/images/meta_predict_disorder.png +0 -0
  35. {metapredict-2.4.2 → metapredict-2.5}/docs/images/python_meta_predict_MadeUpProtein.png +0 -0
  36. {metapredict-2.4.2 → metapredict-2.5}/docs/index.rst +0 -0
  37. {metapredict-2.4.2 → metapredict-2.5}/docs/make.bat +0 -0
  38. {metapredict-2.4.2 → metapredict-2.5}/docs/requirements.txt +0 -0
  39. {metapredict-2.4.2 → metapredict-2.5}/docs/usage/acknowledgements.rst +0 -0
  40. {metapredict-2.4.2 → metapredict-2.5}/docs/usage/api.rst +0 -0
  41. {metapredict-2.4.2 → metapredict-2.5}/docs/usage/command-line.rst +0 -0
  42. {metapredict-2.4.2 → metapredict-2.5}/docs/usage/troubleshooting.rst +0 -0
  43. {metapredict-2.4.2 → metapredict-2.5}/docs/usage/using-in-python.rst +0 -0
  44. {metapredict-2.4.2 → metapredict-2.5}/metapredict/__init__.py +0 -0
  45. {metapredict-2.4.2 → metapredict-2.5}/metapredict/backend/brnn_architecture.py +0 -0
  46. {metapredict-2.4.2 → metapredict-2.5}/metapredict/backend/data_structures.py +0 -0
  47. {metapredict-2.4.2 → metapredict-2.5}/metapredict/backend/domain_definition.py +0 -0
  48. {metapredict-2.4.2 → metapredict-2.5}/metapredict/backend/encode_sequence.py +0 -0
  49. {metapredict-2.4.2 → metapredict-2.5}/metapredict/backend/meta_graph.py +0 -0
  50. {metapredict-2.4.2 → metapredict-2.5}/metapredict/backend/meta_predict_disorder.py +0 -0
  51. {metapredict-2.4.2 → metapredict-2.5}/metapredict/backend/metameta_hybrid_predict.py +0 -0
  52. {metapredict-2.4.2 → metapredict-2.5}/metapredict/backend/networks/.DS_Store +0 -0
  53. {metapredict-2.4.2 → metapredict-2.5}/metapredict/backend/networks/metaDisorder.pt +0 -0
  54. {metapredict-2.4.2 → metapredict-2.5}/metapredict/backend/networks/meta_predict_disorder_100e_v1.pt +0 -0
  55. {metapredict-2.4.2 → metapredict-2.5}/metapredict/backend/networks/metameta_2_7_22_nl2_hs20_b32_V3.pt +0 -0
  56. {metapredict-2.4.2 → metapredict-2.5}/metapredict/backend/networks/metapredict_network_v2_200epochs_nl1_hs20.pt +0 -0
  57. {metapredict-2.4.2 → metapredict-2.5}/metapredict/backend/networks/metapredict_network_v3_200epochs_nl2_hs20.pt +0 -0
  58. {metapredict-2.4.2 → metapredict-2.5}/metapredict/backend/py_predictor_v2.py +0 -0
  59. {metapredict-2.4.2 → metapredict-2.5}/metapredict/backend/uniprot_predictions.py +0 -0
  60. {metapredict-2.4.2 → metapredict-2.5}/metapredict/data/README.md +0 -0
  61. {metapredict-2.4.2 → metapredict-2.5}/metapredict/data/test_data.fasta +0 -0
  62. {metapredict-2.4.2 → metapredict-2.5}/metapredict/metapredict_exceptions.py +0 -0
  63. {metapredict-2.4.2 → metapredict-2.5}/metapredict/parameters.py +0 -0
  64. {metapredict-2.4.2 → metapredict-2.5}/metapredict/tests/.DS_Store +0 -0
  65. {metapredict-2.4.2 → metapredict-2.5}/metapredict/tests/__init__.py +0 -0
  66. {metapredict-2.4.2 → metapredict-2.5}/metapredict/tests/input_data/DisorderPredictionssp_P04637_P53_HUMANC.txt +0 -0
  67. {metapredict-2.4.2 → metapredict-2.5}/metapredict/tests/input_data/testing.fasta +0 -0
  68. {metapredict-2.4.2 → metapredict-2.5}/metapredict/tests/input_data/three_seqs.fasta +0 -0
  69. {metapredict-2.4.2 → metapredict-2.5}/metapredict/tests/local_data.py +0 -0
  70. {metapredict-2.4.2 → metapredict-2.5}/metapredict/tests/output/test.csv +0 -0
  71. {metapredict-2.4.2 → metapredict-2.5}/metapredict/tests/test_domain_functions.py +0 -0
  72. {metapredict-2.4.2 → metapredict-2.5}/metapredict/tests/test_graph_disorder.py +0 -0
  73. {metapredict-2.4.2 → metapredict-2.5}/metapredict/tests/test_graph_fasta.py +0 -0
  74. {metapredict-2.4.2 → metapredict-2.5}/metapredict/tests/test_metapredict.py +0 -0
  75. {metapredict-2.4.2 → metapredict-2.5}/metapredict/tests/test_uniprot_functionality.py +0 -0
  76. {metapredict-2.4.2 → metapredict-2.5}/metapredict/tests/test_write_fasta.py +0 -0
  77. {metapredict-2.4.2 → metapredict-2.5}/metapredict.egg-info/dependency_links.txt +0 -0
  78. {metapredict-2.4.2 → metapredict-2.5}/metapredict.egg-info/requires.txt +0 -0
  79. {metapredict-2.4.2 → metapredict-2.5}/metapredict.egg-info/top_level.txt +0 -0
  80. {metapredict-2.4.2 → metapredict-2.5}/readthedocs.yml +0 -0
  81. {metapredict-2.4.2 → metapredict-2.5}/scripts/metapredict-graph-disorder +0 -0
  82. {metapredict-2.4.2 → metapredict-2.5}/scripts/metapredict-graph-pLDDT +0 -0
  83. {metapredict-2.4.2 → metapredict-2.5}/scripts/metapredict-name +0 -0
  84. {metapredict-2.4.2 → metapredict-2.5}/scripts/metapredict-predict-disorder +0 -0
  85. {metapredict-2.4.2 → metapredict-2.5}/scripts/metapredict-predict-pLDDT +0 -0
  86. {metapredict-2.4.2 → metapredict-2.5}/scripts/metapredict-quick-graph +0 -0
  87. {metapredict-2.4.2 → metapredict-2.5}/scripts/metapredict-quick-predict +0 -0
  88. {metapredict-2.4.2 → metapredict-2.5}/scripts/metapredict-uniprot +0 -0
  89. {metapredict-2.4.2 → metapredict-2.5}/setup.cfg +0 -0
  90. {metapredict-2.4.2 → metapredict-2.5}/versioneer.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: metapredict
3
- Version: 2.4.2
3
+ Version: 2.5
4
4
  Summary: UNKNOWN
5
5
  Home-page: https://github.com/idptools/metapredict.git
6
6
  Author: Ryan Emenecker - Holehouse Lab - WUSM
@@ -14,9 +14,16 @@ License-File: LICENSE
14
14
  # metapredict: A machine learning-based tool for predicting protein disorder.
15
15
 
16
16
  **Important update** - as of February 15, 2022 we have updated metapredict to V2.0. This comes with important changes that improve the accuracy of metapredict. Please see the section on the update *Major update to metapredict predictions to increase overall accuracy* below. In addition, this update changes the functionality of the *predict_disorder_domains()* function, so please read the documentation on that function if you were using it previously.
17
- *A write up with more info on this update will be available soon.*
18
17
 
19
- **metapredict** uses a bidirectional recurrent neural network trained on the consensus disorder values from 8 disorder predictors from 12 proteomes that were obtained from [MobiDB](https://mobidb.bio.unipd.it/). The creation of metapredict was made possible by [parrot](https://github.com/idptools/parrot).
18
+ **metapredict** uses a bidirectional recurrent neural network trained on the consensus disorder values from 8 disorder predictors from 12 proteomes that were obtained from [MobiDB](https://mobidb.bio.unipd.it/). In addition, as of version 2, metapredict incorporates an additional layer of predictions by counter-selecting based on structure predictions from AlphaFold2. The creation of metapredict was made possible by [parrot](https://github.com/idptools/parrot).
19
+
20
+ ## How can I use metapredict?
21
+ Metapredict can be used in four different ways:
22
+
23
+ 1. As a stand-alone command-line tool (installable via pip - the code in this repository).
24
+ 2. As a Python library for integrating into your favorite bioinformatics pipeline (installable via pip - the code in this repository).
25
+ 3. As a web-server for examining disorder predictions on individual sequences found at [https://metapredict.net/](https://metapredict.net/).
26
+ 4. *NEW as of August 2022:* as a Google Colab notebook for batch-predicting disorder scores for larger numbers of sequences: [**LINK HERE**](https://colab.research.google.com/drive/1UOrOxun9i23XDE8lFo_4I89Tw8P3Z1D-?usp=sharing). Performance-wise, batch mode can predict the entire yeast proteome in ~6 min.
20
27
 
21
28
 
22
29
 
@@ -62,6 +69,12 @@ https://metapredict.readthedocs.io/en/latest/getting_started.html
62
69
  For disorder predictions using our server, please see:
63
70
  https://metapredict.net
64
71
 
72
+
73
+ ## What's new?
74
+
75
+ The most recent update to metapredict on March 15, 2023 introduced multiprocessing support to the command-line interface (you're welcome, Jeff). This is only implemented for the CLI at this time. **We were able to predict disorder in the entire human proteome in about 4 minutes with metapredict V2 and in about 2 minutes using legacy metapredict!** *We didn't even have to close the 40 chrome tabs we definitely had to have open for testing.* If there is additional interest in speeding up other functionality by using multiple cores, let us know!
76
+
77
+
65
78
  ## How to cite metapredict
66
79
 
67
80
  If you use metapredict for your work, please cite the metapredict paper -
@@ -119,6 +132,28 @@ If you would like to specify where to save the output, simply use the ``-o`` or
119
132
  **Using the original metapredict predictor**
120
133
  To use the original metapredict predictor as opposed to our new, updated predictor, use the ``-l`` or ``--legacy`` flag!
121
134
 
135
+ ### Predicting Disorder from a fasta file using multiple cores
136
+
137
+ The ``metapredict-multipredict`` command from the command line takes a .fasta file as input and returns disorder scores for the sequences in the FASTA file. It works the same as metapredict-predict-disroder but splits the sequences across the number of cores you specify. USE THIS AT YOUR OWN RISK! If you specify too many cores, you're going to have a bad time.
138
+
139
+ $ metapredict-multipredict <Path to .fasta file> <number of cores>
140
+
141
+ **Example - using 5 cores**
142
+
143
+ $ metapredict-multipredict /Users/thisUser/Desktop/interestingProteins.fasta 5
144
+
145
+ **Additional Usage**
146
+
147
+ **specifying where to save the output -**
148
+ If you would like to specify where to save the output, simply use the ``-o`` or ``--output-file`` flag and then specify the file path and file name. By default this command will save the output file as disorder_scores.csv to your current working directory. However, you can specify the file name in the output path.
149
+
150
+ **Example**
151
+
152
+ $ metapredict-multipredict /Users/thisUser/Desktop/interestingProteins.fasta 5 -o /Users/thisUser/Desktop/disorder_predictions/my_disorder_predictions.csv
153
+
154
+ **Using the original metapredict predictor**
155
+ To use the original metapredict predictor as opposed to our new, updated predictor, use the ``-l`` or ``--legacy`` flag!
156
+
122
157
  ### Predicting Disorder from a sequence
123
158
 
124
159
  ``metapredict-quick-predict`` is a command that will let you input a sequence and get disorder values immediately printed to the terminal. The only argument that can be input is the sequence.
@@ -1098,6 +1133,18 @@ Example data that can be used with metapredict can be found in the metapredict/d
1098
1133
 
1099
1134
  This section is a log of recent changes with metapredict. My hope is that as I change things, this section can help you figure out why a change was made and if it will break any of your current work flows. The first major changes were made for the 0.56 release, so tracking will start there. Reasons are not provided for bug fixes for because the reason can assumed to be fixing the bug...
1100
1135
 
1136
+
1137
+ #### V2.5
1138
+ Changes:
1139
+
1140
+ * Added the first multicore support to metapredict. Currently limited to metapredict-predict-disorder functionality.
1141
+ =======
1142
+ #### V2.4.3
1143
+ Changes:
1144
+
1145
+ * Updated the default names for `metapredict-predict-idrs` so that the FASTA output file is now called `idrs.fasta` instead of the inappropriate `shephard_idrs.tsv`.
1146
+ * Added link to the new batch-mode Google Colab notebook!
1147
+
1101
1148
  #### V2.4.2
1102
1149
  Changes:
1103
1150
 
@@ -1,9 +1,16 @@
1
1
  # metapredict: A machine learning-based tool for predicting protein disorder.
2
2
 
3
3
  **Important update** - as of February 15, 2022 we have updated metapredict to V2.0. This comes with important changes that improve the accuracy of metapredict. Please see the section on the update *Major update to metapredict predictions to increase overall accuracy* below. In addition, this update changes the functionality of the *predict_disorder_domains()* function, so please read the documentation on that function if you were using it previously.
4
- *A write up with more info on this update will be available soon.*
5
4
 
6
- **metapredict** uses a bidirectional recurrent neural network trained on the consensus disorder values from 8 disorder predictors from 12 proteomes that were obtained from [MobiDB](https://mobidb.bio.unipd.it/). The creation of metapredict was made possible by [parrot](https://github.com/idptools/parrot).
5
+ **metapredict** uses a bidirectional recurrent neural network trained on the consensus disorder values from 8 disorder predictors from 12 proteomes that were obtained from [MobiDB](https://mobidb.bio.unipd.it/). In addition, as of version 2, metapredict incorporates an additional layer of predictions by counter-selecting based on structure predictions from AlphaFold2. The creation of metapredict was made possible by [parrot](https://github.com/idptools/parrot).
6
+
7
+ ## How can I use metapredict?
8
+ Metapredict can be used in four different ways:
9
+
10
+ 1. As a stand-alone command-line tool (installable via pip - the code in this repository).
11
+ 2. As a Python library for integrating into your favorite bioinformatics pipeline (installable via pip - the code in this repository).
12
+ 3. As a web-server for examining disorder predictions on individual sequences found at [https://metapredict.net/](https://metapredict.net/).
13
+ 4. *NEW as of August 2022:* as a Google Colab notebook for batch-predicting disorder scores for larger numbers of sequences: [**LINK HERE**](https://colab.research.google.com/drive/1UOrOxun9i23XDE8lFo_4I89Tw8P3Z1D-?usp=sharing). Performance-wise, batch mode can predict the entire yeast proteome in ~6 min.
7
14
 
8
15
 
9
16
 
@@ -49,6 +56,12 @@ https://metapredict.readthedocs.io/en/latest/getting_started.html
49
56
  For disorder predictions using our server, please see:
50
57
  https://metapredict.net
51
58
 
59
+
60
+ ## What's new?
61
+
62
+ The most recent update to metapredict on March 15, 2023 introduced multiprocessing support to the command-line interface (you're welcome, Jeff). This is only implemented for the CLI at this time. **We were able to predict disorder in the entire human proteome in about 4 minutes with metapredict V2 and in about 2 minutes using legacy metapredict!** *We didn't even have to close the 40 chrome tabs we definitely had to have open for testing.* If there is additional interest in speeding up other functionality by using multiple cores, let us know!
63
+
64
+
52
65
  ## How to cite metapredict
53
66
 
54
67
  If you use metapredict for your work, please cite the metapredict paper -
@@ -106,6 +119,28 @@ If you would like to specify where to save the output, simply use the ``-o`` or
106
119
  **Using the original metapredict predictor**
107
120
  To use the original metapredict predictor as opposed to our new, updated predictor, use the ``-l`` or ``--legacy`` flag!
108
121
 
122
+ ### Predicting Disorder from a fasta file using multiple cores
123
+
124
+ The ``metapredict-multipredict`` command from the command line takes a .fasta file as input and returns disorder scores for the sequences in the FASTA file. It works the same as metapredict-predict-disroder but splits the sequences across the number of cores you specify. USE THIS AT YOUR OWN RISK! If you specify too many cores, you're going to have a bad time.
125
+
126
+ $ metapredict-multipredict <Path to .fasta file> <number of cores>
127
+
128
+ **Example - using 5 cores**
129
+
130
+ $ metapredict-multipredict /Users/thisUser/Desktop/interestingProteins.fasta 5
131
+
132
+ **Additional Usage**
133
+
134
+ **specifying where to save the output -**
135
+ If you would like to specify where to save the output, simply use the ``-o`` or ``--output-file`` flag and then specify the file path and file name. By default this command will save the output file as disorder_scores.csv to your current working directory. However, you can specify the file name in the output path.
136
+
137
+ **Example**
138
+
139
+ $ metapredict-multipredict /Users/thisUser/Desktop/interestingProteins.fasta 5 -o /Users/thisUser/Desktop/disorder_predictions/my_disorder_predictions.csv
140
+
141
+ **Using the original metapredict predictor**
142
+ To use the original metapredict predictor as opposed to our new, updated predictor, use the ``-l`` or ``--legacy`` flag!
143
+
109
144
  ### Predicting Disorder from a sequence
110
145
 
111
146
  ``metapredict-quick-predict`` is a command that will let you input a sequence and get disorder values immediately printed to the terminal. The only argument that can be input is the sequence.
@@ -1085,6 +1120,18 @@ Example data that can be used with metapredict can be found in the metapredict/d
1085
1120
 
1086
1121
  This section is a log of recent changes with metapredict. My hope is that as I change things, this section can help you figure out why a change was made and if it will break any of your current work flows. The first major changes were made for the 0.56 release, so tracking will start there. Reasons are not provided for bug fixes for because the reason can assumed to be fixing the bug...
1087
1122
 
1123
+
1124
+ #### V2.5
1125
+ Changes:
1126
+
1127
+ * Added the first multicore support to metapredict. Currently limited to metapredict-predict-disorder functionality.
1128
+ =======
1129
+ #### V2.4.3
1130
+ Changes:
1131
+
1132
+ * Updated the default names for `metapredict-predict-idrs` so that the FASTA output file is now called `idrs.fasta` instead of the inappropriate `shephard_idrs.tsv`.
1133
+ * Added link to the new batch-mode Google Colab notebook!
1134
+
1088
1135
  #### V2.4.2
1089
1136
  Changes:
1090
1137
 
@@ -8,11 +8,11 @@ import json
8
8
 
9
9
  version_json = '''
10
10
  {
11
- "date": "2022-08-02T10:18:02-0500",
11
+ "date": "2023-03-15T15:58:20-0500",
12
12
  "dirty": false,
13
13
  "error": null,
14
- "full-revisionid": "a85bd401c15347961d81941b6ee0424b43aca8b4",
15
- "version": "v2.4.2"
14
+ "full-revisionid": "2dd04449f97b17e4b7a0e46558e0922134e517f1",
15
+ "version": "v2.5"
16
16
  }
17
17
  ''' # END VERSION_JSON
18
18
 
@@ -1,4 +1,4 @@
1
-
1
+ import protfasta
2
2
  import re
3
3
  from metapredict.metapredict_exceptions import MetapredictError
4
4
 
@@ -230,8 +230,78 @@ def write_caid_format(input_dict, output_file):
230
230
  current_output.close()
231
231
 
232
232
 
233
+ def split_fasta(protfasta_fasta_list, number_splits):
234
+ '''
235
+ function to split the dict returned from
236
+ a fasta file read in by protfasta to make
237
+ a specific number of dictionaries with
238
+ approximately equal numbers of proteins.
239
+ '''
240
+ all_nums=[num for num in range(0, len(protfasta_fasta_list))]
241
+ num_per_split=int(len(protfasta_fasta_list)/number_splits)
242
+ all_vals=[]
243
+ for val in range(0, number_splits):
244
+ temp_list=[]
245
+ for subval in range(0, num_per_split):
246
+ temp_list.append(all_nums.pop())
247
+ if val==number_splits-1:
248
+ for val in all_nums:
249
+ temp_list.append(val)
250
+ all_vals.append(temp_list)
251
+ # keep track of added prots
252
+ num_prots=0
253
+ split_lists=[]
254
+ for val in all_vals:
255
+ temp_list=[]
256
+ for prot in val:
257
+ num_prots+=1
258
+ temp_list.append([protfasta_fasta_list[prot][0], protfasta_fasta_list[prot][1]])
259
+ split_lists.append(temp_list)
260
+ # make sure all proteins added
261
+ if num_prots!= len(protfasta_fasta_list):
262
+ raise Exception('splitting of fasta file did not get all proteins')
263
+ return split_lists
264
+
265
+
266
+ def append_to_file(outpath, idrs, mode):
267
+ # append to the file we are writing to.
268
+ fh = open(outpath, 'a')
269
+ # depending on mode...
270
+ # dict to hold vals...
271
+ return_dictionary = {}
272
+ if mode == 'fasta':
273
+ # for each sequence
274
+ for s in idrs:
275
+ # d is IDR start and end positions
276
+ for d in idrs[s][2]:
277
+ return_dictionary[f'{s:s} IDR_START={d[0]:d} IDR_END={d[1]:d}'] = d[2]
278
+ # write out fasta.
279
+ protfasta.write_fasta(return_dictionary, outpath)
280
+
281
+ elif mode == 'shephard-domains':
282
+ fh = open(outpath, 'w')
283
+ for s in idrs:
284
+ # d is IDR start and end positions
285
+ for d in idrs[s][2]:
286
+ # note need +1 for shephard format
287
+ start = d[0]+1
288
+ end = d[1]
289
+ fh.write(f'{s}\t{start}\t{end}\tIDR\n')
290
+
291
+ elif mode == 'shephard-domains-uniprot':
292
+ fh = open(outpath, 'w')
293
+ for s in idrs:
294
+ # d is IDR start and end positions
295
+ for d in idrs[s][2]:
296
+
297
+ uid = s.split('|')[1]
298
+ start = d[0]+1
299
+ end = d[1]
300
+ fh.write(f'{uid}\t{start}\t{end}\tIDR\n')
233
301
 
234
-
302
+ else:
303
+ raise Exception('no mode specified!')
304
+
235
305
 
236
306
  # ..........................................................................................
237
307
  #
@@ -8,7 +8,7 @@
8
8
  ##Handles the primary functions
9
9
 
10
10
  # NOTE - any new functions must be added to this list!
11
- __all__ = ['predict_disorder_domains', 'predict_disorder', 'graph_disorder', 'predict_all', 'percent_disorder', 'predict_disorder_fasta', 'graph_disorder_fasta', 'predict_disorder_uniprot', 'graph_disorder_uniprot', 'predict_disorder_domains_uniprot', 'predict_disorder_domains_from_external_scores', 'graph_pLDDT_uniprot', 'predict_pLDDT_uniprot', 'graph_pLDDT_fasta', 'predict_pLDDT_fasta', 'graph_pLDDT', 'predict_pLDDT', 'predict_disorder_caid']
11
+ __all__ = ['predict_disorder_domains', 'predict_disorder', 'graph_disorder', 'predict_all', 'percent_disorder', 'predict_disorder_fasta', 'graph_disorder_fasta', 'predict_disorder_uniprot', 'graph_disorder_uniprot', 'predict_disorder_domains_uniprot', 'predict_disorder_domains_from_external_scores', 'graph_pLDDT_uniprot', 'predict_pLDDT_uniprot', 'graph_pLDDT_fasta', 'predict_pLDDT_fasta', 'graph_pLDDT', 'predict_pLDDT', 'predict_disorder_caid', 'predict_for_multithread']
12
12
 
13
13
  import os
14
14
  import sys
@@ -1612,3 +1612,18 @@ def predict_disorder_caid(input_fasta, output_file):
1612
1612
  _meta_tools.write_caid_format(output_dict, output_file)
1613
1613
 
1614
1614
 
1615
+ def predict_for_multithread(nested_list_of_seqs,
1616
+ outpath, mode, threshold_val, legacy):
1617
+ '''
1618
+ not multithreaded itself. Just a function
1619
+ needed to predicted batches of sequences
1620
+ for ultimately using in metapredict-multipredict
1621
+ '''
1622
+ all_vals={}
1623
+ for name_seq in nested_list_of_seqs:
1624
+ all_vals[name_seq[0]] = predict_disorder_domains(name_seq[1], disorder_threshold=threshold_val, legacy=legacy, return_list=True)
1625
+
1626
+ # append vals to outpath
1627
+ _meta_tools.append_to_file(outpath, all_vals, mode=mode)
1628
+
1629
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: metapredict
3
- Version: 2.4.2
3
+ Version: 2.5
4
4
  Summary: UNKNOWN
5
5
  Home-page: https://github.com/idptools/metapredict.git
6
6
  Author: Ryan Emenecker - Holehouse Lab - WUSM
@@ -14,9 +14,16 @@ License-File: LICENSE
14
14
  # metapredict: A machine learning-based tool for predicting protein disorder.
15
15
 
16
16
  **Important update** - as of February 15, 2022 we have updated metapredict to V2.0. This comes with important changes that improve the accuracy of metapredict. Please see the section on the update *Major update to metapredict predictions to increase overall accuracy* below. In addition, this update changes the functionality of the *predict_disorder_domains()* function, so please read the documentation on that function if you were using it previously.
17
- *A write up with more info on this update will be available soon.*
18
17
 
19
- **metapredict** uses a bidirectional recurrent neural network trained on the consensus disorder values from 8 disorder predictors from 12 proteomes that were obtained from [MobiDB](https://mobidb.bio.unipd.it/). The creation of metapredict was made possible by [parrot](https://github.com/idptools/parrot).
18
+ **metapredict** uses a bidirectional recurrent neural network trained on the consensus disorder values from 8 disorder predictors from 12 proteomes that were obtained from [MobiDB](https://mobidb.bio.unipd.it/). In addition, as of version 2, metapredict incorporates an additional layer of predictions by counter-selecting based on structure predictions from AlphaFold2. The creation of metapredict was made possible by [parrot](https://github.com/idptools/parrot).
19
+
20
+ ## How can I use metapredict?
21
+ Metapredict can be used in four different ways:
22
+
23
+ 1. As a stand-alone command-line tool (installable via pip - the code in this repository).
24
+ 2. As a Python library for integrating into your favorite bioinformatics pipeline (installable via pip - the code in this repository).
25
+ 3. As a web-server for examining disorder predictions on individual sequences found at [https://metapredict.net/](https://metapredict.net/).
26
+ 4. *NEW as of August 2022:* as a Google Colab notebook for batch-predicting disorder scores for larger numbers of sequences: [**LINK HERE**](https://colab.research.google.com/drive/1UOrOxun9i23XDE8lFo_4I89Tw8P3Z1D-?usp=sharing). Performance-wise, batch mode can predict the entire yeast proteome in ~6 min.
20
27
 
21
28
 
22
29
 
@@ -62,6 +69,12 @@ https://metapredict.readthedocs.io/en/latest/getting_started.html
62
69
  For disorder predictions using our server, please see:
63
70
  https://metapredict.net
64
71
 
72
+
73
+ ## What's new?
74
+
75
+ The most recent update to metapredict on March 15, 2023 introduced multiprocessing support to the command-line interface (you're welcome, Jeff). This is only implemented for the CLI at this time. **We were able to predict disorder in the entire human proteome in about 4 minutes with metapredict V2 and in about 2 minutes using legacy metapredict!** *We didn't even have to close the 40 chrome tabs we definitely had to have open for testing.* If there is additional interest in speeding up other functionality by using multiple cores, let us know!
76
+
77
+
65
78
  ## How to cite metapredict
66
79
 
67
80
  If you use metapredict for your work, please cite the metapredict paper -
@@ -119,6 +132,28 @@ If you would like to specify where to save the output, simply use the ``-o`` or
119
132
  **Using the original metapredict predictor**
120
133
  To use the original metapredict predictor as opposed to our new, updated predictor, use the ``-l`` or ``--legacy`` flag!
121
134
 
135
+ ### Predicting Disorder from a fasta file using multiple cores
136
+
137
+ The ``metapredict-multipredict`` command from the command line takes a .fasta file as input and returns disorder scores for the sequences in the FASTA file. It works the same as metapredict-predict-disroder but splits the sequences across the number of cores you specify. USE THIS AT YOUR OWN RISK! If you specify too many cores, you're going to have a bad time.
138
+
139
+ $ metapredict-multipredict <Path to .fasta file> <number of cores>
140
+
141
+ **Example - using 5 cores**
142
+
143
+ $ metapredict-multipredict /Users/thisUser/Desktop/interestingProteins.fasta 5
144
+
145
+ **Additional Usage**
146
+
147
+ **specifying where to save the output -**
148
+ If you would like to specify where to save the output, simply use the ``-o`` or ``--output-file`` flag and then specify the file path and file name. By default this command will save the output file as disorder_scores.csv to your current working directory. However, you can specify the file name in the output path.
149
+
150
+ **Example**
151
+
152
+ $ metapredict-multipredict /Users/thisUser/Desktop/interestingProteins.fasta 5 -o /Users/thisUser/Desktop/disorder_predictions/my_disorder_predictions.csv
153
+
154
+ **Using the original metapredict predictor**
155
+ To use the original metapredict predictor as opposed to our new, updated predictor, use the ``-l`` or ``--legacy`` flag!
156
+
122
157
  ### Predicting Disorder from a sequence
123
158
 
124
159
  ``metapredict-quick-predict`` is a command that will let you input a sequence and get disorder values immediately printed to the terminal. The only argument that can be input is the sequence.
@@ -1098,6 +1133,18 @@ Example data that can be used with metapredict can be found in the metapredict/d
1098
1133
 
1099
1134
  This section is a log of recent changes with metapredict. My hope is that as I change things, this section can help you figure out why a change was made and if it will break any of your current work flows. The first major changes were made for the 0.56 release, so tracking will start there. Reasons are not provided for bug fixes for because the reason can assumed to be fixing the bug...
1100
1135
 
1136
+
1137
+ #### V2.5
1138
+ Changes:
1139
+
1140
+ * Added the first multicore support to metapredict. Currently limited to metapredict-predict-disorder functionality.
1141
+ =======
1142
+ #### V2.4.3
1143
+ Changes:
1144
+
1145
+ * Updated the default names for `metapredict-predict-idrs` so that the FASTA output file is now called `idrs.fasta` instead of the inappropriate `shephard_idrs.tsv`.
1146
+ * Added link to the new batch-mode Google Colab notebook!
1147
+
1101
1148
  #### V2.4.2
1102
1149
  Changes:
1103
1150
 
@@ -79,6 +79,7 @@ metapredict/tests/input_data/three_seqs.fasta
79
79
  metapredict/tests/output/test.csv
80
80
  scripts/metapredict-graph-disorder
81
81
  scripts/metapredict-graph-pLDDT
82
+ scripts/metapredict-multipredict
82
83
  scripts/metapredict-name
83
84
  scripts/metapredict-predict-disorder
84
85
  scripts/metapredict-predict-idrs
@@ -0,0 +1,108 @@
1
+ #!/usr/bin/env python
2
+
3
+ # executing script for multithreaded prediction from command line
4
+
5
+ '''
6
+ Specifically for the 'predict_disorder_domains'
7
+ functionality.
8
+
9
+ Jeff wanted disorder predictions to be faster.
10
+ I made this for Jeff.
11
+ You're welcome, Jeff.
12
+ '''
13
+
14
+
15
+ # import stuff for making CLI
16
+ import os
17
+ import argparse
18
+ import protfasta
19
+ import multiprocessing
20
+
21
+ # for the predictions...
22
+ from metapredict.backend.meta_tools import split_fasta
23
+ import metapredict as meta
24
+
25
+ if __name__ == "__main__":
26
+
27
+ # Parse command line arguments.
28
+ parser = argparse.ArgumentParser(description='Predict IDRs for all sequences in a FASTA file. Uses multiple cores for speeeeeeed!')
29
+
30
+ parser.add_argument('data_file', help='Path to fasta file containing sequences to be predicted.')
31
+
32
+ parser.add_argument('number_cores', help='Number of cores to run simultaneously. Do not specify more than you have..', type=int)
33
+
34
+ parser.add_argument('-o', '--output-file', help='Filename for where to save the outputfile. Default = idrs_shephard.tsv', default='idrs_shephard.tsv')
35
+
36
+ parser.add_argument('-l', '--legacy', action='store_true', help='Optional. Use this flag to use the original legacy version of metapredict.')
37
+
38
+ parser.add_argument('--invalid-sequence-action', help="For parsing FASTA file, defines how to deal with non-standard amino acids. See https://protfasta.readthedocs.io/en/latest/read_fasta.html for details. Default='convert' ", default='convert')
39
+
40
+ parser.add_argument('--mode', help='Defines the mode in which IDRs are reported. By default this generates a FASTA file with header format that matches the input file with an additional set of fields that are "IDR_START=$START IDR_END=$END" where $START and $END are the starting and ending IDRs. If mode is set to shephard-domains than a SHEPHAD-compliant domains file is generated. If shephard-domains-uniprot the uniprot ID is extracted from the header assuming standard uniprot formatting. Default = fasta', default='fasta')
41
+
42
+ parser.add_argument('--threshold', help='Defines the threshold used to define a region as disordered or not. Default=0.42 which is recommended.', default=0.42, type=float)
43
+ parser.add_argument('--verbose', help='If included then prints out status updates', action='store_true')
44
+
45
+ args = parser.parse_args()
46
+
47
+ if args.mode not in ['fasta', 'shephard-domains','shephard-domains-uniprot', ]:
48
+ raise Exception("--mode must be set to one of 'fasta', 'shephard-domains', or 'shephard-domains-uniprot'")
49
+
50
+ if args.legacy:
51
+ use_legacy = True
52
+ threshold_val = args.threshold_val
53
+
54
+ else:
55
+ use_legacy=False
56
+ # if not using legacy and the default legacy value is still being used, adjust it to 0.5.
57
+ if args.threshold == 0.42:
58
+ threshold_val = 0.5
59
+
60
+ # if the user sets their own threshold value that isn't 0.42, keep it.
61
+ else:
62
+ threshold_val = args.threshold
63
+
64
+ if not os.path.isfile(args.data_file):
65
+ print(f'Error: Could not find passed fasta file [{args.data_file:s}]')
66
+
67
+ # read in sequences
68
+ sequences = protfasta.read_fasta(args.data_file, invalid_sequence_action=args.invalid_sequence_action, return_list=True)
69
+ if args.verbose:
70
+ print('Read in FASTA file')
71
+
72
+ # make number cores an int
73
+ num_cores_used = args.number_cores
74
+
75
+ # split sequences into sublists for multithreading
76
+ split_seqs = split_fasta(sequences, num_cores_used)
77
+
78
+ # create the file
79
+ with open(args.output_file, 'w') as fh:
80
+ pass
81
+
82
+ # first split fasta into list of lists.
83
+ protfasta_seqs = protfasta.read_fasta(args.data_file,
84
+ invalid_sequence_action=args.invalid_sequence_action, return_list=True)
85
+
86
+ # split into list of lists where each list contains lists
87
+ # where that list 0=header, 1=sequence
88
+ split_fasta_seqs = split_fasta(protfasta_seqs, number_splits=num_cores_used)
89
+
90
+ # iterate through batches
91
+ cur_threads = []
92
+ for sub_batch in range(0, num_cores_used):
93
+ cur_seq_batch = split_fasta_seqs[sub_batch]
94
+ #startup the thread
95
+ t = multiprocessing.Process(target = meta.predict_for_multithread, args = (cur_seq_batch, args.output_file, args.mode, threshold_val, use_legacy))
96
+ cur_threads.append(t)
97
+
98
+ # run cur threds
99
+ for thr in cur_threads:
100
+ thr.start()
101
+
102
+ # join threads
103
+ for thr in cur_threads:
104
+ thr.join()
105
+
106
+
107
+
108
+
@@ -18,13 +18,13 @@ if __name__ == "__main__":
18
18
 
19
19
  parser.add_argument('data_file', help='Path to fasta file containing sequences to be predicted.')
20
20
 
21
- parser.add_argument('-o', '--output-file', help='Filename for where to save the outputfile. Default = idrs_shephard.tsv', default='idrs_shephard.tsv')
21
+ parser.add_argument('-o', '--output-file', help='Filename for where to save the outputfile. Defaults = idrs.fasta (if mode=fasta) and shephard_idrs.tsv otherwise')
22
22
 
23
23
  parser.add_argument('-l', '--legacy', action='store_true', help='Optional. Use this flag to use the original legacy version of metapredict.')
24
24
 
25
25
  parser.add_argument('--invalid-sequence-action', help="For parsing FASTA file, defines how to deal with non-standard amino acids. See https://protfasta.readthedocs.io/en/latest/read_fasta.html for details. Default='convert' ", default='convert')
26
26
 
27
- parser.add_argument('--mode', help='Defines the mode in which IDRs are reported. By default this generates a FASTA file with header format that matches the input file with an additional set of fields that are "IDR_START=$START IDR_END=$END" where $START and $END are the starting and ending IDRs. If mode is set to shephard-domains than a SHEPHAD-compliant domains file is generated. If shephard-domains-uniprot the uniprot ID is extracted from the header assuming standard uniprot formatting. Default = fasta', default='fasta')
27
+ parser.add_argument('--mode', help='Defines the mode in which IDRs are reported. By default this generates a FASTA file with header format that matches the input file with an additional set of fields that are "IDR_START=$START IDR_END=$END" where $START and $END are the starting and ending IDRs. If mode is set to shephard-domains than a SHEPHAD-compliant domains file is generated. If shephard-domains-uniprot the uniprot ID is extracted from the header assuming standard uniprot formatting. Default = fasta', default='fasta')
28
28
 
29
29
  parser.add_argument('--threshold', help='Defines the threshold used to define a region as disordered or not. Default=0.42 which is recommended.', default=0.42, type=float)
30
30
  parser.add_argument('--verbose', help='If included then prints out status updates', action='store_true')
@@ -33,6 +33,15 @@ if __name__ == "__main__":
33
33
 
34
34
  if args.mode not in ['fasta', 'shephard-domains','shephard-domains-uniprot', ]:
35
35
  raise Exception("--mode must be set to one of 'fasta' or 'shephard-domains'")
36
+
37
+ if args.output_file is None:
38
+ if args.mode == 'fasta':
39
+ outfile_name = 'idrs.fasta'
40
+ else:
41
+ outfile_name = 'shephard_idrs.tsv'
42
+
43
+ else:
44
+ outfile_name = args.output_file
36
45
 
37
46
  if args.legacy:
38
47
  use_legacy = True
@@ -80,10 +89,10 @@ if __name__ == "__main__":
80
89
  return_dictionary[f'{s:s} IDR_START={d[0]:d} IDR_END={d[1]:d}'] = d[2]
81
90
 
82
91
 
83
- protfasta.write_fasta(return_dictionary, args.output_file)
92
+ protfasta.write_fasta(return_dictionary, outfile_name)
84
93
 
85
94
  elif args.mode == 'shephard-domains':
86
- fh = open(args.output_file, 'w')
95
+ fh = open(outfile_name, 'w')
87
96
  for s in idrs:
88
97
  # d is IDR start and end positions
89
98
  for d in idrs[s][2]:
@@ -94,7 +103,7 @@ if __name__ == "__main__":
94
103
  fh.write(f'{s}\t{start}\t{end}\tIDR\n')
95
104
 
96
105
  elif args.mode == 'shephard-domains-uniprot':
97
- fh = open(args.output_file, 'w')
106
+ fh = open(outfile_name, 'w')
98
107
  for s in idrs:
99
108
  # d is IDR start and end positions
100
109
  for d in idrs[s][2]:
@@ -52,7 +52,8 @@ setup(
52
52
  'scripts/metapredict-predict-idrs',
53
53
  'scripts/metapredict-graph-pLDDT',
54
54
  'scripts/metapredict-predict-pLDDT',
55
- 'scripts/metapredict-name'],
55
+ 'scripts/metapredict-name',
56
+ 'scripts/metapredict-multipredict'],
56
57
 
57
58
 
58
59
  # Additional entries you may want simply uncomment the lines you want and fill in the data
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes