Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AGAT - Add new feature (functional annotation) #1377

Merged
merged 7 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
176 changes: 133 additions & 43 deletions tools/agat/agat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,46 @@
<expand macro="requirements" />
<version_command>agat_sq_stat_basic.pl --version</version_command>
<command detect_errors="exit_code"><![CDATA[

#if $tool.selector == 'functional_annotation'
#if $tool.blast_adv.options == "yes":
ln -s '$tool.blast_adv.database' ./functional_annotation_blast.fasta &&
#end if
#end if

#if $tool.selector == 'fix'
@input_annotation_single@
agat_convert_sp_gxf2gxf.pl
--gxf $input_annotation
--config $agat_configfile
--output 'output' &&
cat 'output' > '${annotation}'
--gxf '$input_annotation'
--config '$agat_configfile'
--output ./output &&
cat ./output > '${annotation}'
#else if $tool.selector == 'convert_GFF2GTF'
@input_annotation_single@
agat_convert_sp_gff2gtf.pl
--gff $input_annotation
--gff '$input_annotation'
--gtf_version $tool.gtf_version
--output 'output.gtf' &&
cat 'output.gtf' > '${annotation_gtf}'
--output ./output.gtf &&
cat ./output.gtf > '${annotation_gtf}'
#else if $tool.selector == 'convert_GTF2GFF'
@input_annotation_single@
agat_convert_sp_gxf2gxf.pl
--gff $input_annotation
--output 'output.gff' &&
cat 'output.gff' > '${annotation_gff}'
--gff '$input_annotation'
--output ./output.gff &&
cat ./output.gff > '${annotation_gff}'
#else if $tool.selector == 'compare'
@input_annotation_double@
agat_sp_compare_two_annotations.pl
--gff1 $input1
--gff2 $input2
--output 'temp_output' &&
cat 'temp_output' > '${stats_output}'
--gff1 '$input1'
--gff2 '$input2'
--output ./temp_output &&
cat ./temp_output > '${stats_output}'
#else if $tool.selector == 'extract'
@input_annotation_single@
@input_reference@
agat_sp_extract_sequences.pl
--gff $input_annotation
-f $ref_genome
--gff '$input_annotation'
-f '$ref_genome'
$tool.mrna
$tool.cdna
$tool.clean_final_stop
Expand Down Expand Up @@ -68,53 +75,67 @@
@input_reference@
mkdir -p './statistics' &&
agat_sp_functional_statistics.pl
--gff $input_annotation
--gs $ref_genome
--output 'temp_output' &&
--gff '$input_annotation'
--gs '$ref_genome'
--output ./temp_output &&
cat 'temp_output/gene@transcript/table_per_feature_type.txt' > '$stats_output'

#else if $tool.selector == 'merge_annotations'
@input_annotation_double@
agat_sp_merge_annotations.pl
--gff $input1
--gff $input2
--config $agat_configfile
--output 'output' &&
cat 'output' > '${annotation}'
--gff '$input1'
--gff '$input2'
--config '$agat_configfile'
--output ./output &&
cat ./output > '${annotation}'
#else if $tool.selector == 'annotation_statistics'
@input_annotation_single@
@input_reference@
agat_sp_statistics.pl
--gff $input_annotation
--gs $ref_genome
--gff '$input_annotation'
--gs '$ref_genome'
-d
--output 'temp_output' &&
cat 'temp_output' > '$stats_output'
--output ./temp_output &&
cat ./temp_output > '$stats_output'
#else if $tool.selector == 'filter_feature_fasta'
@input_annotation_single@
@input_reference@
agat_sq_filter_feature_from_fasta.pl
--gff $input_annotation
--fasta $ref_genome
--config $agat_configfile
--output 'output' &&
cat 'output' > '${annotation}'
--gff '$input_annotation'
--fasta '$ref_genome'
--config '$agat_configfile'
--output ./output &&
cat ./output > '${annotation}'
#else if $tool.selector == 'complement'
@input_annotation_double@
agat_sp_complement_annotations.pl
--ref $input1
--add $input2
--ref '$input1'
--add '$input2'
--size_min $tool.size_min
--config $agat_configfile
--output 'temp_output' &&
cat 'temp_output' > '${annotation}'
--config '$agat_configfile'
--output ./temp_output &&
cat ./temp_output > '${annotation}'
#else if $tool.selector == 'splice_sites'
@input_annotation_single@
agat_sp_add_splice_sites.pl
--gff $input_annotation
--config $agat_configfile
--output 'output' &&
cat 'output' > '${annotation}'
--gff '$input_annotation'
--config '$agat_configfile'
--output ./output &&
cat ./output > '${annotation}'
#else if $tool.selector == 'functional_annotation'
@input_annotation_single@
agat_sp_manage_functional_annotation.pl
--gff '$input_annotation'
#if $tool.input_interpro:
--interpro '$tool.input_interpro'
#end if
#if str($tool.blast_adv.options) == "yes":
-b '$tool.blast_adv.input_blast'
--db ./functional_annotation_blast.fasta
--blast_evalue $tool.blast_adv.evalue
#end if
-pe $tool.prot_existence
-o galaxy_functional_annot
#end if
]]>
</command>
Expand Down Expand Up @@ -171,6 +192,7 @@ check_identical_isoforms: true
<option value="fix">Fix and/or standarize GFF3 annotation file (agat_convert_sp_gxf2gxf.pl)</option>
<option value="functional_analysis">Functional analysis (agat_sp_functional_statistics.pl)</option>
<option value="merge_annotations">Merge annotations (agat_sp_merge_annotations.pl)</option>
<option value="functional_annotation">Functional annotation (agat_sp_manage_functional_annotation.pl)</option>
</param>
<when value="annotation_statistics">
<expand macro="ANNOTATION_INPUT"/>
Expand Down Expand Up @@ -273,6 +295,32 @@ check_identical_isoforms: true
<expand macro="ANNOTATION_INPUT" format="gff,gff3,gff3.gz"/>
<expand macro="AGAT_CONFIG"/>
</when>

