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
Close
Hashes for motif-broker-request-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72f10bd92ad8e1c614308a46d46ee312f68312546a21982c89c728292cc2e70b |
|
MD5 | c8b2934c1695e0eff8f9ee1a8c36a79d |
|
BLAKE2b-256 | 3970e2e21956219f0b61982a1aa51d6f50cb9a29235562b3b0863e699061e6f0 |
Close
Hashes for motif_broker_request-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f1b9cba08038f41c66efe59708a5bc02209b4346097b39dbfe8c6aa3c0bb59d |
|
MD5 | 8487c294fd7bc35e4e7aafb9c37be5ea |
|
BLAKE2b-256 | c348f5e341fe8a79ed18115453671618708f994b329d14ec62a6390fa6b1a3b3 |