Package: fairworkflows
fairworkflowspython libraryfairworkflowsis a high-level, user-friendly python library that supports the construction,
manipulation and publishing of FAIR scientific workflows using semantic technologies.Backgroundfairworkflowsis developed as a component of the FAIR Workbench, as part of the FAIR is FAIR project.The focus is on description of workflows consisting of manual and computational steps using semantic technology,
such as the ontology described in the publication:Celebi, R., Moreira, J. R., Hassan, A. A., Ayyar, S., Ridder, L., Kuhn, T., & Dumontier, M. (2019). Towards FAIR protocols and workflows: The OpenPREDICT case study.arXiv:1911.09531.The goals of the project are:To facilitate the construction of RDF descriptions of a variety of scientific 'workflows', in the most general sense. This includes experimental procedures, ipython notebooks, computational analysis of results, etc.To allow validation and publication of the resultant RDF (for example, by means of nanopublications).Re-use of previously published steps, in new workflows.FAIR data flow from end-to-end.We seek to provide an easy-to-use python interface for achieving the above.DocumentationCheckout theuser documentation.InstallationThe most recent release can be installed from the python package index usingpip:pip install fairworkflowsTo publish workflows to the nanopub server you need to setup your nanopub profile. This
allows the nanopub server to identify you. Run the following in the terminal after installation:setup_nanopub_profileThis will add and store RSA keys to sign your nanopublications, publish a
nanopublication with your name and ORCID iD to declare that you are
using using these RSA keys, and store your ORCID iD to automatically add
as author to the provenance of any nanopublication you will publish
using this library.Quick demoTry out the library in this online executable notebook:Quick StartImport fromfairworkflowslibraryfromfairworkflowsimportis_fairworkflow,is_fairstep,FairWorkflowDefine a step for your workflowMark a function as a FAIR step using theis_fairstepdecorator.
Use keyword arguments to semantically annotate the step.
In this example to provide a label and describe that this is a script task.@is_fairstep(label='Addition',is_script_task=True)defadd(x:float,y:float)->float:"""Adding up numbers."""returnx+yDefine your workflowDefine your workflow by calling previously defined step functions.
Mark the function as a workflow using theis_fairworkflowdecorator.@is_fairworkflow(label='My Workflow')defmy_workflow(in1,in2):"""A simple workflow"""t1=add(in1,in2)returnt1Construct and publish a workflowConstruct a FairWorkflow object from the function defining the workflow and publish as nanopublication.workflow=FairWorkflow.from_function(my_workflow)workflow.publish_as_nanopub(use_test_server=True,publish_steps=True)Execute the workflowExecute the workflow and inspect the prospective provenanceresult,prov=workflow.execute(1,4)print(prov)Example notebookSeeexamples/fairworkflows-quick-start.ipynbfor a current example of using the fairworkflows library to build a workflow using plex rdfHow is thefairworkflowslibrary expected to be used?While this library could be used as a standalone tool to build/publish RDF workflows,
it is intended more as a component to be used in a variety of other tools that seek to add FAIR elements to workflows. At present the library is used in the following tools:FAIRWorkflowsExtension: A Jupyter Lab extension that adds a widget for searching for previously published FairSteps or FairWorkflows. These can then be loaded into the notebook for modification or combination into new workflows.It is expected that the library will soon interact with FAIR Data Points as well e.g.fairdatapoint.Relation to existing workflow formats/engines (e.g. CWL, WDL, Snakemake etc)This library is not intended to replace or compete with the hundreds of existing computational workflow formats, but rather to aid in RDF description and comparison of workflows in the most general sense of the term (including manual experiemental steps, notebooks, and so on). Steps in a FAIRWorkflow may very well be 'run this CWL workflow' or 'run this script', so such workflows are expected to sit more on a meta-level, describing the before-and-after of running one of these fully automated computational workflows as well.