view pima_report.xml @ 29:1352b8aa5979 draft

Uploaded
author greg
date Tue, 02 May 2023 13:40:06 +0000
parents 27485e70ed2b
children
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

#if str($read_type_cond.read_type) == 'ont':
    #set analysis_name = re.sub('[^\s\w\-]', '_', str($read_type_cond.ont_file.element_identifier))
#else:
    #set analysis_name = re.sub('[^\s\w\-]', '_', str($read_type_cond.illumina_forward_read.element_identifier))
#end if
#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

## All ONT samples are single-end reads, while all Illumina samples are
## sets if paired reads.  For ONT, we need both an assembly_fasta_file
## which is produced by the medaka pipeline and and assembler_version_file
## which is produced by flye.  For Illumina we need only the assembly_fasta_file
## which is produced by SPAdes since the version can be derived from it.
#if str($assembler_version_file) in ['None', '']:
    ## We're analyzing a set of Illumina paired reads.
    #set assembler_version = re.sub('[^\s\w\-]', '_', str($assembly_fasta_file.element_identifier))
#else:
    ## We're analyzing an ONT sample.
    #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

#if str($lrn_risk_amr_files) != 'None':
    touch 'lrn_risk_amr.tsv' &&
    #for $i in $lrn_risk_amr_files:
        cat $i >> 'lrn_risk_amr.tsv' &&
    #end for
#end if

#if str($lrn_risk_blacklist_files) != 'None':
    touch 'lrn_risk_blacklist.tsv' &&
    #for $i in $lrn_risk_blacklist_files:
        cat $i >> 'lrn_risk_blacklist.tsv' &&
    #end for
#end if

#if str($lrn_risk_vf_files) != 'None':
    touch 'lrn_risk_vf.tsv' &&
    #for $i in $lrn_risk_vf_files:
        cat $i >> 'lrn_risk_vf.tsv' &&
    #end for
#end if

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_cond.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 str($read_type_cond.read_type) == 'ont':
    ## We're analyzing a single-edn ONT sample.
    #if $read_type_cond.ont_file.ext.endswith(".gz"):
        --gzipped
    #end if
    --ont_file '$read_type_cond.ont_file'
#else:
    ## We're analyzing a set of Illumina paired reads.
    #if $read_type_cond.illumina_forward_read.ext.endswith(".gz"):
        --gzipped
    #end if
    --illumina_forward_read_file '$read_type_cond.illumina_forward_read'
    --illumina_reverse_read_file '$read_type_cond.illumina_reverse_read'
#end if
#if str($kraken2_report_file) not in ['None', '']:
    --kraken2_report_file '$kraken2_report_file'
    --kraken2_version '$kraken2_version'
#end if
--lrn_risk_amr_file 'lrn_risk_amr.tsv'
--lrn_risk_blacklist_file 'lrn_risk_blacklist.tsv'
--lrn_risk_vf_file 'lrn_risk_vf.tsv'
#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_cond.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="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="lrn_risk_amr_files" format="tsv" type="data" multiple="true" optional="true" label="LRN Risk AMR files"/>
        <param name="lrn_risk_blacklist_files" format="tsv" type="data" multiple="true" optional="true" label="LRN Risk blacklist files"/>
        <param name="lrn_risk_vf_files" format="tsv" type="data" multiple="true" optional="true" label="LRN Risk virulence factors files"/>
        <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"/>
        <conditional name="read_type_cond">
            <param argument="--read_type" type="select" label="Specify the read type">
                <option value="ont" selected="true">ONT single read</option>
                <option value="illumina">Illumina read pair</option>
            </param>
            <when value="ont">
                <param name="ont_file" type="data" format="fastqsanger,fastqsanger.gz" label="ONT single read sample file"/>
            </when>
            <when value="illumina">
                <param name="illumina_forward_read" format="fastqsanger,fastqsanger.gz" type="data" label="Illumina forward read sample file"/>
                <param name="illumina_reverse_read" format="fastqsanger,fastqsanger.gz" type="data" label="Illumina reverse read sample file"/>
            </when>
        </conditional>
        <param name="reference_insertions_file" type="data" format="bed" label="Reference insertions BED file"/>
        <param name="plasmids_file" type="data" format="tsv" optional="true" label="pChunks plasmids TSV file" help="Optional, ignored if not selected"/>
        <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="read_type" value="ont"/>
            <param name="ont_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>