Each time you run a Mantle Pipeline, a pipeline run object is generated. A pipeline run contains links to its input entities and parameters and its output entities.
All outputs of a pipeline run expressed as key-value pairs. You can get a single entity output of a pipeline run using its key.
Get single entity output
Copy
import mantlebiomantle = mantlebio.MantleClient()# Get a pipeline runpipeline_run = mantle.pipeline_run.get('pipeline_run_id')# Get a entity output of the run using the keypipeline_run.get_output('output_entity_key')
If a pipeline takes a single entity input for a key, you can get a Python object representing the entity used in a specific run using the key:
Get single input entity
Copy
import mantlebiomantle = mantlebio.MantleClient()# Get a pipeline runpipeline_run = mantle.pipeline_run.get('pipeline_run_id')# Get a entity input of the run using the keypipeline_run.get_input_dataset('input_entity_key')
For example, the Mantle nf-core rnaseq pipeline takes a single entity for the reference genome:
Get reference entity for bulk-rnaseq run
Copy
import mantlebiomantle = mantlebio.MantleClient()# Get a bulk-rnaseq pipeline runpipeline_run = mantle.pipeline_run.get('bulk-rnaseq_pipeline_run_id')# Get the reference genome entity of the runpipeline_run.get_input_dataset('reference')
If a pipeline can take multiple entity inputs for a key, you can get a list of the entities used in a specific run using the key:
Get a list of input entities
Copy
import mantlebiomantle = mantlebio.MantleClient()# Get a pipeline runpipeline_run = mantle.pipeline_run.get('pipeline_run_id')# Get a entity input of the run using the keypipeline_run.get_input_dataset_list('input_entity_key')
This returns a Python list of entity objects.
For example, the Mantle nf-core rnaseq pipeline can take multiple rnaseq_fastq entities for the fastqs input:
Get fastq entities for bulk-rnaseq run
Copy
import mantlebiomantle = mantlebio.MantleClient()# Get a bulk-rnaseq pipeline runpipeline_run = mantle.pipeline_run.get('bulk-rnaseq_pipeline_run_id')# Get a list of the rnaseq_fastq inputspipeline_run.get_input_dataset_list('fastqs')
import mantlebiomantle = mantlebio.MantleClient()# Create the entity, e.g.entity = mantle.dataset.create( name="4XP1", local=False, properties={ "description": "X-ray structure of Drosophila dopamine transporter bound to neurotransmitter dopamine", "resolution": 2.5, "r_value": 0.2, })# Get the pipeline run you want to add outputs topipeline_run = mantle.pipeline_run.get('pipeline-run-id')# Add dataset output to the pipeline runpipeline_run.add_dataset_output('<key_for_output_entity>', entity)
File outputs can be downloaded directly from the pipeline run page in the Mantle Pipelines UI. Some files (such as HTMLs, CSVs, PDBs, PNGs, and JPGs) can be previewed on the pipeline run page. This can be useful for displaying reports to pipeline users.
Add file output
Copy
import mantlebiomantle = mantlebio.MantleClient()# Get the pipeline run you want to add outputs topipeline_run = mantle.pipeline_run.get('pipeline-run-id')# Add file output to a pipeline runpipeline_run.add_file_output('<key_for_output_file>','local/file/path/to/file')