view pima_report.xml @ 4:428aed51c487 draft

Uploaded
author greg
date Thu, 09 Mar 2023 16:52:14 +0000
parents 33d9832420c5
children 7177d81eb7cb
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($illumina_fastq_file.element_identifier))
#set assembly_name = re.sub('[^\s\w\-]', '_', str($assembly_fasta_file.element_identifier))

#set blastn_version = 'unknown'
#for $i in $blastn_features:
    #set blastn_version = re.sub('[^\s\w\-]', '_', str($blastn_file.element_identifier))
#end for

#set dnadiff_version = re.sub('[^\s\w\-]', '_', str($dnadiff_snps_file.element_identifier))
#set dnadiff_version = $dnadiff_version.rstrip('(snps)')
#if str($flye_assembly_info_file) not in ['None', '']:
    #set flye_version = re.sub('[^\s\w\-]', '_', str($flye_assembly_info_file.element_identifier))
    #set flye_version = $flye_version.rstrip('(assembly info)')
#end if
#if str($kraken2_report_file) not in ['None', '']:
    #set kraken2_version = re.sub('[^\s\w\-]', '_', str($kraken2_report_file.element_identifier))
    #set kraken2_version = $kraken2_version.rstrip('(report)')
#end if

mkdir amr_matrix_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 $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($blastn_file) not in ['None', '']:
    --blastn_version '$blastn_version'
#end if
--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'
--dnadiff_version '$dnadiff_version'
--feature_bed_dir 'feature_bed_dir'
--feature_png_dir 'feature_png_dir'
#if str($flye_assembly_info_file) not in ['None', '']:
    --flye_assembly_info_file '$flye_assembly_info_file'
    --flye_version '$flye_version'
#end if
--genome_insertions_file '$genome_insertions_file'
#if $illumina_fastq_file.ext.endswith(".gz"):
    --gzipped
#end if
--illumina_fastq_file '$illumina_fastq_file'
#if str($kraken2_report_file) not in ['None', '']:
    --kraken2_report_file '$kraken2_report_file'
    --kraken2_version '$kraken2_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'
--reference_insertions_file '$reference_insertions_file'
&& 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="blastn_features" format="tabular" type="data_collection" collection_type="list" label="Collection of blastn tabular 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="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="flye_assembly_info_file" type="data" format="tabular,tsv" optional="true" label="Flye assembly info tabular 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="illumina_fastq_file" type="data" format="fastqsanger,fastqsanger.gz" label="Fastq sample 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="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"/>
    </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="illumina_fastq_file" value="illumina_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>