OLF-Bioinformatics / VariantDetective

Identify short variants and structural variants from raw sequencing data or genomic sequences
MIT License
16 stars 1 forks source link

Syntax error near unexpected token `(' in snp_indel.py #8

Closed pcrxn closed 10 months ago

pcrxn commented 10 months ago

When running variantdetective all_variants with long- and short-read sequence data, the following error is produced:

$ variantdetective all_variants -t 12 \
    -r data/assembly/fasta/E4166_0.assembly.fasta \
    -l data/raw/minion/fastq_gz/MIN-2022-000022.fastq.gz \
    -1 data/raw/illumina/fastq_gz/BMH-2022-000138_R1.fastq.gz \
    -2 data/raw/illumina/fastq_gz/BMH-2022-000138_R2.fastq.gz \
    -o variantdetective/raw/E4166-0_E4166-100
2024-01-09 12:32:21     Starting short and long read pipeline
2024-01-09 12:32:21     Starting structural_variant tool
2024-01-09 12:32:21     Running NanoVar...
2024-01-09 12:33:10     Sorting BAM file...
2024-01-09 12:33:14     Indexing sorted BAM file...
2024-01-09 12:33:16     Running NanoSV...
2024-01-09 12:34:01     Running SVIM...
2024-01-09 12:34:09     Running CuteSV...
2024-01-09 12:34:17     Running SURVIVOR...
2024-01-09 12:34:17     Starting snp_indel tool
2024-01-09 12:34:17     Running bwa...
Traceback (most recent call last):
  File "/home/liam/miniconda3/envs/variantdetective/bin/variantdetective", line 33, in <module>
    sys.exit(load_entry_point('variantdetective', 'console_scripts', 'variantdetective')())
  File "/media/liam/Cerulean/projects/PRJ-LPB-00017/bin/VariantDetective/variantdetective/main.py", line 39, in main
    validate_inputs(args, output=output)    
  File "/media/liam/Cerulean/projects/PRJ-LPB-00017/bin/VariantDetective/variantdetective/validate_inputs.py", line 70, in validate_inputs
    snp_indel(args, short_inputs, output=sys.stderr)
  File "/media/liam/Cerulean/projects/PRJ-LPB-00017/bin/VariantDetective/variantdetective/snp_indel.py", line 53, in snp_indel
    run_process(command)
  File "/media/liam/Cerulean/projects/PRJ-LPB-00017/bin/VariantDetective/variantdetective/tools.py", line 77, in run_process
    raise Exception(error)
Exception: /bin/bash: -c: line 1: syntax error near unexpected token `('
/bin/bash: -c: line 1: `bwa mem -t 12 variantdetective/raw/E4166-0_E4166-100/E4166_0.assembly.fasta variantdetective/raw/E4166-0_E4166-100/BMH-2022-000138_R1.fastq.gz variantdetective/raw/E4166-0_E4166-100/BMH-2022-000138_R2.fastq.gz | samtools view -SbCLAIR_BIN_DIR=\$(dirname \$(which run_clair3.sh)) - -@ 12 | samtools sort -n - -@ 12 | samtools fixmate -m - - -@ 12 | samtools sort - -@ 12 | samtools markdup -r - -@ 12 variantdetective/raw/E4166-0_E4166-100/snp_indel/alignment.sorted.bam'

This error appears to originate from the Shell command at Lines 46-51 in snp_indel.py:

        command += reference + ' ' + snp_input[0] + ' ' + snp_input[1] + \
        ' | samtools view -SbCLAIR_BIN_DIR=\$(dirname \$(which run_clair3.sh)) - -@ ' + str(args.threads) + \
        ' | samtools sort -n - -@ ' +  str(args.threads) + \
        ' | samtools fixmate -m - - -@ ' + str(args.threads) + \
        ' | samtools sort - -@ ' + str(args.threads) + \
        ' | samtools markdup -r - -@ ' + str(args.threads) + ' ' + \
philcharron-cfia commented 10 months ago

Fixed error: typo in command.