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

annot.local_file = temp_file

# Optional properties
annot.comment = "hello world"
annot.date = "2011-11-11"
annot.sop = "the SOP"
annot.annotation_source = "the annotation source"

# Annotations are 'computed_from' a WgsAssembledSeqSet
annot.links = { "computed_from": [ "419d64483ec86c1fb9a94025f3b94551" ] }

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

print(annot.to_json(indent=2))

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

    success = annot.save()

    if success:
        annot_id = annot.id
        print("Succesfully saved annot ID: %s" % annot_id)

        annot2 = Annotation.load(annot_id)
Beispiel #2
0
temp_file = tempfile.NamedTemporaryFile(delete=False).name
print("Local file: %s" % temp_file)

annot.local_file = temp_file

# Optional properties
annot.comment = "hello world"
annot.date = "2011-11-11"
annot.sop = "the SOP"
annot.annotation_source = "the annotation source"
annot.private_files = False

# Annotations are 'computed_from' a WgsAssembledSeqSet
annot.links = {"computed_from": ["419d64483ec86c1fb9a94025f3b94551"]}

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

print(annot.to_json(indent=2))

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

    success = annot.save()

    if success:
        annot_id = annot.id
        print("Succesfully saved annot ID: %s" % annot_id)

        annot2 = Annotation.load(annot_id)