<p>This solution where the <code>-O</code> is just set to the output directory seems the most easy way to handle the issue:</p>
<p>Keep the following variables the same:</p>
<ul>
<li><code>singularity_image</code> is the path to the GATK sif file</li>
<li><code>bam_file</code> is a bam file from a defined bam directory</li>
<li><code>reference</code> is a path to a .fa file</li>
<li><code>targets_interval_list</code> is a interval list created by Picard (ending with .interval_list)</li>
<li><code>NUM_BINS</code> is a manually preset value from 100 to 200.</li>
</ul>
<p>The code with the modified <code>-O</code>:</p>
<pre><code>  # run SplitIntervals with shard name
  singularity exec <span class="math-container">$singularity_image /gatk/gatk --java-options -Xms8000m \
  SplitIntervals \
  -R $</span>{reference} \
  -L <span class="math-container">${targets_interval_list} \
  --scatter-count $</span>{NUM_BINS} \
  -O ${output_dir}
</code></pre>
<p>While it doesn't name the shards in a very elegant way it seems to work. The shards are made from the interval list and therefore, should not be named after the .bams that will be processed in other steps that are used (for in this case a GATK g CNV pipeline).</p>

CC BY-SA 4.0
2023-04-24T20:45:34.107Z
2023-04-24T20:45:34.107Z
Indira
<p>I am trying to create a GATK g CNV pipeline and I need to make shards before running the <code>GermlineCNVCaller</code> therefore, I believe I need to use <code>SplitIntervals</code>.</p>
<p>I have the following predefined variables:</p>
<ul>
<li><code>singularity_image</code> is the path to the GATK sif file</li>
<li><code>bam_file</code> is a bam file from a defined bam directory</li>
<li><code>reference</code> is a path to a .fa file</li>
<li><code>targets_interval_list</code> is a interval list created by Picard (ending with .interval_list)</li>
<li><code>NUM_BINS</code> is a manually preset value from 100 to 200.</li>
</ul>
<pre><code>  singularity exec $singularity_image /gatk/gatk --java-options -Xms8000m \
  SplitIntervals \
  -I ${bam_file} \
  -R ${reference} \
  -L ${targets_interval_list} \
  --scatter-count ${NUM_BINS} \
  -O ${output_dir}/Interval_list_${bam_filename}_.shard_\%${NUM_BINS}\%_\%{shard_index}\%.interval_list
</code></pre>
<p>I have tried change the specifications under <code>SplitIntervals</code> but for whatever reason I keep getting the following error</p>
<pre><code>***********************************************************************

A USER ERROR has occurred: but no positional argument is defined for this tool.

***********************************************************************
</code></pre>
<p>Why is this error occurring?</p>
<p><strong>The documentation I am using is here:</strong> <a href="https://gatk.broadinstitute.org/hc/en-us/articles/360036899592-SplitIntervals" rel="nofollow noreferrer">https://gatk.broadinstitute.org/hc/en-us/articles/360036899592-SplitIntervals</a></p>

CC BY-SA 4.0
2023-04-24T13:13:11.760Z
What are all the `\%` in your output file name? Does it work if you try a simple output file name (e.g. `-O foo.list`)?
terdon
CC BY-SA 4.0
2023-04-24T13:14:48.930Z
I can't as it is being used on multiple files.
Indira
CC BY-SA 4.0
2023-04-24T13:16:12.243Z
It is meant to be used to create an interval list with the numbers Interval_list_SampleNameHere_.shard_1ofn_.interval_list
Indira
CC BY-SA 4.0
2023-04-24T13:16:28.233Z
Please answer both questions, not just the last one. And even if it is being used on multiple files, try _one_ so you can debug it. That's the way debugging works: you need to try things. Try changing each of the variables you pass to a simple string and see if the error changes. Try and figure out which part of the command is actually causing the error and for that, you will need to run the command by itself.
terdon
CC BY-SA 4.0
2023-04-24T13:33:17.793Z
Thank you for the help I will try with one file - it does seem to be the `-O` part of the command I will work on it from here and try with perhaps just one file.
Indira
<gatk><singularity>
GATK SplitIntervals: A USER ERROR has occurred: but no positional argument is defined for this tool
# GATK SplitIntervals: A USER ERROR has occurred: but no positional argument is defined for this tool

(Asked by: username_0 on 2023-04-24)

I am trying to create a GATK g CNV pipeline and I need to make shards before running the GermlineCNVCaller therefore, I believe I need to use SplitIntervals.
I have the following predefined variables:

singularity_image is the path to the GATK sif file
bam_file is a bam file from a defined bam directory
reference is a path to a .fa file
targets_interval_list is a interval list created by Picard (ending with .interval_list)
NUM_BINS is a manually preset value from 100 to 200.

  singularity exec $singularity_image /gatk/gatk --java-options -Xms8000m \
  SplitIntervals \
  -I ${bam_file} \
  -R ${reference} \
  -L ${targets_interval_list} \
  --scatter-count ${NUM_BINS} \
  -O ${output_dir}/Interval_list_${bam_filename}_.shard_\%${NUM_BINS}\%_\%{shard_index}\%.interval_list

I have tried change the specifications under SplitIntervals but for whatever reason I keep getting the following error
***********************************************************************

A USER ERROR has occurred: but no positional argument is defined for this tool.

***********************************************************************

Why is this error occurring?
The documentation I am using is here: https://gatk.broadinstitute.org/hc/en-us/articles/360036899592-SplitIntervals

**Tags:** gatk, singularity
> **Comments:**
> **username_1**: What are all the `\%` in your output file name? Does it work if you try a simple output file name (e.g. `-O foo.list`)?  
> **username_0**: I can't as it is being used on multiple files.  
> **username_0**: It is meant to be used to create an interval list with the numbers Interval_list_SampleNameHere_.shard_1ofn_.interval_list  
> **username_1**: Please answer both questions, not just the last one. And even if it is being used on multiple files, try _one_ so you can debug it. That's the way debugging works: you need to try things. Try changing each of the variables you pass to a simple string and see if the error changes. Try and figure out which part of the command is actually causing the error and for that, you will need to run the command by itself.  
> **username_0**: Thank you for the help I will try with one file - it does seem to be the `-O` part of the command I will work on it from here and try with perhaps just one file.  

---

## 1 answers

### Answer by username_0 on 2023-04-24. Score: 1 | Accepted answer

This solution where the -O is just set to the output directory seems the most easy way to handle the issue:
Keep the following variables the same:

singularity_image is the path to the GATK sif file
bam_file is a bam file from a defined bam directory
reference is a path to a .fa file
targets_interval_list is a interval list created by Picard (ending with .interval_list)
NUM_BINS is a manually preset value from 100 to 200.

The code with the modified -O:
  # run SplitIntervals with shard name
  singularity exec $singularity_image /gatk/gatk --java-options -Xms8000m \
  SplitIntervals \
  -R ${reference} \
  -L ${targets_interval_list} \
  --scatter-count ${NUM_BINS} \
  -O ${output_dir}

While it doesn't name the shards in a very elegant way it seems to work. The shards are made from the interval list and therefore, should not be named after the .bams that will be processed in other steps that are used (for in this case a GATK g CNV pipeline).


---

