Example #1
0
test_prep = SixteenSDnaPrep()

test_prep.comment = "test comment. Hello world!"
test_prep.frag_size = 2
test_prep.lib_layout = "test lib_layout"
test_prep.lib_selection = "test lib_selection"
test_prep.mimarks = mimarks
test_prep.storage_duration = 3
test_prep.sequencing_center = "test center"
test_prep.sequencing_contact = "test contact"
test_prep.prep_id = "test prep id"
test_prep.ncbi_taxon_id = "NCBI123ABC"
test_prep.links = { "prepared_from": [ "610a4911a5ca67de12cdc1e4b4011876" ] }

test_prep.tags = [ "test", "16s_dna_prep", "ihmp" ]
test_prep.add_tag("another")
test_prep.add_tag("and_another")

print(test_prep.to_json(indent=2))

if test_prep.is_valid():
    print("Valid!")

    success = test_prep.save()

    if success:
        prep_id = test_prep.id
        print("Successfully saved prep. ID: %s" % prep_id)

        prep2 = SixteenSDnaPrep.load(prep_id)
Example #2
0
test_prep = SixteenSDnaPrep()

test_prep.comment = "test comment. Hello world!"
test_prep.frag_size = 2
test_prep.lib_layout = "test lib_layout"
test_prep.lib_selection = "test lib_selection"
test_prep.mimarks = mimarks
test_prep.storage_duration = 3
test_prep.sequencing_center = "test center"
test_prep.sequencing_contact = "test contact"
test_prep.prep_id = "test prep id"
test_prep.ncbi_taxon_id = "NCBI123ABC"
test_prep.links = {"prepared_from": ["610a4911a5ca67de12cdc1e4b4011876"]}

test_prep.tags = ["test", "16s_dna_prep", "ihmp"]
test_prep.add_tag("another")
test_prep.add_tag("and_another")

print(test_prep.to_json(indent=2))

if test_prep.is_valid():
    print("Valid!")

    success = test_prep.save()

    if success:
        prep_id = test_prep.id
        print("Successfully saved prep. ID: %s" % prep_id)

        prep2 = SixteenSDnaPrep.load(prep_id)