qiime2 / qiime2

Official repository for the QIIME 2 framework.
https://qiime2.org
BSD 3-Clause "New" or "Revised" License
475 stars 241 forks source link

Ad-hoc modifications with provenance tracking #265

Open ElDeveloper opened 7 years ago

ElDeveloper commented 7 years ago

Improvement Description Perhaps this breaks some fundamental assumption about artifact provenance, but it would be useful to still be able to keep track of the provenance of an artifact after some processing has been applied.

For example, I have a tree artifact that I load, set all the missing branch lengths to zero, and then save it back to an artifact. The resulting artifact has now lost all the provenance information. It would be useful if I could annotate in the provenance, that the changes that I made have the intention of "Set missing branch lengths to zero".

a = Artifact.load('tree.qza')
t = a.view(TreeNode)

for n in t.traverse():
    if n.length is None:
        n.length = 0

patched_tree = Artifact.import_data('Phylogeny[Rooted]', t)
patched_tree.save('tree.patched.qza')
ebolyen commented 7 years ago

Maybe there could be some kind of action where you could say:

patched_results = qiime2.UnknownAction("Describe a thing", 
                                       inputs=[a, b, c], 
                                       results=[('TypeX', view_x), ('TypeY', view_y)])

Or maybe the import has already been done, so it would take the patched_tree in your example.

ElDeveloper commented 7 years ago

Something like this would be rather handy, my overall goal is to be able to make a note that I made a change, but that the originating object has a particular history associated with it. This should likely be highlighted somehow in view.qiime2.org.