BioPerl-Run

 view release on metacpan or  search on metacpan

t/SoapEU-function.t  view on Meta::CPAN

#-*-perl-*-

#testing SoapEUtilities with network queries
# idea: reproduce the examples at
# http://www.bioperl.org/wiki/HOWTO:EUtilities_Cookbook

use strict;
use warnings;
our $home;
BEGIN {
    use Bio::Root::Test;
    use lib '.';
    $home = '.'; # set to '.' for Build use,
                      # '..' for debugging from .t file
    unshift @INC, $home;
    test_begin(-tests => 119,
               -requires_modules => [qw(Bio::DB::ESoap
                                        Bio::DB::ESoap::WSDL
                                        Bio::DB::SoapEUtilities
                                        Bio::DB::SoapEUtilities::Result
                                        Bio::DB::SoapEUtilities::FetchAdaptor
                                        Bio::DB::SoapEUtilities::LinkAdaptor
                                        Bio::DB::SoapEUtilities::DocSumAdaptor
                                        SOAP::Lite
                                        XML::Twig
                                        )],
           -requires_email      => 1);
}

my $dep_msg = "NCBI SOAP EUtilities API no longer supported as of 2015, modules are deprecated and will be removed in a future release";

diag($dep_msg);

SKIP: {
    skip($dep_msg, 119);

    my $email = test_email();

    diag("Using $email for tests") if test_debug();

    my ($fac, $result, $seqio, $seq, $i);
    my @prot_ids = qw(1621261 89318838 68536103 20807972 730439);
    my @prot_ids_2 = qw(828392 790 470338);
    my @accns = qw(CAB02640 EAS10332 YP_250808 NP_623143 P41007);
    my $lg_contig = 27479347;
    my $sciname_id = 527031;
    my @gene_ids = qw(828392 790 470338);
    my $nbr_test_id = 1621261;
    my @linkout_test_ids = qw(28864546 53828898 14523048 14336674 1817575);

    SKIP : {
        test_skip(-tests => 119,
                  -requires_networking => 1);
    ok $fac = Bio::DB::SoapEUtilities->new(-verbose => test_debug), "SoapEUtilities factory";

    diag("Retrieve raw data records from GenBank, save raw data to file, then parse via Bio::SeqIO");

    ok $result = $fac->efetch(-email =>$email, -db => 'protein', -id => \@prot_ids_2 )->run(-no_parse=>1), "run efetch, no parse methods";

    ok $seqio = Bio::DB::SoapEUtilities::FetchAdaptor->new(-result=>$result), "create adaptor";
    for ($i=0; $seq = $seqio->next_seq; $i++) {
         isa_ok($seq, 'Bio::Seq::RichSeq');
         ok $seq->id, "primary_id present";
    1;}
    is $i, 3, "iterated all seq objs";



( run in 0.661 second using v1.01-cache-2.11-cpan-df04353d9ac )