<when value="functional_annotation">
<expand macro="ANNOTATION_INPUT" format="gff,gff3,gff3.gz"/>
<param argument="-i" name="input_interpro" type="data" format="tabular" optional="true" label="Input interpro file"/>

<conditional name="blast_adv">
<param name="options" type="select" label="Blast options">
<option value="yes">Show</option>
<option value="no" selected="true">Hide</option>
</param>
<when value="yes">
<param argument="-b" name="input_blast" type="data" format="tabular" optional="true" label="Input blast file"/>
<param argument="--db" name="database" type="data" format="fasta" optional="true" label="Fasta file using for the blast" help="Gene names and products/descriptions will be fished from this file." />
<param argument="--blast_evalue" name="evalue" type="float" min="0" max="1" value="0.000001" label="Maximum e-value to keep the annotation from the blast file"/>
</when>
<when value="no">
</when>
</conditional>
<param name="prot_existence" type="select" label="Protein existence (PE)" help="You can decide until which protein existence level you want to consider to lift the finctional information">
<option value="1">Experimental evidence at protein level</option>
<option value="2">Experimental evidence at transcript level</option>
<option value="3">Protein inferred from homology </option>
<option value="4">Protein predicted</option>
<option value="5" selected="true">Protein uncertain</option>
</param>
</when>
</conditional>
</inputs>
<outputs>
Expand Down Expand Up @@ -302,8 +350,32 @@ check_identical_isoforms: true
<discover_datasets pattern="__designation_and_ext__" directory="temp_output_distribution_plots/without_isoforms" format="pdf"/>
<filter>tool['selector'] == 'annotation_statistics'</filter>
</collection>
<data name="sequence_annot_functional_report" format="txt" from_work_dir="galaxy_functional_annot/report.txt" label="${tool.name} on ${on_string}: Report">
<filter>tool['selector'] =='functional_annotation'</filter>
</data>
<data name="sequence_annot_functional_error" format="txt" from_work_dir="galaxy_functional_annot/error.txt" label="${tool.name} on ${on_string}: Error">
<filter>tool['selector'] =='functional_annotation'</filter>
</data>
<data name="sequence_annot_functional_duplicate_blast" format="txt" from_work_dir="galaxy_functional_annot/duplicatedNameFromBlast.txt" label="${tool.name} on ${on_string}: Duplicate name from Blast">
<filter>tool['selector'] =='functional_annotation' and tool['blast_adv']['options'] == 'yes'</filter>
</data>
<data name="sequence_annot_functional_interpro_GO" format="txt" from_work_dir="galaxy_functional_annot/GO.txt" label="${tool.name} on ${on_string}: GO terms">
<filter>tool['selector'] =='functional_annotation' and tool['input_interpro']</filter>
</data >
<data name="sequence_annot_functional_interpro" format="txt" from_work_dir="galaxy_functional_annot/InterPro.txt" label="${tool.name} on ${on_string}: InterPro">
<filter>tool['selector'] =='functional_annotation' and tool['input_interpro']</filter>
</data>
<data name="sequence_annot_functional_MetaCyc" format="txt" from_work_dir="galaxy_functional_annot/MetaCyc.txt" label="${tool.name} on ${on_string}: MetaCyc">
<filter>tool['selector'] =='functional_annotation' and tool['input_interpro']</filter>
</data>
<data name="sequence_annot_functional_ProSitePatterns" format="txt" from_work_dir="galaxy_functional_annot/ProSitePatterns.txt" label="${tool.name} on ${on_string}: ProSitePatterns">
<filter>tool['selector'] =='functional_annotation' and tool['input_interpro']</filter>
</data>
<data name="sequence_annot_functional_Reactome" format="txt" from_work_dir="galaxy_functional_annot/Reactome.txt" label="${tool.name} on ${on_string}: Reactome">
<filter>tool['selector'] =='functional_annotation' and tool['input_interpro']</filter>
</data>
</outputs>
<tests>
<tests>
<!-- Test 01: annotation statistics-->
<test expect_num_outputs="3">
<conditional name="tool">
Expand Down Expand Up @@ -456,6 +528,24 @@ check_identical_isoforms: true
</conditional>
<output name="annotation" file="test13.gff" ftype="gff"/>
</test>
<!-- Test 14: Functional annotation -->
<test expect_num_outputs="7">
<conditional name="tool">
<param name="selector" value="functional_annotation"/>
<param name="gff" value="annotation_fixed.gff" ftype="gff"/>
<param name="input_interpro" value="interpro_input.tabular"/>
<conditional name="blast_adv">
<param name="options" value="no"/>
</conditional>
</conditional>
<output name="sequence_annot_functional_report" file="functional_annot/report.txt" ftype="txt" lines_diff="2"/>
<output name="sequence_annot_functional_error" file="functional_annot/error.txt" ftype="txt" lines_diff="2"/>
<output name="sequence_annot_functional_interpro_GO" file="functional_annot/GO.txt" ftype="txt" lines_diff="2"/>
<output name="sequence_annot_functional_interpro" file="functional_annot/InterPro.txt" ftype="txt" lines_diff="2"/>
<output name="sequence_annot_functional_MetaCyc" file="functional_annot/MetaCyc.txt" ftype="txt" lines_diff="2"/>
<output name="sequence_annot_functional_ProSitePatterns" file="functional_annot/ProSitePatterns.txt" ftype="txt" lines_diff="2"/>
<output name="sequence_annot_functional_Reactome" file="functional_annot/Reactome.txt" ftype="txt" lines_diff="2"/>
</test>
</tests>
<help><![CDATA[

Expand Down
10 changes: 4 additions & 6 deletions tools/agat/macros.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<macros>
<token name="@TOOL_VERSION@">1.2.0</token>
<token name="@VERSION_SUFFIX@">0</token>
<token name="@VERSION_SUFFIX@">1</token>
<xml name="requirements">
<requirements>
<requirement type="package" version="@TOOL_VERSION@">agat</requirement>
Expand Down Expand Up @@ -75,17 +75,15 @@
<token name="@input_reference@"><![CDATA[
#if $tool.reference_genome.source == 'history':
#set $ref_genome = 'reference.fasta'
ln -s -f '${tool.reference_genome.history_item}' $ref_genome &&
ln -s -f '${tool.reference_genome.history_item}' '$ref_genome' &&
#else:
#set $ref_genome = $tool.reference_genome.index.fields.path
#end if
]]></token>
<token name="@input_annotation_double@"><![CDATA[
#set $input1 = 'annotation1.' + str($tool.input_annotation1.ext)
#set $input2 = 'annotation2.' + str($tool.input_annotation2.ext)
ln -s '${tool.input_annotation1}' $input1 &&
ln -s '${tool.input_annotation2}' $input2 &&
ln -s '${tool.input_annotation1}' '$input1' &&
ln -s '${tool.input_annotation2}' '$input2' &&
]]></token>


</macros>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
NZ_CP027599.1 NZ_CP027599.1 100.000 22480 0 0 1 22480 1 22480 0.0 41513
NZ_CP027599.1 NZ_CP027599.1 91.509 106 6 3 307387 307491 5689 5792 1.68e-33 143
NZ_CP027599.1 NZ_CP027599.1 90.476 105 8 2 671407 671510 5792 5689 7.81e-32 137
NZ_CP027599.1 NZ_CP027599.1 91.000 100 9 0 932461 932560 5689 5788 2.81e-31 135
NZ_CP027599.1 NZ_CP027599.1 88.235 102 9 2 791810 791910 5689 5788 2.83e-26 119
NZ_CP027599.1 NZ_CP027599.1 88.119 101 10 2 198515 198614 5788 5689 2.83e-26 119
NZ_CP027599.1 NZ_CP027599.1 85.185 108 13 3 348198 348304 5794 5689 6.13e-23 108
NZ_CP027599.1 NZ_CP027599.1 85.714 105 11 3 791923 792025 5689 5791 6.13e-23 108
NZ_CP027599.1 NZ_CP027599.1 85.149 101 12 3 165325 165424 5787 5689 1.03e-20 100
NZ_CP027599.1 NZ_CP027599.1 100.000 34 0 0 802967 803000 5789 5756 1.35e-09 63.9
NZ_CP027599.1 NZ_CP027599.1 97.059 34 1 0 897128 897161 5758 5791 6.26e-08 58.4
NZ_CP027599.1 NZ_CP027599.1 100.000 28 0 0 886300 886327 5689 5716 2.91e-06 52.8
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NZ_CP027599.1 NZ_CP027599.1 100.000 22480 0 0 1 22480 1 22480 0.0 41513
Loading
Loading