comparison defuse.xml @ 3:c90022a13c7c

DeFuse - Allow user to save the workspace, create an html file with links to the files in the workspace. Allow the creatation of an HTML formatted results.filtered.tsv with links to cluster detail provided by the get_read.pl command.
author Jim Johnson <jj@umn.edu>
date Fri, 06 Jan 2012 16:06:17 -0600
parents 4245c2b047de
children 679a5c7b1294
comparison
equal deleted inserted replaced
2:4245c2b047de 3:c90022a13c7c
1 <tool id="defuse" name="DeFuse" version="1.1"> 1 <tool id="defuse" name="DeFuse" version="1.2">
2 <description>identify fusion transcripts</description> 2 <description>identify fusion transcripts</description>
3 <requirements> 3 <requirements>
4 <requirement type="binary"></requirement> 4 <requirement type="binary"></requirement>
5 </requirements> 5 </requirements>
6 <command interpreter="perl"> 6 <command interpreter="command"> /bin/bash $shscript </command>
7 ## Find the defuse.pl in the galaxy tool path
8 #import Cheetah.FileUtils
9 #set $toolpath = '/'.join([$__root_dir__,'tools','defuse'])
10 #set $defuse = $Cheetah.FileUtils.findFiles($toolpath,['defuse.pl'],[],['tools','external','include','em','data'])[0]
11 $defuse
12 -c `cp $defuse_config $config_txt; echo $defuse_config`
13 -d `mkdir -p data_dir; ln -s $left_pairendreads data_dir/reads_1.fastq; ln -s $right_pairendreads data_dir/reads_2.fastq; echo data_dir`
14 -o output_dir -p 8
15 </command>
16 <inputs> 7 <inputs>
17 <param name="left_pairendreads" type="data" format="fastq" label="left part of read pairs" help="The left and right reads pairs must be in the same order, and not have any unpaired reads. (FASTQ interlacer will pair reads and remove the unpaired. FASTQ de-interlacer will separate the result into left and right reads.)"/> 8 <param name="left_pairendreads" type="data" format="fastq" label="left part of read pairs" help="The left and right reads pairs must be in the same order, and not have any unpaired reads. (FASTQ interlacer will pair reads and remove the unpaired. FASTQ de-interlacer will separate the result into left and right reads.)"/>
18 <param name="right_pairendreads" type="data" format="fastq" label="right part of read pairs" help="In the same order as the left reads"/> 9 <param name="right_pairendreads" type="data" format="fastq" label="right part of read pairs" help="In the same order as the left reads"/>
19 <conditional name="refGenomeSource"> 10 <conditional name="refGenomeSource">
20 <param name="genomeSource" type="select" label="Will you select a built-in DeFuse Reference Dataset, or supply a configuration from your history" help=""> 11 <param name="genomeSource" type="select" label="Will you select a built-in DeFuse Reference Dataset, or supply a configuration from your history" help="">
75 </when> 66 </when>
76 <when value="history"> 67 <when value="history">
77 <param name="config" type="data" format="txt" label="Defuse Config file" help=""/> 68 <param name="config" type="data" format="txt" label="Defuse Config file" help=""/>
78 </when> <!-- history --> 69 </when> <!-- history -->
79 </conditional> <!-- refGenomeSource --> 70 </conditional> <!-- refGenomeSource -->
71 <param name="keep_output" type="boolean" checked="true" truevalue="yes" falsevalue="no" label="Save DeFuse working directory files"/>
72 <param name="do_get_reads" type="boolean" checked="false" truevalue="yes" falsevalue="no" label="Run get_reads on each cluster"/>
80 </inputs> 73 </inputs>
81 <configfiles> 74 <configfiles>
82 <configfile name="defuse_config"> 75 <configfile name="defuse_config">
83 #import ast 76 #import ast
84 #if $refGenomeSource.genomeSource == "history": 77 #if $refGenomeSource.genomeSource == "history":
241 # Bowtie parameters 234 # Bowtie parameters
242 bowtie_threads = #slurp 235 bowtie_threads = #slurp
243 #try 236 #try
244 $ref_dict['bowtie_threads'] 237 $ref_dict['bowtie_threads']
245 #except 238 #except
246 1 239 4
247 #end try 240 #end try
248 bowtie_quals = #slurp 241 bowtie_quals = #slurp
249 #try 242 #try
250 $ref_dict['bowtie_quals'] 243 $ref_dict['bowtie_quals']
251 #except 244 #except
500 #end raw 493 #end raw
501 494
502 #end if 495 #end if
503 496
504 </configfile> 497 </configfile>
498 <configfile name="shscript">
499 #!/bin/bash
500 ## define some things for cheetah proccessing
501 #set $ds = chr(36)
502 #set $gt = chr(62)
503 #set $lt = chr(60)
504 #set $echo_cmd = 'echo'
505 ## Find the defuse.pl in the galaxy tool path
506 #import Cheetah.FileUtils
507 #set $toolpath = '/'.join([$__root_dir__,'tools','defuse'])
508 #set $defuse = $Cheetah.FileUtils.findFiles($toolpath,['defuse.pl'],[],['tools','external','include','em','data'])[0]
509 #set $get_reads = $Cheetah.FileUtils.findFiles($toolpath,['get_reads.pl'],[],['tools','external','include','em','data'])[0]
510 ## declare a bash function for converting a results tsv into html with links to the get_reads output files
511 results2html() {
512 rlts=${ds}1
513 rslt_name=`basename ${ds}rlts`
514 html=${ds}2
515 echo '${lt}html${gt}${lt}head${gt}${lt}title${gt}Defuse '${ds}rslt_name'${lt}/title${gt}${lt}/head${gt}${lt}body${gt}' ${gt} ${ds}html
516 echo '${lt}h2${gt}Defuse '${ds}rslt_name'${lt}/h2${gt}${lt}table${gt}' ${gt}${gt} ${ds}html
517 if [ -z "${ds}3" ]
518 then
519 awk '${ds}1 ~ /cluster_id/{printf("${lt}tr${gt}");for (i = 1; i ${lt}= NF; i++) {printf("${lt}th${gt}%s${lt}/th${gt}", ${ds}i);}; printf("${lt}/tr${gt}\n");}\
520 ${ds}1 ~ /[1-9][0-9]*/{printf("${lt}tr${gt}");for (i = 1; i ${lt}= NF; i++) {printf("${lt}td${gt}%s${lt}/td${gt}", ${ds}i);}; printf("${lt}/tr${gt}\n");}' ${ds}rlts ${gt}${gt} ${ds}html
521 echo '${lt}/table${gt}' ${gt}${gt} ${ds}html
522 echo '${lt}/body${gt}${lt}/html${gt}' ${gt}${gt} ${ds}html
523 else
524 export _EFP=${ds}3
525 mkdir -p ${ds}_EFP
526 awk '${ds}1 ~ /cluster_id/{printf("${lt}tr${gt}");for (i = 1; i ${lt}= NF; i++) {printf("${lt}th${gt}%s${lt}/th${gt}", ${ds}i);}; printf("${lt}/tr${gt}\n");}\
527 ${ds}1 ~ /[1-9][0-9]*/{fn="cluster_"${ds}1"_reads.txt"; \
528 printf("${lt}tr${gt}${lt}td${gt}${lt}a href=\"%s\"${gt}%s${lt}/a${gt}${lt}/td${gt}",fn, ${ds}1);for (i = 2; i ${lt}= NF; i++) {printf("${lt}td${gt}%s${lt}/td${gt}", ${ds}i);}; printf("${lt}/tr${gt}\n");}' ${ds}rlts ${gt}${gt} ${ds}html
529 echo '${lt}/table${gt}' ${gt}${gt} ${ds}html
530 echo '${lt}/body${gt}${lt}/html${gt}' ${gt}${gt} ${ds}html
531 for i in `awk '${ds}1 ~ /[1-9][0-9]*/{print ${ds}1}' ${ds}rlts`;
532 do fn=cluster_${ds}{i}_reads.txt;
533 pn=${ds}_EFP/${ds}fn;
534 perl $get_reads -c $defuse_config -o output_dir -i ${ds}i ${gt} ${ds}pn;
535 done
536 fi
537 }
538 ## copy config to output
539 cp $defuse_config $config_txt
540 ## make a data_dir and ln -s the input fastq
541 mkdir -p data_dir
542 ln -s $left_pairendreads data_dir/reads_1.fastq
543 ln -s $right_pairendreads data_dir/reads_2.fastq
544 ## ln to output_dir in from_work_dir
545 #if $defuse_out.__str__ != 'None':
546 mkdir -p $defuse_out.extra_files_path
547 ln -s $defuse_out.extra_files_path output_dir
548 #else
549 mkdir -p output_dir
550 #end if
551 ## run defuse.pl
552 perl $defuse -c $defuse_config -d data_dir -o output_dir -p 8
553 ## copy primary results to output datasets
554 if [ -e output_dir/log/defuse.log ]; then cp output_dir/log/defuse.log $defuse_log; fi
555 if [ -e output_dir/results.tsv ]; then cp output_dir/results.tsv $results_tsv; fi
556 if [ -e output_dir/results.filtered.tsv ]; then cp output_dir/results.filtered.tsv $results_filtered_tsv; fi
557 if [ -e output_dir/results.classify.tsv ]; then cp output_dir/results.classify.tsv $results_classify_tsv; fi
558 ## create html with links for output_dir
559 #if $defuse_out.__str__ != 'None':
560 if [ -e $defuse_out ]
561 then
562 echo '${lt}html${gt}${lt}head${gt}${lt}title${gt}Defuse Output${lt}/title${gt}${lt}/head${gt}${lt}body${gt}' ${gt} $defuse_out
563 echo '${lt}h2${gt}Defuse Output Files${lt}/h2${gt}${lt}ul${gt}' ${gt}${gt} $defuse_out
564 pushd $defuse_out.extra_files_path
565 for f in `find -L . -maxdepth 1 -type f`;
566 do fn=`basename ${ds}f`; echo '${lt}li${gt}${lt}a href="'${ds}fn'"${gt}'${ds}fn'${lt}/a${gt}${lt}/li${gt}' ${gt}${gt} $defuse_out;
567 done
568 popd
569 echo '${lt}/ul${gt}' ${gt}${gt} $defuse_out
570 echo '${lt}/body${gt}${lt}/html${gt}' ${gt}${gt} $defuse_out
571 fi
572 #end if
573 ## run get_reads.pl on each cluster
574 #if $fusion_reads.__str__ != 'None':
575 if [ -e output_dir/results.filtered.tsv -a -e $fusion_reads ]
576 then
577 mkdir -p $fusion_reads.extra_files_path
578 results2html output_dir/results.filtered.tsv $fusion_reads $fusion_reads.extra_files_path
579 fi
580 #end if
581 </configfile>
505 </configfiles> 582 </configfiles>
506 <outputs> 583 <outputs>
507 <data format="txt" name="config_txt" label="${tool.name} on ${on_string}: config.txt"/> 584 <data format="txt" name="config_txt" label="${tool.name} on ${on_string}: config.txt"/>
508 <data format="txt" name="defuse_log" label="${tool.name} on ${on_string}: defuse.log" from_work_dir="output_dir/log/defuse.log"/> 585 <data format="txt" name="defuse_log" label="${tool.name} on ${on_string}: defuse.log" />
509 <data format="tabular" name="results_tsv" label="${tool.name} on ${on_string}: results.tsv" from_work_dir="output_dir/results.tsv"/> 586 <data format="html" name="defuse_out" label="${tool.name} on ${on_string}: defuse_output">
510 <data format="tabular" name="results_filtered_tsv" label="${tool.name} on ${on_string}: results.filtered.tsv" from_work_dir="output_dir/results.filtered.tsv"/> 587 <filter>keep_output == True</filter>
511 <data format="tabular" name="results_classify_tsv" label="${tool.name} on ${on_string}: results.classify.tsv" from_work_dir="output_dir/results.classify.tsv"/> 588 </data>
589 <data format="html" name="fusion_reads" label="${tool.name} on ${on_string}: fusion_reads">
590 <filter>do_get_reads == True</filter>
591 </data>
592 <data format="tabular" name="results_tsv" label="${tool.name} on ${on_string}: results.tsv" />
593 <data format="tabular" name="results_filtered_tsv" label="${tool.name} on ${on_string}: results.filtered.tsv" />
594 <data format="tabular" name="results_classify_tsv" label="${tool.name} on ${on_string}: results.classify.tsv" />
512 </outputs> 595 </outputs>
513 <tests> 596 <tests>
514 </tests> 597 </tests>
515 <help> 598 <help>
516 **DeFuse** 599 **DeFuse**