Containers
5 functions for running containerized tools. Supports Docker, Podman, Singularity, and OCI-based sandboxing via bubblewrap. Integrated with the BioContainers registry for 9,000+ bioinformatics tools.
container_run
Run a command inside a container image. Auto-detects the available runtime (Docker > Podman > Singularity > bwrap).
container_run(image, command, opts?) -> map
| Parameter | Type | Description |
|---|---|---|
| image | string | OCI image reference |
| command | string | list | Command to execute |
| opts.mounts | list | Volume mounts [{src, dst, mode}] |
| opts.env | map | Environment variables |
| opts.workdir | string | Working directory inside container |
Returns: {"exit_code": int, "stdout": string, "stderr": string}
let result = container_run(
"quay.io/biocontainers/samtools:1.19--h50ea8bc_0",
"samtools view -c input.bam",
{mounts: [{src: ".", dst: "/data", mode: "rw"}], workdir: "/data"}
)
println("Read count:", trim(result.stdout))
container_pull
Pull a container image to local cache.
container_pull(image) -> string
container_pull("quay.io/biocontainers/fastqc:0.12.1--hdfd78af_0")
container_pull("quay.io/biocontainers/bwa-mem2:2.2.1--he513fc3_0")
tool_search
Search the BioContainers registry for tools by name or keyword.
tool_search(query, opts?) -> list
let results = tool_search("samtools")
for tool in results {
println(tool.name, "-", tool.description)
}
# Search with limit
tool_search("variant caller", {limit: 5})
tool_pull
Pull a BioContainers tool by name and optional version.
tool_pull(name, version?) -> string
tool_pull("samtools") # latest version
tool_pull("samtools", "1.19") # specific version
tool_pull("bwa-mem2", "2.2.1") # returns image path
tool_info
Get detailed information about a BioContainers tool, including available versions.
tool_info(name) -> map
let info = tool_info("gatk")
println(info.name, "-", info.description)
for v in info.versions {
println(v.version, "-", v.image)
}
# 4.5.0.0 - quay.io/biocontainers/gatk4:4.5.0.0--py39...
# 4.4.0.0 - quay.io/biocontainers/gatk4:4.4.0.0--py39...