Mercurial > repos > geert-vandeweyer > vcf_to_variantdb
changeset 2:d03a63a57e82 draft
New version, better following configuration guidelines
author | geert-vandeweyer |
---|---|
date | Wed, 19 Feb 2014 06:45:32 -0500 |
parents | 355e491dbd0f |
children | f2525e35b8e9 |
files | VCF_to_VariantDB.pl VCF_to_VariantDB.xml VCF_to_VariantDB_macros.xml readme.rst tool_dependencies.xml |
diffstat | 5 files changed, 77 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/VCF_to_VariantDB.pl Wed May 08 04:34:30 2013 -0400 +++ b/VCF_to_VariantDB.pl Wed Feb 19 06:45:32 2014 -0500 @@ -22,7 +22,7 @@ # H = (H)ost of the galaxy web server (http://my.galaxy.server/galaxy/) getopts('v:u:n:a:g:o:b:B:V:c:S:R:H:', \%opts); # option are in %opts - +$|++; ################# ## CHECK INPUT ## ################# @@ -55,6 +55,7 @@ $url =~ s/\/\/$/\//; $url .= "cgi-bin/galaxy_communication.cgi"; my $conn = LWP::UserAgent->new(); +$conn->timeout(1800); my $response = $conn->post( $url, {'HelloWorld' => 1} ); my $content = $response->decoded_content(); @@ -113,20 +114,42 @@ $gender = $opts{'g'}; # post form to the variantDB host. if (exists($opts{'b'})) { - $response = $conn->post( $url, {'VCFurl1' => "$vcfurl", 'BAMurl1' => "$bamurl", 'BAIurl1' => "$bamidxurl",'storedata' => 1, 'name1' => "$sample", 'gender1' => "$gender", 'User' => $email} ); + $response = $conn->post( $url, {'VCFurl1' => "$vcfurl", 'BAMurl1' => "$bamurl", 'BAIurl1' => "$bamidxurl",'storedata1' => 1, 'name1' => "$sample", 'gender1' => "$gender", 'User' => $email, 'GalaxyUpload' => 1} ); } else { - $response = $conn->post( $url, {'VCFurl1' => "$vcfurl", 'sample1' => "$sample", 'gender1' => "$gender", 'User' => $email} ); + $response = $conn->post( $url, {'VCFurl1' => "$vcfurl", 'name1' => "$sample", 'gender1' => "$gender", 'User' => $email, 'GalaxyUpload' =>1 } ); } my $content = $response->decoded_content(); chomp($content); -if ($content =~ m/OK$/) { - print OUT "Processing Datafiles : OK.\n"; - print OUT "\n$content\n"; -} -else { +## check if upload went ok. +if (substr($content,0,2) ne 'OK') { die("ERROR: $content"); } +## extract wd from content. +print OUT "Uploading datafiles to VariantDB : OK.\n"; +$content =~ m/OK-(.+)$/; +$rwd = $1; +if ($rwd eq '') { + die("ERROR : No remote working directory provided to check status."); +} +## now wait for the import to finish. +$status = 0; +while ($status == 0) { + my $response = $conn->post( $url, {'CheckStatus' => 1,'rwd' => $rwd}) ; + $content = $response->decoded_content(); + chomp($content); + if (substr($content,0,2) ne 'OK') { + die("ERROR: $content"); + } + $status = substr($content,3,1); + sleep 10; +} + +## Loading OK +# latest respons : OK-1-Content +$content = substr($content,5); +print OUT "Processing Datafiles : OK.\n"; +print OUT "\n$content\n"; close OUT; # clean up
--- a/VCF_to_VariantDB.xml Wed May 08 04:34:30 2013 -0400 +++ b/VCF_to_VariantDB.xml Wed Feb 19 06:45:32 2014 -0500 @@ -1,14 +1,17 @@ -<tool id="VCF_to_DB_rev" name="Send VCF file to the Database" version="0.1.1"> - <description>Reverse processing (on VariantDB server)</description> +<tool id="VCF_to_DB_rev" name="VCF to VariantDB" version="0.1.2"> + <description></description> + <expand macro="requirements" /> + <macros> + <import>VCF_to_VariantDB_macros.xml</import> + </macros> <command interpreter="perl"> - VCF_to_VariantDB.pl - ## THE GALAXY HOST - -H 'http://143.169.238.104/galaxy' + VCF_to_DB_reverse.pl + -H '@URL@' -R $__root_dir__ ## input file -v $input1 -V $__app__.security.encode_id( '%s' % $input1.id ) - ## user email, for identification in VariantDB, accounts must match + ## user email, for identification in DataBase -u $__user_email__ ## OUTPUT FILE @@ -64,7 +67,7 @@ <option value="other">Select a file to base the name on</option> </param> <when value="typed"> - <param name="typedname" type="text" size="25" label="Sample Name for Report." /> + <param name="typedname" type="text" size="25" label="Sample Name." /> </when> <when value="other"> <param name="namefile" type="data" format="sam,bam,fastq,fasta,bed,fastqsanger,fastqillumina,txt,vcf" label="Select a file from the history to base the sample name upon" /> @@ -77,7 +80,6 @@ </param> <param name="server" type="select" label="VariantDB-Server: " help="Specify the VariantDB server you wish to send the data to. You MUST have a valid account on the target server, identical to your account here."> <option value="http://143.169.238.104/variantdb/">Main Server @ University of Antwerp</option> - <!-- Specify other VariantDB instances here --> </param> </inputs> <outputs> @@ -87,16 +89,14 @@ **What it does** -This tools sends the results from the GATK unified genotyper to a VariantDB server. From there, variants can be compared between samples, filtered on various annotations etc. To add servers, specify them in the tool configuration XML file. Accounts must match between the chosen VariantDB and Galaxy user. - -VariantDB is an flexible portal for filtering and annotating variants. +This tools sends the results from the GATK unified genotyper to a VariantDB server. From there, variants can be compared between samples, filtered on various annotations etc. To add servers, specify them in the tool configuration XML file. ------ **Input file** -VCF file from the GATK Unified Genotyper. Optional : BAM file for storage in VariantDB and subsequent visualisation in IGV. +VCF file from the GATK Unified Genotyper. ------
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/VCF_to_VariantDB_macros.xml Wed Feb 19 06:45:32 2014 -0500 @@ -0,0 +1,11 @@ +<macros> + <xml name="requirements"> + <requirements> + <requirement type="package" version="6.05">perl_module_www</requirement> + <requirement type="set_environment">GALAXY_URL</requirement> + </requirements> + </xml> + <token name="@URL@"> + "\$GALAXY_URL/" + </token> +</macros>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/readme.rst Wed Feb 19 06:45:32 2014 -0500 @@ -0,0 +1,17 @@ +Galaxy wrapper for VariantDB Import +=================================== + +This wrapper and VariantDB is written by Geert Vandeweyer. + +The recommended installation is by means of the toolshed_. + +.. _toolshed: http://toolshed.g2.bx.psu.edu/view/geert-vandeweyer/vcf_to_variantdb + +Galaxy should be able to install the needed perl module dependencies automatically +for you. To allow your server to communicate with VariantDB, you must edit the GALAXY_URL environment variable in the file: + +<tool_dependency_dir>/environment_settings/GALAXY_URL/geert-vandeweyer/vcf_to_variantdb/<hash_string>/env.sh + +to point to the full URL of the server (e.g: http://biominavm-galaxy.biomina.be/galaxy ) where you have installed the wrapper. + +Finally, if you also have a private VariantDB instance, you need to add it to the wrapper configuration file, as an extra option.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool_dependencies.xml Wed Feb 19 06:45:32 2014 -0500 @@ -0,0 +1,6 @@ +<?xml version="1.0"?> +<tool_dependency> + <package name="perl_module_libwww" version="6.05"> + <repository changeset_revision="f217bf3faf3b" name="package_perl_libwww" owner="geert-vandeweyer" toolshed="http://toolshed.g2.bx.psu.edu" /> + </package> +</tool_dependency>