How To Install Ensembl Perl Api On Windows?
3
0
Entering edit mode
13.1 years ago

Dear All, I just want to use perl API to fetch some transcripts of one gene, and after search with google, I got some codes from bioperl howto in WiKi. I just followed the instruction on the website of Ensembl to install perl API in the path C:/src of my windows system, but after trying many times, I can not run the following codes successfully; actually, I think the codes are correct, but I can not figure out how to install Ensembl perl API correctly. Is there anybody has some experience with running Ensembl Perl API on windows?

   #!/usr/bin/perl
BEGIN{ push @INC,'C:/src/bioperl-live','C:/src/ensembl/modules','C:/src/ensembl-compara/modules','C:/src/ensembl-variation/modules','C:/src/ensembl-functgenomics/modules';};

use strict;

use Bio::EnsEMBL::Registry;

use Getopt::Long;

use Bio::SeqIO;

  # old style (deprecated) use the Bio::EnsEMBL::Registry

  #use Bio::EnsEMBL::DBSQL::DBAdaptor;

  # initialize some defaults

my $species = 'homo_sapiens';

my $source  = 'core';# core or vega


  # allow identifier being passed as the first argument in the command line or by an option -n or -gene_symbol


my $identifier ="CD55";


GetOptions(
           "n|gene_symbol=s" => \$identifier,
           "species=s"       => \$species,
           "source=s"         => \$source,
          );

my $out_seq = Bio::SeqIO->new(
                              -fg => \*STDOUT,
                              -format => 'fasta',
                             );

  # The current way for accesing ensemble is using the registry
  # it matches your API with its corresponding ensembl database version
  # Also takes care of the mysql port (now is in a non standard port 5306)

my $reg = 'Bio::EnsEMBL::Registry';

$reg->load_registry_from_db(-host => 'ensembldb.ensembl.org', -user=>'anonymous');

my $gene_adaptor   = $reg->get_adaptor($species, $source, 'Gene' );

foreach my $gene (@{$gene_adaptor->fetch_all_by_external_name($identifier)}) {

    # the seq method in gene returns the nucleotide sequence
    # [warning] in transcript and exon objects, the seq method returns a biperl Bio::Seq object
    print "gene sequence for " . $identifier.":\n". $gene->seq() . "\n";

    foreach my $trans (@{$gene->get_all_Transcripts}) {

        # print the spliced sequence in fasta (you can print the raw seq with $trans->seq->seq())
        print "\ttranscript " . $trans->stable_id() . ":\n";
        $out_seq->write_seq($trans->seq);
    }
}
ensembl perl api windows • 7.1k views
ADD COMMENT
0
Entering edit mode

Can you provide details on the error you are seeing when you run your script?

ADD REPLY
0
Entering edit mode

I have installed two month back with lots of effort, it's not easy in Windows though. But, I will try to write in details later with all sources

ADD REPLY
0
Entering edit mode

Can you give link you followed while installing? I have installed two month back with lots of effort, it's not easy though.

ADD REPLY
0
Entering edit mode

Did you checked whether Perl/ BioPerl is working?

ADD REPLY
0
Entering edit mode

first make sure that perl and bioperl are working? After testing that you can follow perl api installation

ADD REPLY
0
Entering edit mode

it is running without output any results, which means it didn't stop running and I can not get results from the scripts.

ADD REPLY
0
Entering edit mode

Previously, I installed bioperl successfully, but when I ran the above codes, the script keep running without no result output. Would you please give me some suggestions about the problem? Thanks!

ADD REPLY
5
Entering edit mode
13.1 years ago
Bert Overduin ★ 3.7k

Hello,

On the Ensembl page that describes the API installation there are some "Additional Tips for Window users" mentioned:

  • You will of course need Perl installed to use the API! This is available free of charge from ActiveState.
  • You will also need to install the DBD::MySQL package using PPM (Perl Package Manager), a command-line tool which is bundled with ActivePerl.
  • If the existing mysql-driver ("libmysql.dll") doesn't work, replace it - e.g. with the one distributed with "php-5-2-3-win32-installer.msi"

Hope this helps.

Note that questions regarding the Perl API can also be posted to our developers mailing list (dev@ensembl.org). How to subscribe to this list you can find here.

ADD COMMENT
0
Entering edit mode

By the way, the script itself is indeed fine. I did run it and it gave the expected output.

ADD REPLY
0
Entering edit mode

I dont think only that much tips will work out

ADD REPLY
0
Entering edit mode

Thanks. I just followed the first two rules listed in your response, maybe it is my libmysql.dll did not work.

ADD REPLY
3
Entering edit mode
13.1 years ago
Thaman ★ 3.3k

