NAME

NBI::Launcher - Base class for nbilaunch tool wrappers

VERSION

version 0.19.1

SYNOPSIS

package NBI::Launcher::MyTool;
use parent 'NBI::Launcher';

sub new {
    my ($class) = @_;
    return $class->SUPER::new(
        name        => 'mytool',
        description => 'Does something useful',
        version     => '1.0.0',
        activate    => { module => 'mytool/1.0.0' },
        slurm_defaults => { queue => 'short', threads => 4, memory => 8 },
        inputs  => [ { name => 'input', flag => '-i', type => 'file', required => 1,
                       help => 'Input file' } ],
        params  => [],
        outputs => [ { name => 'result', pattern => '{sample}.out', required => 1,
                       help => 'Result file' } ],
        outdir  => { flag => '--outdir', short => '-o', required => 1 },
    );
}

sub make_command {
    my ($self, %args) = @_;
    my $prefix = $self->singularity_prefix;   # '' unless singularity activation
    return "${prefix}mytool -i $args{input} -o \$SCRATCH/$args{sample}.out";
}

1;

NAME

NBI::Launcher - Base class for nbilaunch tool wrappers

METHODS

new(%args)

Construct a launcher spec. See module source for all accepted keys.

activation_lines()

Shell snippet to load the tool (module load / source activate / empty for singularity).

singularity_prefix()

Returns "singularity exec $image " or "" - use in make_command() overrides.

sample_name(%args)

Derives sample name from the first required file input, stripping FASTQ extensions.

input_mode(%args)

Returns "paired" if both r1 and r2 are present, "single" otherwise.

arg_spec()

Returns the launcher's CLI surface (inputs, params, outputs, slurm_defaults). Used by nbilaunch for --help generation and argument parsing.

validate(%args)

Dies with a helpful message on missing or invalid inputs/params.

make_command(%args)

Returns the tool invocation string. Subclasses must override this. Use \$SCRATCH (literal shell variable) for scratch-directory paths.

generate_script(%args)

Assembles the full bash script body. Called by build().

build(%args)

Validates, resolves, and returns ($job, $manifest) - an NBI::Job and an NBI::Manifest - ready for nbilaunch to write and optionally submit.

AUTHOR

Andrea Telatin <proch@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2023-2025 by Andrea Telatin.

This is free software, licensed under:

The MIT (X11) License