Mercurial > repos > geert-vandeweyer > vcf_to_variantdb
comparison VCF_to_VariantDB.pl @ 7:04e3bba317f4 draft
Added selection to differentiate in VCF format
author | geert-vandeweyer |
---|---|
date | Thu, 05 Jun 2014 04:02:28 -0400 |
parents | 6ddc1c6472ef |
children | db44ff975de8 |
comparison
equal
deleted
inserted
replaced
6:775372e00f55 | 7:04e3bba317f4 |
---|---|
18 # c = encoded id of bam file (optional) | 18 # c = encoded id of bam file (optional) |
19 # C = encoded id of Bam index , needed if b is specified => NOT POSSIBLE YET, NEEDS INDEXING ON VARIANTDB SERVER ! | 19 # C = encoded id of Bam index , needed if b is specified => NOT POSSIBLE YET, NEEDS INDEXING ON VARIANTDB SERVER ! |
20 # S = (S)erver addrress to send data to. | 20 # S = (S)erver addrress to send data to. |
21 # R = (r)oot of galaxy web server (/home/galaxyuser/galaxy-dist) | 21 # R = (r)oot of galaxy web server (/home/galaxyuser/galaxy-dist) |
22 # H = (H)ost of the galaxy web server (http://my.galaxy.server/galaxy/) | 22 # H = (H)ost of the galaxy web server (http://my.galaxy.server/galaxy/) |
23 getopts('v:u:n:a:g:o:b:B:V:c:S:R:H:', \%opts); # option are in %opts | 23 # F = (F)ormat of input file |
24 getopts('v:u:n:a:g:o:b:B:V:c:S:R:H:F:', \%opts); # option are in %opts | |
24 | 25 |
25 $|++; | 26 $|++; |
26 ################# | 27 ################# |
27 ## CHECK INPUT ## | 28 ## CHECK INPUT ## |
28 ################# | 29 ################# |
38 if (!exists($opts{'S'})) { | 39 if (!exists($opts{'S'})) { |
39 die('No VariantDB server specified'); | 40 die('No VariantDB server specified'); |
40 } | 41 } |
41 if (!exists($opts{'H'})) { | 42 if (!exists($opts{'H'})) { |
42 die('The Galaxy source-server is not specified'); | 43 die('The Galaxy source-server is not specified'); |
44 } | |
45 if (!exists($opts{'F'})) { | |
46 die('VCF format not specified.'); | |
43 } | 47 } |
44 | 48 |
45 ################ | 49 ################ |
46 # open outfile # | 50 # open outfile # |
47 ################ | 51 ################ |
88 ############################################### | 92 ############################################### |
89 # filepaths | 93 # filepaths |
90 my $vcfpath = $opts{'v'}; | 94 my $vcfpath = $opts{'v'}; |
91 my $bampath = $opts{'b'}; | 95 my $bampath = $opts{'b'}; |
92 my $baipath = $opts{'B'}; | 96 my $baipath = $opts{'B'}; |
97 # input VCF format | |
98 $format = $opts{'F'}; | |
93 # make output directory in (galaxy/static/) working dir | 99 # make output directory in (galaxy/static/) working dir |
94 my $rand = int(rand(1000)); | 100 my $rand = int(rand(1000)); |
95 our $wd = $opts{'R'}."/static/VCF_parser.".$rand; #int(rand(1000)); | 101 our $wd = $opts{'R'}."/static/VCF_parser.".$rand; #int(rand(1000)); |
96 our $dd = $opts{'H'}."/static/VCF_parser.".$rand; | 102 our $dd = $opts{'H'}."/static/VCF_parser.".$rand; |
97 while (-d $wd) { | 103 while (-d $wd) { |
114 } | 120 } |
115 $sample = $opts{'n'}; | 121 $sample = $opts{'n'}; |
116 $gender = $opts{'g'}; | 122 $gender = $opts{'g'}; |
117 # post form to the variantDB host. | 123 # post form to the variantDB host. |
118 if (exists($opts{'b'})) { | 124 if (exists($opts{'b'})) { |
119 $response = $conn->post( $url, {'VCFurl1' => "$vcfurl", 'BAMurl1' => "$bamurl", 'BAIurl1' => "$bamidxurl",'storedata1' => 1, 'name1' => "$sample", 'gender1' => "$gender", 'User' => $email, 'GalaxyUpload' => 1} ); | 125 $response = $conn->post( $url, {'VCFurl1' => "$vcfurl", 'BAMurl1' => "$bamurl", 'BAIurl1' => "$bamidxurl",'storedata1' => 1, 'name1' => "$sample", 'gender1' => "$gender", 'User' => $email, 'GalaxyUpload' => 1,'Format1' => $format} ); |
120 } | 126 } |
121 else { | 127 else { |
122 $response = $conn->post( $url, {'VCFurl1' => "$vcfurl", 'name1' => "$sample", 'gender1' => "$gender", 'User' => $email, 'GalaxyUpload' =>1 } ); | 128 $response = $conn->post( $url, {'VCFurl1' => "$vcfurl", 'name1' => "$sample", 'gender1' => "$gender", 'User' => $email, 'GalaxyUpload' =>1, 'Format1' => $format } ); |
123 } | 129 } |
124 my $content = $response->decoded_content(); | 130 my $content = $response->decoded_content(); |
125 chomp($content); | 131 chomp($content); |
126 ## check if upload went ok. | 132 ## check if upload went ok. |
127 if (substr($content,0,2) ne 'OK') { | 133 if (substr($content,0,2) ne 'OK') { |