Skip to content
This repository was archived by the owner on May 18, 2026. It is now read-only.
This repository was archived by the owner on May 18, 2026. It is now read-only.

"task binding" without hardcoded file suffixes #66

Description

@thejmazz
// We want to run a bunch of variant callers
// Then count common SNPs

const variantCallerInput = {
  reference: '*_genomic.fna',
  bam: '*.bam',
  _bai: '*.bam.bai'
}

// two tasks once stream support ;)
const mpileupAndCall = task({
  input: variantCallerInput,
  output: 'variants.vcf',
  name: 'samtools mpileup | bcftools call',
}, ({ input }) => `
samtools mpileup -uf ${input.reference} ${input.bam} | \
bcftools call -c - > variants.vcf
`)

const variantCaller2 = task({
  input: variantCallerInput
  output: '*.vcf'
}, ({ input }) => `caller ${input.reference} ${input.bam}` )

// Maybe declares a count for an input,
// whereas { input: '*.vcf' } could fail when more than one is found since it expects 1
const counter = task({
  input: [ { pattern: '*.vcf', count: (n) => n >= 1 } ]
  output: '*.snpcount'
}, ({ input }) => `counter ${input.join(' ')}`

// currently, this would actually work
// minus the count: (n) => <boolean expression> part
// when the counter tasks resolves input, it will find multiple files matching
// *.vcf from the junction node which is its immidiate parent
// lets see we did count: (n) => n === 5, and let it pick up matching files until 5 was reached
// this would work if there was 5 callers, but could pick up more files from upstream tasks
// SO. maybe whats needed is a way to declare which nodes a task has
// permission to resolve input files from
const pipeline = join(
  junction(mpileupAndCall, variantCaller2),
  counter
)

pipeline().then(console.log)

Related problems:

  • use an upstream task who went to stdout output as an input as a file for another task
  • run something for each variant calling after each one finishes, but then also run the task that requires all variant calls when they are all ready (or the chromosome example, run something for each chromosome, then do more, and run something that needs result of all chromosomes when they are ready)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions