Mercurial > repos > pcingola > snpeff
annotate snpEff/scripts/queryBiomart.pl @ 0:481a95ca5339
Migrated tool version 0.9 from old tool shed archive to new tool shed repository
author | pcingola |
---|---|
date | Tue, 07 Jun 2011 17:08:59 -0400 |
parents | |
children |
rev | line source |
---|---|
0
481a95ca5339
Migrated tool version 0.9 from old tool shed archive to new tool shed repository
pcingola
parents:
diff
changeset
|
1 #!/usr/bin/perl |
481a95ca5339
Migrated tool version 0.9 from old tool shed archive to new tool shed repository
pcingola
parents:
diff
changeset
|
2 |
481a95ca5339
Migrated tool version 0.9 from old tool shed archive to new tool shed repository
pcingola
parents:
diff
changeset
|
3 #------------------------------------------------------------------------------ |
481a95ca5339
Migrated tool version 0.9 from old tool shed archive to new tool shed repository
pcingola
parents:
diff
changeset
|
4 # An example script demonstrating the use of BioMart webservice |
481a95ca5339
Migrated tool version 0.9 from old tool shed archive to new tool shed repository
pcingola
parents:
diff
changeset
|
5 #------------------------------------------------------------------------------ |
481a95ca5339
Migrated tool version 0.9 from old tool shed archive to new tool shed repository
pcingola
parents:
diff
changeset
|
6 |
481a95ca5339
Migrated tool version 0.9 from old tool shed archive to new tool shed repository
pcingola
parents:
diff
changeset
|
7 use strict; |
481a95ca5339
Migrated tool version 0.9 from old tool shed archive to new tool shed repository
pcingola
parents:
diff
changeset
|
8 use LWP::UserAgent; |
481a95ca5339
Migrated tool version 0.9 from old tool shed archive to new tool shed repository
pcingola
parents:
diff
changeset
|
9 |
481a95ca5339
Migrated tool version 0.9 from old tool shed archive to new tool shed repository
pcingola
parents:
diff
changeset
|
10 open (FH,$ARGV[0]) || die ("\nUsage: queryBiomart.pl Query.xml\n\n"); |
481a95ca5339
Migrated tool version 0.9 from old tool shed archive to new tool shed repository
pcingola
parents:
diff
changeset
|
11 my $xml; |
481a95ca5339
Migrated tool version 0.9 from old tool shed archive to new tool shed repository
pcingola
parents:
diff
changeset
|
12 while (<FH>){ $xml .= $_; } |
481a95ca5339
Migrated tool version 0.9 from old tool shed archive to new tool shed repository
pcingola
parents:
diff
changeset
|
13 close(FH); |
481a95ca5339
Migrated tool version 0.9 from old tool shed archive to new tool shed repository
pcingola
parents:
diff
changeset
|
14 |
481a95ca5339
Migrated tool version 0.9 from old tool shed archive to new tool shed repository
pcingola
parents:
diff
changeset
|
15 my $path="http://www.biomart.org/biomart/martservice?"; |
481a95ca5339
Migrated tool version 0.9 from old tool shed archive to new tool shed repository
pcingola
parents:
diff
changeset
|
16 my $request = HTTP::Request->new("POST",$path,HTTP::Headers->new(),'query='.$xml."\n"); |
481a95ca5339
Migrated tool version 0.9 from old tool shed archive to new tool shed repository
pcingola
parents:
diff
changeset
|
17 my $ua = LWP::UserAgent->new; |
481a95ca5339
Migrated tool version 0.9 from old tool shed archive to new tool shed repository
pcingola
parents:
diff
changeset
|
18 |
481a95ca5339
Migrated tool version 0.9 from old tool shed archive to new tool shed repository
pcingola
parents:
diff
changeset
|
19 my $response; |
481a95ca5339
Migrated tool version 0.9 from old tool shed archive to new tool shed repository
pcingola
parents:
diff
changeset
|
20 $ua->request($request, |
481a95ca5339
Migrated tool version 0.9 from old tool shed archive to new tool shed repository
pcingola
parents:
diff
changeset
|
21 sub { |
481a95ca5339
Migrated tool version 0.9 from old tool shed archive to new tool shed repository
pcingola
parents:
diff
changeset
|
22 my($data, $response) = @_; |
481a95ca5339
Migrated tool version 0.9 from old tool shed archive to new tool shed repository
pcingola
parents:
diff
changeset
|
23 if ($response->is_success) { print "$data"; } |
481a95ca5339
Migrated tool version 0.9 from old tool shed archive to new tool shed repository
pcingola
parents:
diff
changeset
|
24 else { warn ("Problems with the web server: ".$response->status_line); } |
481a95ca5339
Migrated tool version 0.9 from old tool shed archive to new tool shed repository
pcingola
parents:
diff
changeset
|
25 } ,1000); |