felipealbrecht
9/30/2015 - 7:19 PM

Select all experiments that are from a BLUEPRINT sample and myeloid cell type.

Select all experiments that are from a BLUEPRINT sample and myeloid cell type.

import xmlrpclib
import time

url = "http://deepblue.mpi-inf.mpg.de/xmlrpc"
user_key = "anonymous_key"

server = xmlrpclib.Server(url, allow_none=True)

(status, samples) = server.list_samples("myeloid cell", {"source" : "BLUEPRINT Epigenome"}, user_key)

# Get the samples ID
samples_id = server.extract_ids(samples)[1]

# Select the regions from from chromosom 1, position 0 to 50.000
(status, query_id) = server.select_regions ("", "GRCh38", None, samples_id, None, None, "chr1", 0, 50000, user_key )

# Retrieve the experiments data (The @NAME meta-column is used to include the experiment name and @BIOSOURCE for experiment's biosource
(status, request_id) = server.get_regions(query_id, "CHROMOSOME,START,END,@NAME,@SAMPLE_ID,@BIOSOURCE", user_key)

# Wait for the server processing
(status, info) = server.info(request_id, user_key)
request_status = info[0]["state"]
while request_status != "done" and request_status != "failed":
  time.sleep(1)
  (status, info) = server.info(request_id, user_key)
  request_status = info[0]["state"]

(status, regions) = server.get_request_data(request_id, user_key)

print regions