1

我在一个名为$stat_val_result_command. 我想 -Xms1g在文件末尾添加参数,这样应该是这样的:

  <my command in the file> -Xms1g

但是,我想在追加后运行这个命令。我在一个名为“nextflow”的工作流系统中运行它。我绑了很多东西,包括关注,但它不起作用。检查默认情况下在 Bash 中运行的脚本部分:

    process statisticalValidation {

   input:
   file stat_val_result_command from validation_results_command.flatten()

   output:
   file "*_${params.ticket}_statistical_validation.txt" into validation_results

   script:
   """
   echo " -Xms1g"  >> $stat_val_result_command && ```cat  $stat_val_result_command```
   """
}
4

1 回答 1

1

Best to avoid appending to or manipulating input files localized in the workdir as these can be, and are by default, symbolic links to the original files.

In your case, consider instead exporting the JAVA_TOOL_OPTIONS environment variable. This might or might not work for you, but might give you some ideas if you have control over how the scripts are being generated:

export JAVA_TOOL_OPTIONS="-Xms1g"
bash "${stat_val_result_command}"

Also, it's generally better to avoid localizing and running scripts like this. It might be unavoidable, but usually there are better options. For example, third-party scripts, like your Bash script could be handled more simply:

Grant the execute permission to these files and copy them into a folder named bin/ in the root directory of your project repository. Nextflow will automatically add this folder to the PATH environment variable, and the scripts will automatically be accessible in your pipeline without the need to specify an absolute path to invoke them.

This of course assumes you can control and parameterize the process that creates your Bash scripts.

于 2021-04-14T04:09:09.083 回答