2
$\begingroup$

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

$\endgroup$

1 Answer 1

4
$\begingroup$

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 {} \;
$\endgroup$
9
  • $\begingroup$ Thank you Ram. I edited the code above to reflect the change you suggested. $\endgroup$
    – Indira
    Mar 28, 2023 at 22:01
  • 1
    $\begingroup$ @Indira I think this should have been the accepted answer. Do you still get the error --exome: command not found or something else? $\endgroup$
    – Steve
    Mar 29, 2023 at 1:44
  • $\begingroup$ @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. $\endgroup$
    – Ram RS
    Mar 29, 2023 at 15:52
  • $\begingroup$ I did run the original commands with a backslash and it did work. Thank you. $\endgroup$
    – Indira
    Mar 29, 2023 at 21:40
  • $\begingroup$ In that case, you should have accepted the answer, not changed the question. $\endgroup$
    – Ram RS
    Mar 29, 2023 at 21:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.