Skip to content

Commit

Permalink
🎨 Refactoring
Browse files Browse the repository at this point in the history
Signed-off-by: zethson <[email protected]>
  • Loading branch information
Zethson committed Sep 27, 2024
1 parent 3158066 commit fadde70
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 25 deletions.
27 changes: 7 additions & 20 deletions docs/mcmicro.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,14 @@
"source": [
"[Nextflow](https://www.nextflow.io/) is a workflow management system used for executing scientific workflows across platforms scalably, portably, and reproducibly.\n",
"\n",
"Here, we'll run a demo of the microscopy pipeline [mcmicro](https://github.com/labsyspharm/mcmicro) to correct uneven illumination. [Reference](https://mcmicro.org/)"
]
},
{
"cell_type": "markdown",
"id": "8e7d3a5e",
"metadata": {},
"source": [
"```{note}\n",
"There are several options to automatically ingest Nextflow pipeline outputs into Lamindb instances:\n",
"\n",
"1. Using a serverless environment trigger (e.g., AWS Lambda) to execute a Python script.\n",
"2. By using a [post-run script](https://docs.seqera.io/platform/23.4.0/launch/advanced#pre-and-post-run-scripts) on the Seqera Platform.\n",
"\n",
"Typically, you run the Nextflow workflow from the command line or Seqera Platform and then register input and output data with a script.\n",
"The Seqera Platform allows for [post-run scripts](https://docs.seqera.io/platform/23.4.0/launch/advanced#pre-and-post-run-scripts) that can automate this process.\n",
"```"
"Both approaches execute a script that connects to the Lamindb instance and ingests the run output, similar to the one shown below.\n",
"\n",
"This guide shows how to manually ingest a Nextflow run and illustrates what such an automated script could look like by registering the output of a run of the [mcmicro](https://github.com/labsyspharm/mcmicro) [Reference](https://mcmicro.org/) microscopy pipeline into a lamin instance."
]
},
{
Expand Down Expand Up @@ -103,14 +98,6 @@
"## Data lineage"
]
},
{
"cell_type": "markdown",
"id": "54595d81",
"metadata": {},
"source": [
"View data lineage:"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
12 changes: 7 additions & 5 deletions docs/mcmicro.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
reference="https://github.com/labsyspharm/mcmicro",
)
ln.context.track(transform=transform)
run = ln.context.run
run = ln.context.unun

# get the input data from LaminDB
mcmicro_input = ln.Artifact.using("laminlabs/lamindata").get(uid="iTLHluoQczqH6ZypgDxA")
# get the input data from a predecessor pipeline through LaminDB and make it available in the current working directory
mcmicro_input = ln.Artifact.using("laminlabs/lamindata").get(description=args.input)
input_dir = mcmicro_input.cache()
if not (dest := Path.cwd() / Path(input_dir.path).name).exists():
shutil.copytree(input_dir.path, dest)
Expand Down Expand Up @@ -71,9 +71,11 @@
run.params.add_values({"qc_params": qc_params})

# register the output artifact
Path(f"{dest}/registration").joinpath(f"{Path(dest).name}.ome.tif").rename(
Path(f"{dest}/registration/exemplar-001.ome.tif")
(Path(dest) / "registration" / f"{Path(dest).name}.ome.tif").rename(
Path(dest) / "registration" / "exemplar-001.ome.tif"
)


output = ln.Artifact.from_dir(f"{dest}/registration")
ln.save(output)

Expand Down

0 comments on commit fadde70

Please sign in to comment.