Example #1
0
prep.prep_id = "the prep id"
prep.storage_duration = 30
prep.study = "prediabetes"
prep.title = "the title"

# Optional properties
prep.short_label = "the short label"
prep.url = ["http://prep.url"]
prep.species = "the species"
prep.cell_type = "the cell type"
prep.tissue = "test tissue"
prep.reference = "the reference"
prep.protocol_name = "name of the protocol"
prep.protocol_steps = "steps of the protocol"
prep.exp_description = "exp description"
prep.sample_description = "description of the sample"

print("Creating a temp file for example/testing purposes.")
temp_file = tempfile.NamedTemporaryFile(delete=False).name
print("Local file: %s" % temp_file)

# MicrobiomeAssayPreps are 'prepared_from' a Sample
prep.links = {"prepared_from": ["610a4911a5ca67de12cdc1e4b4011876"]}

prep.tags = ["prep", "ihmp"]
prep.add_tag("another")
prep.add_tag("and_another")

print(prep.to_json(indent=2))

if prep.is_valid():
Example #2
0
prep.storage_duration = 30
prep.study = "prediabetes"
prep.title = "the title"


# Optional properties
prep.short_label = "the short label"
prep.url = [ "http://prep.url" ]
prep.species = "the species"
prep.cell_type = "the cell type"
prep.tissue = "test tissue"
prep.reference = "the reference"
prep.protocol_name = "name of the protocol"
prep.protocol_steps = "steps of the protocol"
prep.exp_description = "exp description"
prep.sample_description = "description of the sample"

print("Creating a temp file for example/testing purposes.")
temp_file = tempfile.NamedTemporaryFile(delete=False).name
print("Local file: %s" % temp_file)

# MicrobiomeAssayPreps are 'prepared_from' a Sample
prep.links = { "prepared_from": [ "610a4911a5ca67de12cdc1e4b4011876" ] }

prep.tags = [ "prep", "ihmp" ]
prep.add_tag("another")
prep.add_tag("and_another")

print(prep.to_json(indent=2))

if prep.is_valid():