chickenNuggets
chickenNuggets

Reputation: 25

Perl script to automate a website for bioinformatics

I would like to automate this website with a Perl script

http://bioinfo.uni-plovdiv.bg/microinspector/

This is what I have so far and I am not sure how to get to the output page after this, I know it has something to do with POST, redirect_ok?, response(), but I am not sure. I read through the documentation but am confused about some things. Thanks.

use strict;
use warnings;

use WWW::Mechanize;

# create object for browser
my $browser = WWW::Mechanize->new();
my ($sequence, $results);
open (DRG, "<microRNA_target_cspg_drg_output.fa") || die "cannot open microRNA_target_cspg_drg_output.fa";

while (<DRG>) {
        chomp;
        $sequence=$_;
        last; #for testing purposes
}
close (DRG);

$browser->get("http://bioinfo.uni-plovdiv.bg/microinspector/");
$browser->form_number(1);
$browser->field("target_sequence", $sequence);
$browser->field("Choose an organism : ", "Mus musculus");
$browser->click_button( number => 1);

Upvotes: 0

Views: 331

Answers (1)

Geo
Geo

Reputation: 96907

You should start with WWW::Mechanize. It's page provides examples on submitting forms, and anything else you will need.

EDIT: as a reply to your update, if you want to get the content of the page, use the content method, like in this example:

my $content = $browser->content();

See this for more info.

Upvotes: 4

Related Questions