Created
July 22, 2016 14:32
-
-
Save felipealbrecht/1ce954527e14c2974f8376882d9c6ca9 to your computer and use it in GitHub Desktop.
Aggregate genes regions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xmlrpclib | |
import time | |
url = "http://deepblue.mpi-inf.mpg.de/xmlrpc" | |
user_key = "anonymous_key" | |
server = xmlrpclib.Server(url, allow_none=True) | |
GENOME = "hg19" | |
GENE_MODEL = "gencode v19" | |
''' | |
locations = """chr1 0 1000 | |
chr1 20000 300000 | |
chr1 40000 500000 | |
chr1 60000 600000 | |
chr1 80000 700000 | |
chr1 100000 900000 | |
chr1 120000 1300000""" | |
(status, regions_query_id) = server.input_regions(GENOME, locations, user_key) | |
''' | |
(status, regions_query_id) = server.select_genes(["AL672183.2", "RNU6-1205P", "ZNF692", "ZNF672"], GENE_MODEL, None, None, None, user_key) | |
print regions_query_id | |
status, chromosomes = server.chromosomes(GENOME, user_key) | |
# remove later | |
chromosomes = [chromosomes[0]] | |
for (chromosome_name, chromosome_size) in chromosomes: | |
print chromosome_name | |
(status, experiment_id) = server.select_experiments("E048-H3K4me3.fc.signal.bedgraph", chromosome_name, None, None, user_key) | |
(status, aggregate_id) = server.aggregate(experiment_id, regions_query_id, "VALUE", user_key) | |
FORMAT = "CHROMOSOME,START,END,@AGG.MEAN,@AGG.VAR,@AGG.COUNT" | |
print FORMAT | |
(status, request_id) = server.get_regions(aggregate_id, FORMAT, user_key) | |
(status, info) = server.info(request_id, user_key) | |
print info | |
request_status = info[0]["state"] | |
while request_status != "done" and request_status != "failed": | |
print info | |
time.sleep(1) | |
(status, info) = server.info(request_id, user_key) | |
request_status = info[0]["state"] | |
(status, data) = server.get_request_data(request_id, user_key) | |
print data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment