# Samples
# DeepBlue organizes the Biological Names into BioSources and Samples.
# While the BioSources are the biological entities, the Samples are the instances of these entities.
# For example, the BioSource blood. It refer to any blood, but a blood from a specific donor, time, or caractistic will have be a specific sample.
# All Samples refer to a BioSource and a set o attributes, that we name metadata.
import xmlrpclib
# Before going further, we must set up the client:
url = "http://deepblue.mpi-inf.mpg.de/xmlrpc"
server = xmlrpclib.Server(url, encoding='UTF-8', allow_none=True)
# You can use the anonymous key or your own user key
user_key = "anonymous_key"
# The command list_samples is used to list all Samples from a given BioSource:
server.list_samples("blood", {}, user_key)
# Output:
# ['okay',
# [['s3',
# {'_id': 's3',
# 'biosource_name': 'blood',
# 'description': 'leukemia (UCDavis alternate), "The continuous cell line K-562 was established by Lozzio and Lozzio from the pleural effusion of a 53-year-old female with chronic myelogenous leukemia in terminal blast crises." - ATCC',
# 'karyotype': 'cancer',
# 'lineage': 'mesoderm',
# 'organism': 'human',
# 'sex': 'F',
# 'source': 'ENCODE',
# 'term': 'K562b',
# 'tier': '1',
# 'tissue': 'leukemia (UCDavis alternate), "The continuous cell line K-562 was established by Lozzio and Lozzio from the pleural effusion of a 53-year-old female with chronic myelogenous leukemia in terminal blast crises." - ATCC',
# 'user': 'Populator'}],
# The samples are automatically load from the Epigenetics Projects (BLUEPRINT, ENCODE, Roadmap)
# and we are always trying to perform the best match between the mapped BioSource and the Biological Entitiy of the Experiment.
# It is important to remid that the metadata key names are not uniformized, so depending the Project or Sample,
# there can have different names with the same semantic. It is possible to list only the Knowing the Samples Metadata fields,