Skip to content

Is it possible to add a command before bash in nxf_trace() of .command.run? #4846

Answered by robsyme
lishengting asked this question in Q&A
Discussion options

You must be logged in to vote

Absolutely! There are in fact a couple of ways.

You might consider adding it in the shebang line of the script block.

process Demo {
    script:
    """
    #!/path/to/stat_tool
    echo 'Hello world!'
    """
}

Nextflow will detect the shebang line and adjust the .command.run statement accordingly:

nxf_launch() {
   /path/to/stat_tool /private/tmp/lishengting/work/a7/9f73aef2239268b6a44213553372cc/.command.sh
}

You can also adjust the interpreter with the shell process directive (documentation here):

process Demo {
    debug true
    shell '/path/to/stat_tool', '--extra-args', 'if_necessary'

    script:
    "echo 'Hello world!'"
}

Of course, because this is a process directive it can al…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@lishengting
Comment options

Answer selected by lishengting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants