Package to interrogate motif-broker JS microservice with python
Project description
motif-broker-request
Example in test/test.py
Configure motif-broker-request
import motif_broker_request.request as mb_request
mb_request.configure("http://localhost:5984") #Default is localhost:3282
You can also change bulk length
mb_request.set_bulk_length(10000) #Default is 50000
Request motif-broker
sgrnas = ["AAAAAAAAAAAAAAAAAAATGGG", "TCCAAAAAAAAACAGTGGATTGG", "CACTAAAAAAGAAGACCAAGCGG"] # sgRNAs you want to search
res = mb_request.get(sgrnas)
print(res)
>
Request motif-broker with some filter
You can write filter functions. This functions have to take motif_broker results as arguments and return the filtered version with same format
Example of function that just keep given genomes in results :
def filter_genomes(mb_res, **kwargs):
if not "genomes" in kwargs:
raise Exception("you must provide 'genomes' argument to get function for filter_genomes function")
genomes = kwargs["genomes"]
filtered_results = {}
for sgrna in mb_res:
added = False
for org in mb_res[sgrna]:
if org in genomes:
if added:
filtered_results[sgrna][org] = mb_res[sgrna][org]
else:
filtered_results[sgrna] = {org : mb_res[sgrna][org]}
return filtered_results
Applied this way to get results :
res = mb_request.get(sgrnas, filter_predicate=filter_genomes, genomes=["dd6cfb980c8a3659acffa4f002ea7404", "dd6cfb980c8a3659acffa4f0029ff84a"])
print(res)
>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file motif-broker-request-1.0.0.tar.gz
.
File metadata
- Download URL: motif-broker-request-1.0.0.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
72f10bd92ad8e1c614308a46d46ee312f68312546a21982c89c728292cc2e70b
|
|
MD5 |
c8b2934c1695e0eff8f9ee1a8c36a79d
|
|
BLAKE2b-256 |
3970e2e21956219f0b61982a1aa51d6f50cb9a29235562b3b0863e699061e6f0
|
File details
Details for the file motif_broker_request-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: motif_broker_request-1.0.0-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
1f1b9cba08038f41c66efe59708a5bc02209b4346097b39dbfe8c6aa3c0bb59d
|
|
MD5 |
8487c294fd7bc35e4e7aafb9c37be5ea
|
|
BLAKE2b-256 |
c348f5e341fe8a79ed18115453671618708f994b329d14ec62a6390fa6b1a3b3
|