I can understand your problem in installing Perl API because it's not straight forward like Windows people do just click for installation. The most challenging part is making Biperl to work not Biomart according to me.

Some Tips

  • First install Active State Perl and please keep in mind about version so you can find right Bioperl for your Active state perl.
  • Check whether Perl is working or not, how? Command prompt ->C:\Perl -v , if doesn't work then set system variable PATH of your Perl. How like I did HERE for Python
  • Follow precisely the Command Line installation instruction given in Wiki for BioPerl
  • If you succeed to install BioPerl through Perl Package Manager (PPM) command line then it's best to check whether BioPerl is working or not. How ? use Bio::Perl; save it and run it. If it works then BioPerl is successfully installed.
  • For other testing it's here LINK
  • Now you are just left to install Ensembl packages you need for that just follow API Installtion. Note, you dont need to download BioPerl again. Please installtion Ensembl packages carefully and set PATH like it says in API installation. And for DBD follow the given instruction there.
  • If it doesn't work out then you can do with CVS too, it may work
  • Now, it's time to check which will list all database in Ensembl, here is CODE. For your simplicity I have given all modules PATH.
  • Please try to read what error you encounter while running and try to make some sense from it. If it says module not found then check either by giving the whole path where that module is located.

And please post ERROR you have encountered without erros nobody's knows what's going on!

Hope this helps

ADD COMMENT
0
Entering edit mode

I just copied your codes and ran it in my computer, but it resulted in failure. The following is the warning results, would you please help me again?

DBI connect('host=ensembldb.ensembl.org;port=5306','anonymous',...) failed: Can't connect to MySQL server on 'ensembldb.ensembl.org' (10060) at C:/Perl/site/bin/ensembl/modules/Bio/EnsEMBL/Registry.pm line 1426
Can't call method "selectall_arrayref" on an undefined value at C:/Perl/site/bin/ensembl/modules/Bio/EnsEMBL/Registry.pm line 1429.
Content-type:text/html
ADD REPLY
0
Entering edit mode

I just copy your codes to run in my computer, it is running without output any results, which means it didn't stop running and I can not get results from the scripts. Actually, this is the same when I ran my own codes listed above. Would you please help me again? Thanks very much!

ADD REPLY
0
Entering edit mode

You are getting output while running any scripts?

ADD REPLY
0
Entering edit mode

yes, of course, I can get results for other perl script, but with exception of running ensemble perl api!

ADD REPLY
0
Entering edit mode

I try your code today, and it is successful now, aha, :>)

ADD REPLY
0
Entering edit mode

but when I saved you code in the temp.pl and run it in cmd again, but it only print the "Content-type:text/html", then it stop there for long long time. Is it possible for my access to ensemble been blocked by some antiviral software?

ADD REPLY
0
Entering edit mode

You can download OptiPerl from interent for perl interpreter and Editor which is convinent. You can remove "Content-type:text/html" from scripts if you are running in command because it's for broswer. If you are successful with my answer then please accept it.

ADD REPLY
0
Entering edit mode

Actually, when I ran your codes with perl in Ultraedit, it is only successful once. Maybe there are some problems about my web access, as when I run mysql, it connect to ensemble very slowly.

ADD REPLY
2
Entering edit mode
13.1 years ago
Darked89 4.6k

I am not a Perl or Windows guru, but on the top of your script you have

#!/usr/local/bin/perl

No chance this is going to work except from within i.e. Cygwin environment. If you have Windows Perl installation, then the path to the binary will never be /usr/local/bin/perl

It should be something like #!C:\Perl\bin\perl.exe

ADD COMMENT
1
Entering edit mode

It depends whether you call the script with Perl or tell the system to execute it (and it has to find the Perl interpreter itself)

ADD REPLY
0
Entering edit mode

In fact, this is not very important when I run perl script in Ultraedit. I did the above for other perl codes without any problems!

ADD REPLY
0
Entering edit mode

Yeah, when I run perl script in Ultraedit, the path of perl is C:/Perl/bin.

ADD REPLY
0
Entering edit mode

I saved you code in the temp.pl and run it in cmd again, but it only print the "Content-type:text/html", then it stop there for long long time.

ADD REPLY
0
Entering edit mode

Michael Schubert is right: you will be OK if you run the script perl scriptname.pl, but obviously my answer was about different situation, where you try to move scripts between Linux and Windows system and execute them the same way on the command line. Anyway, questions containing #when running foobar.pl I am getting XYZ error on my output# do not suffer that much from guys answering non existing problems you may have had.

ADD REPLY

Login before adding your answer.

Traffic: 2509 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6