view 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
line wrap: on
line source

#!/usr/bin/perl

#------------------------------------------------------------------------------
# An example script demonstrating the use of BioMart webservice
#------------------------------------------------------------------------------

use strict;
use LWP::UserAgent;

open (FH,$ARGV[0]) || die ("\nUsage: queryBiomart.pl Query.xml\n\n");
my $xml;
while (<FH>){ $xml .= $_; }
close(FH);

my $path="http://www.biomart.org/biomart/martservice?";
my $request = HTTP::Request->new("POST",$path,HTTP::Headers->new(),'query='.$xml."\n");
my $ua = LWP::UserAgent->new;

my $response;
$ua->request($request, 
	     sub {   
		 my($data, $response) = @_;
		 if ($response->is_success) { print "$data"; }
		 else { warn ("Problems with the web server: ".$response->status_line); }
	     } ,1000);