Answers.Body: <p>You're missing a <code>\</code> in the line before the one containing the <code>--exome</code>, so shell treats it as a new command, which is why you see this error. Add the <code> \</code> after <code>${sub_dir}</code> and your script should not give you this error.</p>
  <p>With that correction added in, your code will look like:</p>
  <pre><code># Accept path to reference fasta file as a parameter:
  
  reference=$1
  
  # Accept input and output directories as parameters:
  
  input_dir=$2
  
  output_dir=$3
  
  # Hard coded Manta Installation Path:
  
  ## If someone installs Manta they must specify where the installation is placed:
  
  MANTA_INSTALL_PATH=&quot;/path/to/manta-1.6.0.release_src/install&quot;
  
  
  # Main code:
  for file in <span class="math-container">${input_dir}/*.bam
  do
    # Create subdirectory named after bam file
    sub_dir=$</span>{output_dir}/<span class="math-container">$(basename $</span>{file} .bam)
    mkdir -p ${sub_dir}
  
    # Use reference fasta path specified by user
    <span class="math-container">${MANTA_INSTALL_PATH}/bin/configManta.py \
      --bam $</span>file \
      --referenceFasta <span class="math-container">${reference} \
  --runDir $</span>{sub_dir} \
      --exome
  done
  
  # Now run each `runWorkflow.py`
  
  find &quot;$output_dir&quot; -name &quot;runWorkflow.py&quot; -exec {} \;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-28T22:01:29.590Z
Answers.Text: Thank you Ram. I edited the code above to reflect the change you suggested.
Answers.UserDisplayName: Indira
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-29T01:44:35.650Z
Answers.Text: @Indira I think this should have been the accepted answer. Do you still get the error `--exome: command not found` or something else?
Answers.UserDisplayName: Steve
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-29T15:52:09.277Z
Answers.Text: @Indira Did you or did you not run the original command with the backslash? The answer was to your question, not a correction to a typo in your post.
Answers.UserDisplayName: Ram RS
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-29T21:40:29.607Z
Answers.Text: I did run the original commands with a backslash and it did work. Thank you.
Answers.UserDisplayName: Indira
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-29T21:55:17.557Z
Answers.Text: In that case, you should have accepted the answer, not changed the question.
Answers.UserDisplayName: Ram RS
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-29T22:01:13.783Z
Answers.Text: I accept the answer, and I changed the code in the question to reflect the correct code that should be used.
Answers.UserDisplayName: Indira
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-29T22:02:02.160Z
Answers.Text: That is not how forums work. You let the question have the wrong code and the answer shows the correction. That way, other that made the mistake can figure out the change to be made to their code. I've reversed your edit, accept the answer please.
Answers.UserDisplayName: Ram RS
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-29T22:02:42.937Z
Answers.Text: Oh I will try and keep that in mind for my next post.
Answers.UserDisplayName: Indira
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-29T22:22:26.677Z
Answers.Text: @M__ can you clean up the comments please?
Answers.UserDisplayName: Ram RS
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-28T18:27:16.613Z
Answers.LastActivityDate: 2023-03-29T22:16:09.300Z
Answers.LastEditDate: 2023-03-29T22:16:09.300Z
Answers.UserDisplayName: Ram RS
Body: <p>I am using Manta (<a href="https://github.com/Illumina/manta/blob/master/docs/userGuide/README.md" rel="nofollow noreferrer">https://github.com/Illumina/manta/blob/master/docs/userGuide/README.md</a>) but whenever I try to specify the <code>--exome</code> command using the following code I get the error below:</p>
  <p>The code in my script:</p>
  <pre><code># Accept path to reference fasta file as a parameter:
  
  reference=$1
  
  # Accept input and output directories as parameters:
  
  input_dir=$2
  
  output_dir=$3
  
  # Hard coded Manta Installation Path:
  
  ## If someone installs Manta they must specify where the installation is placed:
  
  MANTA_INSTALL_PATH=&quot;/path/to/manta-1.6.0.release_src/install&quot;
  
  
  # Main code:
  for file in <span class="math-container">${input_dir}/*.bam
  do
    # Create subdirectory named after bam file
    sub_dir=$</span>{output_dir}/<span class="math-container">$(basename $</span>{file} .bam)
    mkdir -p ${sub_dir}
  
    # Use reference fasta path specified by user
    <span class="math-container">${MANTA_INSTALL_PATH}/bin/configManta.py \
      --bam $</span>file \
      --referenceFasta <span class="math-container">${reference} \
  --runDir $</span>{sub_dir}
      --exome
  done
  
  # Now run each `runWorkflow.py`
  
  find &quot;$output_dir&quot; -name &quot;runWorkflow.py&quot; -exec {} \;
  </code></pre>
  <p>The <code>runDir</code> is directly below the previous command however, it doesn't seem to write well in this post.</p>
  <p>I ran the script via the following command:</p>
  <pre><code>./script.sh /path/to/reference.fa /path/to/bam_files /path/to/output_dir
  </code></pre>
  <p>I get the error:</p>
  <pre><code>/path/to/my/sample/folder/sample1/runWorkflow.py
  /path/to/this/job_scripts/number_by_HPC: line 40: --exome: command not found
  </code></pre>
  <p>How do I get it to run with the <code>--exome</code> command and not get the following error (it works without the <code>--exome</code> command)? I am using exome data so I believe I need to use the <code>--exome</code> command</p>
  
Tags: <bash><exome>
Title: Manta "--exome: command not found"
ThreadText: # Manta "--exome: command not found"
  
  (Asked by: username_0 on 2023-03-28)
  
  I am using Manta (<https://github.com/Illumina/manta/blob/master/docs/userGuide/README.md>) but whenever I try to specify the `--exome` command using the following code I get the error below:
  
  The code in my script:
  
  ```
  # Accept path to reference fasta file as a parameter:
  
  reference=$1
  
  # Accept input and output directories as parameters:
  
  input_dir=$2
  
  output_dir=$3
  
  # Hard coded Manta Installation Path:
  
  ## If someone installs Manta they must specify where the installation is placed:
  
  MANTA_INSTALL_PATH="/path/to/manta-1.6.0.release_src/install"
  
  # Main code:
  for file in ${input_dir}/*.bam
  do
    # Create subdirectory named after bam file
    sub_dir=${output_dir}/$(basename ${file} .bam)
    mkdir -p ${sub_dir}
  
    # Use reference fasta path specified by user
    ${MANTA_INSTALL_PATH}/bin/configManta.py \
      --bam $file \
      --referenceFasta ${reference} \
  --runDir ${sub_dir}
      --exome
  done
  
  # Now run each `runWorkflow.py`
  
  find "$output_dir" -name "runWorkflow.py" -exec {} \;
  
  ```
  
  The `runDir` is directly below the previous command however, it doesn't seem to write well in this post.
  
  I ran the script via the following command:
  
  ```
  ./script.sh /path/to/reference.fa /path/to/bam_files /path/to/output_dir
  
  ```
  
  I get the error:
  
  ```
  /path/to/my/sample/folder/sample1/runWorkflow.py
  /path/to/this/job_scripts/number_by_HPC: line 40: --exome: command not found
  
  ```
  
  How do I get it to run with the `--exome` command and not get the following error (it works without the `--exome` command)? I am using exome data so I believe I need to use the `--exome` command
  
  **Tags:** bash, exome
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-03-28. Score: 4 | Accepted answer
  
  You're missing a `\` in the line before the one containing the `--exome`, so shell treats it as a new command, which is why you see this error. Add the  `\` after `${sub_dir}` and your script should not give you this error.
  
  With that correction added in, your code will look like:
  
  ```
  # Accept path to reference fasta file as a parameter:
  
  reference=$1
  
  # Accept input and output directories as parameters:
  
  input_dir=$2
  
  output_dir=$3
  
  # Hard coded Manta Installation Path:
  
  ## If someone installs Manta they must specify where the installation is placed:
  
  MANTA_INSTALL_PATH="/path/to/manta-1.6.0.release_src/install"
  
  # Main code:
  for file in ${input_dir}/*.bam
  do
    # Create subdirectory named after bam file
    sub_dir=${output_dir}/$(basename ${file} .bam)
    mkdir -p ${sub_dir}
  
    # Use reference fasta path specified by user
    ${MANTA_INSTALL_PATH}/bin/configManta.py \
      --bam $file \
      --referenceFasta ${reference} \
  --runDir ${sub_dir} \
      --exome
  done
  
  # Now run each `runWorkflow.py`
  
  find "$output_dir" -name "runWorkflow.py" -exec {} \;
  
  ```
  
  > **Comments:**
  > **username_0**: Thank you Ram. I edited the code above to reflect the change you suggested.  
  > **username_2**: @username_0 I think this should have been the accepted answer. Do you still get the error `--exome: command not found` or something else?  
  > **username_1**: @username_0 Did you or did you not run the original command with the backslash? The answer was to your question, not a correction to a typo in your post.  
  > **username_0**: I did run the original commands with a backslash and it did work. Thank you.  
  > **username_1**: In that case, you should have accepted the answer, not changed the question.  
  > **username_0**: I accept the answer, and I changed the code in the question to reflect the correct code that should be used.  
  > **username_1**: That is not how forums work. You let the question have the wrong code and the answer shows the correction. That way, other that made the mistake can figure out the change to be made to their code. I've reversed your edit, accept the answer please.  
  > **username_0**: Oh I will try and keep that in mind for my next post.  
  > **username_1**: @M__ can you clean up the comments please?  
  
  ---
  
  