view pima_report.xml @ 21:667b253329c6 draft

Uploaded
author greg
date Thu, 13 Apr 2023 17:13:40 +0000
parents e948214a9e3c
children d89b7d47a85a
line wrap: on
line source

<tool id="pima_report" name="PIMA: summary report" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
  <description></description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements"/>
    <command detect_errors="exit_code"><![CDATA[
#import re

#set analysis_name = re.sub('[^\s\w\-]', '_', str($fastq_file.element_identifier))
#set assembly_name = re.sub('[^\s\w\-]', '_', str($assembly_fasta_file.element_identifier))

#if str($bedtools_complementbed_file) not in ['None', '']:
    #set bedtools_version = re.sub('[^\s\w\-]', '_', str($bedtools_complementbed_file.element_identifier))
#end if
#if str($blastn_features) not in ['None', '']:
    #set blastn_version = re.sub('[^\s\w\-]', '_', str($blastn_features.element_identifier))
#end if
#if str($dnadiff_snps_file) not in ['None', '']:
    #set dnadiff_version = re.sub('[^\s\w\-]', '_', str($dnadiff_snps_file.element_identifier))
#end if
#if str($assembler_version_file) not in ['None', '']:
    #set assembler_version = re.sub('[^\s\w\-]', '_', str($assembler_version_file.element_identifier))
#end if
#if str($kraken2_report_file) not in ['None', '']:
    #set kraken2_version = re.sub('[^\s\w\-]', '_', str($kraken2_report_file.element_identifier))
#end if
#if str($minimap2_bam_file) not in ['None', '']:
    #set minimap2_version = re.sub('[^\s\w\-]', '_', str($minimap2_bam_file.element_identifier))
#end if
#if str($samtools_pileup_file) not in ['None', '']:
    #set samtools_version = re.sub('[^\s\w\-]', '_', str($samtools_pileup_file.element_identifier))
#end if
#if str($varscan_vcf_file) not in ['None', '']:
    #set varscan_version = re.sub('[^\s\w\-]', '_', str($varscan_vcf_file.element_identifier))
#end if

mkdir amr_matrix_png_dir &&
mkdir circos_png_dir &&
mkdir feature_bed_dir &&
mkdir feature_png_dir &&
mkdir mutation_regions_dir &&
touch 'pima_report.pdf' &&

#for $i in $amr_matrices_png:
    #set file_name = $i.file_name
    #set identifier = re.sub('[^\s\w\-\\.]', '_', str($i.element_identifier))
    ln -s $i 'amr_matrix_png_dir/$identifier' &&
#end for
#for $i in $circos_png:
    #set file_name = $i.file_name
    #set identifier = re.sub('[^\s\w\-\\.]', '_', str($i.element_identifier))
    ln -s $i 'circos_png_dir/$identifier' &&
#end for
#for $i in $features_bed:
    #set file_name = $i.file_name
    #set identifier = re.sub('[^\s\w\-\\.]', '_', str($i.element_identifier))
    ln -s $i 'feature_bed_dir/$identifier' &&
#end for
#for $i in $features_png:
    #set file_name = $i.file_name
    #set identifier = re.sub('[^\s\w\-\\.]', '_', str($i.element_identifier))
    ln -s $i 'feature_png_dir/$identifier' &&
#end for
#for $i in $mutation_regions:
    #set file_name = $i.file_name
    #set identifier = re.sub('[^\s\w\-\\.]', '_', str($i.element_identifier))
    ln -s $i 'mutation_regions_dir/$identifier' &&
#end for

python '${__tool_directory__}/pima_report.py' 
--amr_matrix_png_dir 'amr_matrix_png_dir'
--amr_deletions_file '$amr_deletions_file'
--analysis_name '$analysis_name'
--assembly_fasta_file '$assembly_fasta_file'
--assembly_name '$assembly_name'
#if str($bedtools_complementbed_file) not in ['None', '']:
    --bedtools_version '$bedtools_version'
#end if
#if str($blastn_features) not in ['None', '']:
    --blastn_version '$blastn_version'
#end if
--circos_png_dir 'circos_png_dir'
--compute_sequence_length_file '$compute_sequence_length_file'
--contig_coverage_file '$contig_coverage_file'
--dbkey '$aligned_sample.metadata.dbkey'
--dnadiff_snps_file '$dnadiff_snps_file'
#if str($dnadiff_snps_file) not in ['None', '']:
    --dnadiff_version '$dnadiff_version'
#end if
--errors_file '$errors_file'
--feature_bed_dir 'feature_bed_dir'
--feature_png_dir 'feature_png_dir'
#if str($assembler_version_file) not in ['None', '']:
    --assembler_version '$assembler_version'
    #if str($read_type) == 'ont':
        ## Need to pass the tabular flye assembly file.
        --flye_assembly_info_file '$assembler_version_file'
    #end if
#end if
--genome_insertions_file '$genome_insertions_file'
#if $fastq_file.ext.endswith(".gz"):
    --gzipped
#end if
--fastq_file '$fastq_file'
#if str($kraken2_report_file) not in ['None', '']:
    --kraken2_report_file '$kraken2_report_file'
    --kraken2_version '$kraken2_version'
#end if
#if str($minimap2_bam_file) not in ['None', '']:
    --minimap2_version '$minimap2_version'
#end if
--mutation_regions_dir 'mutation_regions_dir'
--mutation_regions_bed_file '$mutation_regions_bed_file'
--pima_css '${__tool_directory__}/pima.css'
--plasmids_file '$plasmids_file'
--quast_report_file '$quast_report_file'
--read_type '$read_type'
--reference_insertions_file '$reference_insertions_file'
#if str($samtools_pileup_file) not in ['None', '']:
    --samtools_version '$samtools_version'
#end if
#if str($varscan_vcf_file) not in ['None', '']:
    --varscan_version '$varscan_version'
#end if
&& mv 'pima_report.pdf' '$output'
    ]]></command>
    <inputs>
        <param name="amr_matrices_png" format="png" type="data_collection" collection_type="list" label="Collection of AMR matrix PNG files"/>
        <param name="aligned_sample" type="data" format="bam" label="Aligned sample BAM file"/>
        <param name="amr_deletions_file" type="data" format="bed" label="AMR deletions BED file"/>
        <param name="assembly_fasta_file" type="data" format="fasta" label="Assembly FASTA file"/>
        <param name="bedtools_complementbed_file" type="data" format="bed" label="Bedtools ComplementBed BED file"/>
        <param name="blastn_features" format="tabular" type="data_collection" collection_type="list" label="Collection of blastn tabular files"/>
        <param name="circos_png" format="png" type="data_collection" collection_type="list" label="Collection of circos PNG files"/>
        <param name="compute_sequence_length_file" type="data" format="tabular,tsv" label="Compute sequence length tabular file"/>
        <param name="contig_coverage_file" type="data" format="tabular,tsv" label="Contig coverage tabular file"/>
        <param name="dnadiff_snps_file" type="data" format="tabular" label="DNAdiff snps tabular file"/>
        <param name="errors_file" type="data" format="txt" label="AMR mutation regions error txt file"/>
        <param name="fastq_file" type="data" format="fastqsanger,fastqsanger.gz" label="Fastq sample file"/>
        <param name="features_bed" format="bed" type="data_collection" collection_type="list" label="Collection of best feature hits BED files"/>
        <param name="features_png" format="png" type="data_collection" collection_type="list" label="Collection of best feature hits PNG files"/>
        <param name="assembler_version_file" type="data" format="fasta,tabular,tsv" optional="true" label="Assembly version file" help="Optional, ignored if not selected"/>
        <param name="genome_insertions_file" type="data" format="bed" label="Genome insertions BED file"/>
        <param name="kraken2_report_file" type="data" format="tabular,tsv" optional="true" label="Kraken2 report tabular file" help="Optional, ignored if not selected"/>
        <param name="minimap2_bam_file" type="data" format="bam" label="Minimap2 BAM file"/>
        <param name="mutation_regions" format="tabular,tsv" type="data_collection" collection_type="list" label="Collection of mutation regions tabular files"/>
        <param name="mutation_regions_bed_file" type="data" format="mutations_regions,bed" label="Mutation regions BED file"/>
        <param name="quast_report_file" type="data" format="tabular" label="Quast report tabular file"/>
        <param argument="--read_type" type="select" label="Specify the read type">
            <option value="ont" selected="true">Long reads - Oxford Nanopore Technologies (ONT)</option>
            <option value="illumina">Short reads - Illumina</option>
        </param>
        <param name="reference_insertions_file" type="data" format="bed" label="Reference insertions BED file"/>
        <param name="plasmids_file" type="data" format="tsv" label="pChunks plasmids TSV file"/>
        <param name="samtools_pileup_file" type="data" format="pileup" label="Samtools pileup file"/>
        <param name="varscan_vcf_file" type="data" format="vcf" label="Varscan VCF file"/>
    </inputs>
    <outputs>
        <data name="output" format="pdf"/>
    </outputs>
    <tests>
        <test>
            <param name="aligned_sample" value="aligned_sample.bam" ftype="bam"/>
            <param name="assembly_fasta_file" value="assembly_fasta.fasta" ftype="fasta"/>
            <param name="contig_coverage_file" value="contig_coverage.tabular" ftype="tabular"/>
            <param name="fastq_file" value="ont_fastq.fastq" ftype="fastq"/>
            <output name="output" value="output.pdf" ftype="pdf"/>
        </test>
    </tests>
    <help>
**What it does**

Generates the PIMA analysis summary report.
    </help>
    <expand macro="citations"/>
</tool>