Bio-MAGETAB
view release on metacpan or search on metacpan
t/004_magetab.t view on Meta::CPAN
# Bio::MAGETAB::BaseClass (should really do them all, FIXME?).
my $db1;
lives_ok( sub{ $db1 = Bio::MAGETAB::DatabaseEntry->new( accession => 1234 ) },
'knows how to create a DatabaseEntry object' );
ok( $db1->isa('Bio::MAGETAB::DatabaseEntry'), 'of the correct class' );
# Confirm that there's no container set for this instance.
ok( ! defined $db1->get_ClassContainer(), 'and with no container object set' );
# Create our MAGETAB container object.
dies_ok( sub{ Bio::MAGETAB->new( not_a_real_attribute => 1 ) },
'object instantiation with unrecognised attribute fails' );
my $obj;
lives_ok( sub{ $obj = Bio::MAGETAB->new() }, 'can create a MAGETAB object' );
ok( $obj->isa('Bio::MAGETAB'), 'of the correct class' );
ok( ! $obj->has_databaseEntries(), 'with no associated DatabaseEntry objects' );
# Evaluated in scalar context, this gives zero for an empty array..
is( $obj->get_databaseEntries(), 0, 'and get_databaseEntries agrees' );
# Now create a new object that will associate with this container automatically.
t/013_sdrf.t view on Meta::CPAN
$sdrf = test_parse( $sdrf_reader );
my $assay = $sdrf_reader->get_builder()->get_assay({ name => 'Assay 1' });
my $ad = $assay->get_arrayDesign();
is( $ad->get_name(), 'Design 1', 'Assay Array Design correctly linked' );
is( join(";", map { $_->get_value } $ad->get_comments()), 'Comment 1',
'Array Design commented correctly');
__DATA__
Source Name Provider Characteristics[ OrganismPart ] Characteristics[DiseaseState] Term Source REF:test namespace Term Accession Number Material Type Description Comment[MyNVT] Sample Name Characteristics[Age] Unit[TimeUnit] Term Source REF Material ...
my source the guy in the next room root hemophilia NCI META CL:111111 organism_part description_text mycomment my sample 6 hours MO cell sample comment value EXTPRTCL10654 the guy in the next room total RNA 2007-02-21 This did not happen. I was not h...
my source the guy in the next room root hemophilia NCI META CL:111111 organism_part description_text mycomment my sample 6 hours MO cell sample comment value EXTPRTCL10654 the guy in the next room total RNA 2007-02-21 This did not happen. I was not h...
sparse source 1 normal blah blah ignore me EXTPRTCL10654 polyA RNA sparse LE Cy5 Cy5 P-XMPL-11 ArrayExpress sparse hyb A-TEST-1 sparse scan1 testing.jpg Data3.txt TRANPRTCL10656 norm 3 NormData3.txt pained expression 10 mM...
sparse source 2 normal EXTPRTCL10654 polyA RNA sparse LE Cy3 Cy3 P-XMPL-11 ArrayExpress sparse hyb A-TEST-1 sparse scan2 Data4.txt TRANPRTCL10656 norm 3 NormData3.txt pregnant pause
sparse source 3 normal EXTPRTCL10654 polyA RNA sparse LE biotin biotin P-XMPL-11 ArrayExpress sparse hyb b A-TEST-1 scanning protocol sparse scan3 imagefile2.TIFF a bit blurry TRANPRTCL10656 norm 4 NormData4.txt preternatura...
t/015_dbloader.t view on Meta::CPAN
'TermSource created' );
ok( UNIVERSAL::isa( $ts, 'Bio::MAGETAB::TermSource' ), 'of the correct class' );
}
my $oid;
{
my $ts;
lives_ok( sub { $ts = $loader->get_term_source({ name => 'test_term_source' }) },
'TermSource retrieved' );
ok( UNIVERSAL::isa( $ts, 'Bio::MAGETAB::TermSource' ), 'of the correct class' );
dies_ok( sub { $ts = $loader->get_term_source({ name => 'not_the_correct_name' }) },
'non-existent TermSource is not retrieved' );
$oid = $loader->id( $ts );
}
{
my $ts;
lives_ok( sub { $ts = $loader->find_or_create_term_source({ name => 'test_term_source',
version => 0.9 }) },
'old TermSource find_or_created' );
ok( UNIVERSAL::isa( $ts, 'Bio::MAGETAB::TermSource' ), 'of the correct class' );
t/testlib/CommonTests.pm view on Meta::CPAN
lives_ok( sub { $obj = instantiate( $class, $required ) },
"instantiation with all required args succeeds" );
# Check predicate method behaviour - before opt attr setting.
while ( my ( $key, $value ) = each %{ $optional } ) {
my $predicate = "has_$key";
ok( ! $obj->$predicate, qq{and optional "$key" attribute predicate method agrees} );
}
# Required attributes with an unrecognised impostor; should fail.
my %with_unrecognised = ( 'this_is_not_a_recognised_attribute' => 1, %{ $required } );
dies_ok( sub { $obj = instantiate( $class, \%with_unrecognised ) },
"instantiation with an unrecognised arg fails" );
# Construct a full instance as our return value.
my $all = { %{ $optional }, %{ $required } };
lives_ok( sub { $obj = instantiate( $class, $all ) },
"instantiation with all required and optional args succeeds" );
# Check our fully-constructed object.
ok( defined $obj, 'and returns an object' );
( run in 0.673 second using v1.01-cache-2.11-cpan-0a987023a57 )