Skip to content

work in progress, docker, nextflow#4

Open
MateoZ05 wants to merge 1 commit into
mainfrom
nextflow-implementation
Open

work in progress, docker, nextflow#4
MateoZ05 wants to merge 1 commit into
mainfrom
nextflow-implementation

Conversation

@MateoZ05

@MateoZ05 MateoZ05 commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Nextflow integration: main.nf + nextflow.config for reproducible pipeline execution. Added containerization with our Dockerfile and boot scripts for offline Ollama use. Added fact checking via review_interpretation() and verify.py to re-read and rewrite claims in loops to reduce hallucinations. New CLI passes with --review and --review-passes for our fact checking.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a reproducible execution path for the llmize pipeline via Nextflow + Docker, and adds an optional self-review loop intended to reduce unsupported gene/cell-type claims in generated interpretations.

Changes:

  • Added Nextflow workflow (main.nf) and configuration (nextflow.config) to run the pipeline with Docker.
  • Added Docker image build + runtime boot scripts to start Ollama and support offline model caching.
  • Added deterministic symbol checks (verify.py) and an optional review loop integrated into the CLI (pipeline.py / interpret.py).

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
verify.py Adds deterministic extraction of “unsupported” symbol tokens for review passes.
pipeline.py Adds --review / --review-passes, env-driven model default, and hooks review into pipeline execution.
interpret.py Adds review prompt/system prompt + review loop; improves per-section logging with timing/flush.
main.nf Defines Nextflow INTERPRET process to run the pipeline (optionally booting Ollama in-container).
nextflow.config Provides Nextflow params defaults and Docker configuration (container + host cache mount).
Dockerfile Builds a combined Ollama + Python pipeline image and optionally bakes models.
docker/entrypoint.sh ENTRYPOINT that boots Ollama then runs the provided command (or --check).
docker/boot_ollama.sh Starts Ollama, waits for readiness, and pulls/uses cached models (offline-aware).
.gitignore Ignores Nextflow work dirs/logs/results artifacts.
.dockerignore Excludes generated outputs/intermediates from Docker build context.

Comment thread main.nf
def review_flag = "${params.review}".toBoolean() ? "--review --review-passes ${params.review_passes}" : ''
def whole_flag = "${params.whole_report}".toBoolean() ? '--whole-report' : ''
def synth_flag = "${params.synthesis}".toBoolean() ? '' : '--no-synthesis'
def prompt_flag = params.prompt ? "--prompt '${params.prompt}'" : ''
Comment thread verify.py
Comment on lines +37 to +38
for gene in entities.get("genes", []):
vocab.add(gene.upper())
Comment thread Dockerfile
Comment thread interpret.py
Comment on lines +413 to +420
text, thinking = chat_ollama(
build_review_prompt(text, findings),
model=model,
system=REVIEW_SYSTEM_PROMPT,
num_ctx=num_ctx,
think=think,
gen_options=gen_options,
)
Comment thread interpret.py
Comment on lines +392 to +397
if findings:
joined = ", ".join(findings)
parts.append(
"These gene or cell-type symbols appear in the text but are absent from the "
f"report data. Remove them or correct the surrounding claim: {joined}."
)
Comment thread pipeline.py
Comment on lines +230 to +235
if review:
print(f"[pipeline] Reviewing interpretation (up to {review_passes} pass(es))...")
response = review_interpretation(
response, model=model, report=report, num_ctx=num_ctx,
passes=review_passes, think=think, gen_options=gen_options,
)
Comment thread docker/boot_ollama.sh
# Skip the pull if the model is already present (baked into the image, or cached
# on a mounted volume). This is what makes an offline / air-gapped image work:
# 'ollama pull' would otherwise contact the registry even for an existing model.
if ollama list 2>/dev/null | grep -qF "${MODEL}"; then
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants