5
|
1 <tool name="blasttoolssearch" id="blasttoolssearch" version="3.1">
|
0
|
2 <!--Source in git at: https://github.com/fubar2/galaxy-->
|
|
3 <!--Created by toolfactory@galaxy.org at 19/07/2023 12:39:19 using the Galaxy Tool Factory.-->
|
|
4 <description>Runs a legacy Java jar called blasttools from https://github.com/schmidda/blast-tools/tree/master</description>
|
|
5 <requirements>
|
|
6 <requirement type="package">csvtk</requirement>
|
|
7 <requirement type="package">openjdk</requirement>
|
|
8 </requirements>
|
|
9 <stdio>
|
|
10 <exit_code range="1:" level="fatal"/>
|
|
11 </stdio>
|
|
12 <version_command><![CDATA[echo "3.0"]]></version_command>
|
5
|
13 <command><![CDATA[
|
|
14 mkdir -p files &&
|
6
|
15 ln -sf '$blastn_search_outputs' files/\$(basename '$blastn_search_outputs') &&
|
5
|
16 bash $runme ./files $__tool_directory__/BlastTools.jar $summary_viruses_viroids
|
0
|
17 ]]></command>
|
|
18 <configfiles>
|
|
19 <configfile name="runme"><![CDATA[#raw
|
|
20
|
|
21
|
|
22 ## eResearch Office, QUT
|
|
23 ## Created: 31 March 2021
|
|
24 ## Last modified: 28 September 2022
|
|
25 ## Script: Processes Galaxy Australia generated blastN outputs to summarise and report hits to REGULATED and ENDEMIC viruses/viroids.
|
|
26 ## Usage: ./run_VirReport_Summary.sh
|
|
27 ## changed to accept a single input file name passed as $1
|
|
28 ## Ross Lazarus for a ToolFactory wrapper for Robert Barrero
|
|
29 ## July 18 2023
|
|
30
|
|
31 dataPath=${PWD}
|
|
32
|
|
33 # Requirement: One or more GA-VSD .tabular outputs need to be in the folder where the command above (Usage)is executed.
|
|
34 # The script will Look for all files with the suffix *.tabular
|
|
35
|
|
36 #Processing tabular files
|
5
|
37 for file in files/*.*
|
|
38 do
|
0
|
39 var=$(basename $file)
|
|
40
|
|
41 #STEP0: fetch Top 1 Hits
|
|
42 cat $file | awk '{print $1}' | sort | uniq > ${var}.top1.ids
|
|
43 for i in `cat ${var}.top1.ids`
|
|
44 do
|
|
45 echo "fetching top hits..." $i;
|
|
46 grep $i $file | head -1 >> ${var}.top1Hits.txt;
|
|
47 done
|
|
48
|
|
49 #STEP1: modify the columns of Galaxy Australia (GA) blast output to the expected format by the BlastTools.jar tool
|
|
50 ###### namely: qseqid sgi sacc length pident mismatch gapopen qstart qend qlen sstart send slen sstrand evalue bitscore qcovhsp stitle staxids qseq sseq sseqid qcovs qframe sframe
|
|
51 cat ${var}.top1Hits.txt |csvtk cut -H -t -f 1,19,20,4,3,5,6,7,8,17,9,10,18,22,11,12,24,21,25,15,16,2,23,13,14 | sed 's/ /_/g' > ${var}.txt
|
|
52
|
|
53 #STEP2: summarise the GA blastN files
|
|
54 java -jar $2 -t blastn ${var}.txt
|
|
55 #filter virus/viroid/endo
|
|
56 cat summary_${var}.txt | grep "virus\|viroid\|endo" > summary_${var}_filtered.txt
|
|
57
|
|
58 #STEP3: fetch unique names from Blast summary reports
|
|
59 cat summary_${var}_filtered.txt | awk '{print $7}' | awk -F "|" '{print $2}'| sort | uniq | sed 's/Species://' > ${var}_uniq.ids
|
|
60
|
|
61 #STEP4: retrieve the best hit for each virus/viroid
|
|
62 echo "processing top hits ..."
|
|
63 touch ${var}_filtered.txt
|
|
64 for id in `cat ${var}_uniq.ids`
|
|
65 do
|
|
66 #print on the screen the name of the virus/viroids to search
|
|
67 #echo "fetching species matches ..." $id
|
|
68
|
|
69 #fetch the virus name on the summary_blastn file by selecting the longest alignment (column 3) and highest genome coverage (column 5)
|
|
70 grep $id summary_${var}.txt | sort -k3,3nr -k5,5nr | head -1 >> ${var}_filtered.txt
|
|
71 done
|
|
72
|
|
73 #print the header of the inital summary_blastn file
|
|
74 cat summary_${var}.txt | head -1 > header
|
|
75 #report 1
|
3
|
76 cat header ${var}_filtered.txt > $3
|
5
|
77 done
|
0
|
78 #end raw]]></configfile>
|
|
79 </configfiles>
|
|
80 <inputs>
|
6
|
81 <param name="blastn_search_outputs" type="data" optional="false" label="blastn_search_outputs" help="" format="tabular" multiple="false"/>
|
0
|
82 </inputs>
|
|
83 <outputs>
|
1
|
84 <data name="summary_viruses_viroids" format="tabular" label="summary_viruses_viroids" hidden="false"/>
|
0
|
85 </outputs>
|
|
86 <tests>
|
|
87 <test>
|
|
88 <output name="summary_viruses_viroids" value="summary_viruses_viroids_sample" compare="diff" lines_diff="0"/>
|
|
89 <param name="blastn_search_outputs" value="blastn_search_outputs_sample"/>
|
|
90 </test>
|
|
91 </tests>
|
|
92 <help><![CDATA[
|
|
93
|
|
94 **What it Does**
|
|
95
|
|
96 Wraps https://github.com/schmidda/blast-tools/tree/master as a Galaxy tool as a demonstration for Roberto Barrero
|
|
97
|
2
|
98
|
0
|
99
|
|
100 ]]></help>
|
|
101 <citations>
|
|
102 <citation type="doi">10.1093/bioinformatics/bts573</citation>
|
|
103 </citations>
|
|
104 </tool>
|
|
105
|