Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanIsALion committed May 11, 2021
2 parents 990da81 + ded6913 commit 89fcf7e
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ __pycache__/

# C extensions
*.so
.DS_Store

# Distribution / packaging
.Python
Expand Down
57 changes: 57 additions & 0 deletions metapredict/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,66 @@





# Handle versioneer
from ._version import get_versions
versions = get_versions()
__version__ = versions['version']
__git_revision__ = versions['full-revisionid']
del get_versions, versions


def print_performance(seq_len=500, num_seqs=100, verbose=True):
"""
Function that lets you test metapredicts performance on your local hardware.
Parameters
--------------
seqlen : int
Length of each random sequence to be tested. Default = 500.
num_seqs : int
Number of sequences to compute over. Default = 100.
verbose : bool
Flag which, if true, means the function prints a summary when finished. If
false simply returns an integer
Returns
---------------
int
Returns the nearest number of sequences-per-second metapredict is currently
predicting. For ref, on a spring 2020 MBP this value was ~10,000 sequences per
second.
"""

# this is a bit bad but, only import random is this FX is called
import random
import time
VALID_AMINO_ACIDS = ['A','C','D','E','F','G','H','I','K','L','M','N','P','Q','R','S','T','V','W','Y']

def genseq(n):
"""
Function that generates a random
"""
return "".join([random.choice(VALID_AMINO_ACIDS) for i in range(n)])

seqs = []
for i in range(num_seqs):
seqs.append(genseq(seq_len))

start = time.time()
for i in seqs:
predict_disorder(i)

end = time.time()
s_per_second = (seq_len*num_seqs)/(end - start)

if verbose:
print('Predicting %i sequences per second!'%(s_per_second))

return s_per_second


15 changes: 7 additions & 8 deletions metapredict/backend/uniprot_predictions.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
# code for pulling down uniprot sequence for predictions
import os
import sys
import argparse
import urllib3

import csv
import protfasta

from metapredict import meta

def fetch_sequence(uniprot_id):
"""
Function that returns the amino acid sequence by polling UniProt.com
Note that right now the test for success is a bit hap-hazard (looks for the
string "Sorry", which appears if the UniProt call fails. We probably want
something a bit more robust in the future...
Parameters
--------------
uniprot_id : str
Uniprot accession number
Returns
-----------
str or None:
If the call is succesfull, this returns the amino acid string. If not, it returns
None.
"""

Expand Down
Binary file removed scripts/.DS_Store
Binary file not shown.

0 comments on commit 89fcf7e

Please sign in to comment.