Skip to content

Commit

Permalink
Fixed some undefined warnings in SeqIO::embl
Browse files Browse the repository at this point in the history
  • Loading branch information
fangly committed Feb 28, 2012
1 parent 2bc6058 commit 65261c6
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 38 deletions.
28 changes: 14 additions & 14 deletions Bio/SeqIO/embl.pm
Expand Up @@ -215,26 +215,26 @@ sub next_seq {
# ID DQ299383; SV 1; linear; mRNA; STD; MAM; 431 BP.
# This regexp comes from the new2old.pl conversion script, from EBI
if ($line =~ m/^ID (\w+);\s+SV (\d+); (\w+); ([^;]+); (\w{3}); (\w{3}); (\d+) BP./) {
($name, $sv, $topology, $mol, $div) = ($1, $2, $3, $4, $6);
($name, $sv, $topology, $mol, $div) = ($1, $2, $3, $4, $6);
}
if (defined($sv)) {
$params{'-seq_version'} = $sv;
$params{'-version'} = $sv;
if (defined $sv) {
$params{'-seq_version'} = $sv;
$params{'-version'} = $sv;
}

if ($topology eq "circular") {
$params{'-is_circular'} = 1;
if (defined $topology && $topology eq 'circular') {
$params{'-is_circular'} = 1;
}

if (defined $mol ) {
if ($mol =~ /DNA/) {
$alphabet='dna';
} elsif ($mol =~ /RNA/) {
$alphabet='rna';
} elsif ($mol =~ /AA/) {
$alphabet='protein';
if (defined $mol ) {
if ($mol =~ /DNA/) {
$alphabet = 'dna';
} elsif ($mol =~ /RNA/) {
$alphabet = 'rna';
} elsif ($mol =~ /AA/) {
$alphabet = 'protein';
}
}
}
} else {

# Old style header (EMBL Release < 87, before June 2006)
Expand Down
48 changes: 24 additions & 24 deletions t/SeqIO/embl.t
Expand Up @@ -4,20 +4,20 @@
use strict;

BEGIN {
use lib '.';
use lib '../..';
use Bio::Root::Test;
test_begin(-tests => 96);
use lib '.';
use lib '../..';
use Bio::Root::Test;

test_begin(-tests => 96);

use_ok('Bio::SeqIO::embl');
}

my $verbose = test_debug();

my $ast = Bio::SeqIO->new( -format => 'embl',
-verbose => $verbose,
-file => test_input_file('roa1.dat'));
-verbose => $verbose,
-file => test_input_file('roa1.dat'));
$ast->verbose($verbose);
my $as = $ast->next_seq();
ok defined $as->seq;
Expand All @@ -35,8 +35,8 @@ is($as->species->binomial(), 'Homo sapiens');
# EMBL Release 87 changes (8-17-06)

$ast = Bio::SeqIO->new( -format => 'embl',
-verbose => $verbose,
-file => test_input_file('roa1_v2.dat'));
-verbose => $verbose,
-file => test_input_file('roa1_v2.dat'));
$ast->verbose($verbose);
$as = $ast->next_seq();
ok defined $as->seq;
Expand All @@ -54,7 +54,7 @@ is($as->length, 1198);
is($as->species->binomial(), 'Homo sapiens');

my $ent = Bio::SeqIO->new( -file => test_input_file('test.embl'),
-format => 'embl');
-format => 'embl');
my $seq = $ent->next_seq();

is(defined $seq->seq(), 1,
Expand All @@ -63,27 +63,27 @@ is(scalar $seq->annotation->get_Annotations('reference'), 3);

my $out_file = test_output_file();
my $out = Bio::SeqIO->new(-file=> ">$out_file",
-format => 'embl');
-format => 'embl');
is($out->write_seq($seq),1,
'success writing Embl format with ^ < and > locations');

# embl with no FT
$ent = Bio::SeqIO->new( -file => test_input_file('test.embl'),
-format => 'embl');
-format => 'embl');
$seq = $ent->next_seq();

ok($seq);
is(lc($seq->subseq(1,10)),'gatcagtaga');
is($seq->length, 4870);

# embl with no FH
my $noFH = Bio::SeqIO->new(-file => test_input_file('no_FH.embl'),
-format => 'embl');
my $noFH = Bio::SeqIO->new( -file => test_input_file('no_FH.embl'),
-format => 'embl');
is(scalar($noFH->next_seq->get_SeqFeatures), 4);

# bug 1571
$ent = Bio::SeqIO->new(-format => 'embl',
-file => test_input_file('test.embl2sq'));
$ent = Bio::SeqIO->new( -format => 'embl',
-file => test_input_file('test.embl2sq'));
is($ent->next_seq->length,4877);

# embl repbase
Expand All @@ -92,8 +92,8 @@ $seq = $ent->next_seq;
is($seq->display_id,'BEL16-LTR_AG');

# test secondary accessions in EMBL (bug #1332)
my $seqio = Bio::SeqIO->new(-format => 'embl',
-file => test_input_file('ECAPAH02.embl'));
my $seqio = Bio::SeqIO->new( -format => 'embl',
-file => test_input_file('ECAPAH02.embl'));
$seq = $seqio->next_seq;
is($seq->accession_number, 'D10483');
is($seq->seq_version, 2);
Expand All @@ -104,8 +104,8 @@ is($accs[-1], 'X56742');
### TPA TESTS - Thanks to Richard Adams ###
# test Third Party Annotation entries in EMBL/Gb format
# to ensure compatability with parsers.
my $str = Bio::SeqIO->new(-format =>'embl',
-file => test_input_file('BN000066-tpa.embl'));
my $str = Bio::SeqIO->new( -format =>'embl',
-file => test_input_file('BN000066-tpa.embl'));
$seq = $str->next_seq;
ok(defined $seq);
is($seq->accession_number, 'BN000066');
Expand Down Expand Up @@ -163,7 +163,7 @@ ok($embl->write_seq($primaryseq));
# this should generate a warning
my $scalar = "test";
eval {
$embl->write_seq($scalar);
$embl->write_seq($scalar);
};
ok ($@);

Expand Down Expand Up @@ -192,8 +192,8 @@ is($cds_dblink->primary_id, '9606', 'CDS - OX primary_id');

#bug 2982 - parsing contig descriptions sans sequence data

ok( $embl = Bio::SeqIO->new(-file => test_input_file('bug2982.embl'),
-format => 'embl') );
ok( $embl = Bio::SeqIO->new( -file => test_input_file('bug2982.embl'),
-format => 'embl') );
my $i;
for ($i=0; my $seq = $embl->next_seq; $i++) {
ok !$seq->seq;
Expand Down

0 comments on commit 65261c6

Please sign in to comment.