Question: How To Install Ensembl Perl Api On Windows?
0
gravatar for Cheng Zhongshan
8.1 years ago by
Cheng Zhongshan400 wrote:

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);
    }
}
perl ensembl api windows • 4.0k views
ADD COMMENTlink modified 8.1 years ago by Thaman3.2k • written 8.1 years ago by Cheng Zhongshan400

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

ADD REPLYlink written 8.1 years ago by Brad Chapman9.4k

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 REPLYlink written 8.1 years ago by Thaman3.2k

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

ADD REPLYlink written 8.1 years ago by Thaman3.2k

Did you checked whether Perl/ BioPerl is working?

ADD REPLYlink written 8.1 years ago by Thaman3.2k

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

ADD REPLYlink written 8.1 years ago by Thaman3.2k

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

ADD REPLYlink written 8.1 years ago by Cheng Zhongshan400

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 REPLYlink written 8.1 years ago by Cheng Zhongshan400
5
gravatar for Bert Overduin
8.1 years ago by
Bert Overduin3.6k
Edinburgh Genomics, The University of Edinburgh
Bert Overduin3.6k wrote:

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 COMMENTlink written 8.1 years ago by Bert Overduin3.6k

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

ADD REPLYlink written 8.1 years ago by Bert Overduin3.6k

I dont think only that much tips will work out

ADD REPLYlink written 8.1 years ago by Thaman3.2k

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

ADD REPLYlink written 8.1 years ago by Cheng Zhongshan400
3
gravatar for Thaman
8.1 years ago by
Thaman3.2k
Finland
Thaman3.2k wrote:

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 COMMENTlink modified 8.1 years ago • written 8.1 years ago by Thaman3.2k

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 REPLYlink written 8.1 years ago by Cheng Zhongshan400

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 REPLYlink written 8.1 years ago by Cheng Zhongshan400

You are getting output while running any scripts?

ADD REPLYlink written 8.1 years ago by Thaman3.2k

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

ADD REPLYlink written 8.1 years ago by Cheng Zhongshan400

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

ADD REPLYlink written 8.1 years ago by Cheng Zhongshan400

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 REPLYlink written 8.1 years ago by Cheng Zhongshan400

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 REPLYlink written 8.1 years ago by Thaman3.2k

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 REPLYlink written 8.1 years ago by Cheng Zhongshan400
2
gravatar for Darked89
8.1 years ago by
Darked894.2k
Barcelona, Spain
Darked894.2k wrote:

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:Perlbinperl.exe

ADD COMMENTlink written 8.1 years ago by Darked894.2k
1

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 REPLYlink written 8.1 years ago by Michael Schubert6.9k

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 REPLYlink written 8.1 years ago by Cheng Zhongshan400

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

ADD REPLYlink written 8.1 years ago by Cheng Zhongshan400

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 REPLYlink written 8.1 years ago by Cheng Zhongshan400

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 REPLYlink written 8.1 years ago by Darked894.2k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1456 users visited in the last hour