Skip to main content

MedBook Platform for Cancer Data Capture, Analysis and Sharing

Project description

MedBookLib provides a python interface to MedBook (R version should come next).

PYTHON

MedBookConnection(<name optional>, <password optional>)
You begin the conversation by creating a MedBook Connection object which will be used

MedBookConnection("ted@soe.ucsc.edu", "test1234");

or using the MedBook environment variables: MEDBOOKUSER, MEDBOOKPASSWORD

medbook = MedBookConnection();

This will throw an exception object if it does not make authenticated connection to the MedBook server.

`
MedBookConnection.find(<collection required>, <mongo query optional>, <keyword querys optional>)

The simplest find command will return all of the data objects in a collection. For example

data = medbook.find("Clinical_Info");



Some tables such as Expression2 are very large and if just need one gene from one study, you can do this by simply doing:

data = medbook.find("Expression2", { "Study_ID": "prad_wcdt", "gene": "BRCA1" });


This can be more easily expressed using the python keyword idiom:

data = medbook.find("Expression2", Study_ID="prad_wcdt", gene="BRCA1");


But use the mongo syntax to express complicated queriess,

data = medbook.find("Expression2", { "Study_ID": {"$in": [ "prad_tcga", "prad_wcdt"] }, "gene": { "$in": ["EGFR","BRCA1"]}});


You cannot combine keyword queries and mongo queries.



OPTIONAL ENVIRONEMNT VARIABLE CREDENTIALS
You must provide credentials to MedBook in the form of a name and password. There are two ways
to do this:

Preferred way: Set the MEDBOOKUSER and MEDBOOKPASSWORD environment variables. For exmaple:
export MEDBOOKUSER=ted@soe.ucsc.edu
export MEDBOOKPASSWORD=test1234


There is also a MEDBOOKSERVER environment variable. If no server is specificed
The default server is https://medbook.ucsc.edu. But you can also set the server to be your laptop.

Common ones are:

export MEDBOOKSERVER=https://su2c-dev.ucsc.edu/

export MEDBOOKSERVER=http://su2c-dev.ucsc.edu:20012/

export MEDBOOKSERVER=http://localhost:20012/

Alternatively, you can provide the name and password in the parameters of the MedBookConnection object (see above).



Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

medbooklib-1.0.tar.gz (3.0 kB view details)

Uploaded Source

File details

Details for the file medbooklib-1.0.tar.gz.

File metadata

  • Download URL: medbooklib-1.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for medbooklib-1.0.tar.gz
Algorithm Hash digest
SHA256 e8bcd9657a77f607e35fbe546ba334df979e867411147d52680e2ea703b1845c
MD5 b1082c312a3954f8d5eda9f5b2feda69
BLAKE2b-256 89c2dbb49bfff525db4c1540f1764d7d5acae303c33da6dfb3ba208fb6cc1384

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page