Skip to content

Instantly share code, notes, and snippets.

@chapmanb
Created October 31, 2021 00:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chapmanb/42d2a81321a04350974daed85d76c4d1 to your computer and use it in GitHub Desktop.
Save chapmanb/42d2a81321a04350974daed85d76c4d1 to your computer and use it in GitHub Desktop.
Example of adding and updating a sequence in Arvados, with required remove/save step to avoid certificate error
def simple_add_update():
"""Test adding and updating a collection to reproduce certificate error.
"""
project_uuid = "pirca-j7d0g-h13mew3i5ya8cqq"
name = "save_new_test"
fname = "seqs.fa"
avoid_an_error = True
arvados_conn = get_connection_config()
c = arvados.collection.Collection(apiconfig=arvados_conn)
with c.open(fname, "wb") as writer:
writer.write(">aseq\nGATC\n")
c.save_new(name=name, owner_uuid=project_uuid)
c2 = arvados.collection.Collection(c.manifest_locator(), apiconfig=arvados_conn)
c2.remove(fname)
if avoid_an_error:
c2.save()
with c2.open(fname, "wb") as writer:
writer.write(">aseq\nGATTACA\n")
c2.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment