view tbvcfreport.xml @ 3:42818629ec4c draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/blob/master/tools/tbvcfreport commit f54e7cfd572498517dde7fe6afab47a20e3fcb17
author iuc
date Fri, 31 May 2024 20:06:49 +0000
parents 4934c0ac6197
children 9793bc5d741b
line wrap: on
line source

<?xml version="1.0" ?>
<tool id="tbvcfreport" name="TB Variant Report" version="@TOOL_VERSION@+galaxy0" profile="23.0" license="AGPL-3.0-or-later">
  <description>- generate HTML report from SnpEff annotated M.tb VCF(s)</description>
  <macros>
    <token name="@TOOL_VERSION@">1.0.0</token>
  </macros>
  <requirements>
    <requirement type="package" version="@TOOL_VERSION@">tbvcfreport</requirement>
  </requirements>
  <command detect_errors="exit_code">
    <![CDATA[
    #if $adv.database_uri
        export DATABASE_URI='${adv.database_uri}' &&
    #end if
    
    #if not '.vcf' in str($input_vcf.element_identifier)
        #set $input_vcf_filename = str($input_vcf.element_identifier).replace(' ', '') + '.vcf'
    #else
        #set $input_vcf_filename = str($input_vcf.element_identifier).replace(' ', '')
    #end if

    ln -s '${input_vcf}' '${input_vcf_filename}' &&
    
    #set vcf_name = os.path.splitext(os.path.basename($input_vcf_filename))[0]
    
    #if $tbprofiler_json
        #if not '.json' in str($tbprofiler_json.element_identifier)
          #set $tbprofiler_report = str($tbprofiler_json.element_identifier).replace(' ', '') + '.json'
        #else
            #set $tbprofiler_report = str($tbprofiler_json.element_identifier).replace(' ', '')
        #end if
        ln -s '${tbprofiler_json}' '${tbprofiler_report}' &&
    #end if

    tbvcfreport generate

    $filter_udi
    
    #if $tbprofiler_json
        --tbprofiler-report '${tbprofiler_report}'
    #end if
    
    '${input_vcf_filename}' &&

    #set variants_report = str(vcf_name) + '_variants_report'
    #set html_variants_report = variants_report + '.html'
    #set txt_variants_report = variants_report + '.txt'

    mv '${html_variants_report}' '$variants_report_html' &&
    mv '${txt_variants_report}' '$variants_report_txt'

    #if $tbprofiler_json
        #set drug_resistance_report = str(vcf_name) + '_drug_resistance_report'
        #set html_drug_resistance_report = drug_resistance_report + '.html'
        #set txt_drug_resistance_report = drug_resistance_report + '.txt'
        
        && mv '${html_drug_resistance_report}' '$drug_resistance_report_html'
        && mv '${txt_drug_resistance_report}' '$drug_resistance_report_txt'
    #end if
    ]]>
  </command>
  <inputs>
    <param name="input_vcf" type="data" format="vcf" label="Input SnpEff annotated M.tuberculosis VCF(s)" />
    <param name="tbprofiler_json" type="data" format="json" optional="true" label="TBProfiler Drug Resistance Report (Optional)" help="--tbprofiler-report" />
    <param argument="--filter-udi" type="boolean" truevalue="--filter-udi" falsevalue="--no-filter-udi" checked="true" label="Filter UPSTREAM, DOWNSTREAM and INTERGENIC variants" />
    <section name="adv" title="Advanced options" expanded="false">
      <param name="database_uri" type="text" optional="true" value="neodb.sanbi.ac.za" label="Specify COMBAT-TB-NeoDB URI" help="For people with their own deployment of COMBAT-TB-NeoDB" />
    </section>
  </inputs>
  <outputs>
    <data name="variants_report_html" format="html" label="${tool.name} variants report (html) on ${on_string}" />
    <data name="variants_report_txt" format="txt" label="${tool.name} variants report (text) on ${on_string}" />
    <data name="drug_resistance_report_html" format="html" label="${tool.name} drug resistance report (html) on ${on_string}">
      <filter>tbprofiler_json</filter>
    </data>
    <data name="drug_resistance_report_txt" format="txt" label="${tool.name} drug resistance report (text) on ${on_string}">
      <filter>tbprofiler_json</filter>
    </data>
  </outputs>
  <tests>
    <test expect_num_outputs="2">
      <param name="input_vcf" value="rif_resistant.vcf" ftype="vcf" />
      <output name="variants_report_html" compare="diff" lines_diff="2" file="rif_resistant_variants_report.html" ftype="html" />
      <output name="variants_report_txt" compare="diff" lines_diff="2" file="rif_resistant_variants_report.txt" ftype="txt" />
    </test>
    <test expect_num_outputs="4">
      <param name="input_vcf" value="rif_resistant.vcf" ftype="vcf" />
      <param name="tbprofiler_json" value="rif_resistant.results.json" ftype="json" />
      <output name="variants_report_html" compare="diff" lines_diff="2" file="rif_resistant_variants_report_with_lineage.html" ftype="html" />
      <output name="variants_report_txt" compare="diff" lines_diff="2" file="rif_resistant_variants_report_with_lineage.txt" ftype="txt" />
      <output name="drug_resistance_report_html" file="rif_resistant_drug_resistance_report.html" lines_diff="2" ftype="html" />
      <output name="drug_resistance_report_txt" compare="diff" lines_diff="2" file="rif_resistant_drug_resistance_report.txt" ftype="txt" />
    </test>
    <test expect_num_outputs="2">
      <!-- test for bug fixed in 0.1.9 onwards: a gene with no protein product -->
      <param name="input_vcf" value="vcf_with_no_protein.vcf" ftype="vcf" />
      <output name="variants_report_html" compare="diff" lines_diff="2" file="vcf_with_no_protein_report.html" ftype="html" />
      <output name="variants_report_txt" compare="diff" lines_diff="2" file="vcf_with_no_protein_report.txt" ftype="txt" />      
    </test>
  </tests>
  <help>
    <![CDATA[
    **tbvcfreport - @TOOL_VERSION@**

    **tbvcfreport** takes SnpEff annotated M.tuberculosis VCF file(s) and generates an HTML-based report with data from Combat-TB-NeoDB  
    and links to Combat-TB-eXplorer (https://explorer.sanbi.ac.za/).

    **tbvcfreport** will generate an HTML-based Drug Resistance report if provided with a TBProfiler json report.
    
    Drug resistance predictions are for **Research Purposes Only** and are produced by TBProfiler (https://github.com/jodyphelan/TBProfiler)
    
    **Inputs**

        - SnpEff annotated M.tuberculosis VCF file(s) - vcf - **required**
        
        - TBProfiler Drug Resistance JSON Report - json - **optional**

    **Outputs**

        - Variant Report in HTML and TXT format
        
        - Drug Resistance Report in HTML and TXT format if provided with a TBProfiler json report
          
        
    **Advanced options**:

        - database_uri - String - Use an on-premise COMBAT-TB-NeoDB (default 'neodb.sanbi.ac.za') - **optional**

    **Further information**
    
    For more on the **COMBAT-TB Project**, see https://combattb.org.

    For more on **tbvcfreport**, see https://github.com/COMBAT-TB/tbvcfreport.
    
    For more on **COMBAT-TB-NeoDB**, see https://github.com/COMBAT-TB/combat-tb-neodb.
    ]]>
  </help>
  <citations>
    <citation type="bibtex">
@misc{githubtbvcfreport,
  author = {COMBAT-TB},
  year = {2019},
  title = {tbvcfreport},
  publisher = {GitHub},
  journal = {GitHub repository},
  url = {https://github.com/COMBAT-TB/tbvcfreport},
}</citation>
  </citations>
</tool>