Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
ensembl-gh-mirror
ensembl
Commits
31091b44
Commit
31091b44
authored
Aug 05, 2013
by
Magali Ruffier
Browse files
some more cosmetic changes
parent
33b621a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
23 deletions
+9
-23
modules/t/attributeAdaptor.t
modules/t/attributeAdaptor.t
+9
-23
No files found.
modules/t/attributeAdaptor.t
View file @
31091b44
...
...
@@ -224,21 +224,19 @@ $attrib = Bio::EnsEMBL::Attribute->new(-NAME => 'test_name2',
-
VALUE
=>
'
test_value2
');
my
$gene
=
$ga
->
fetch_by_stable_id
(
$stable_id
);
my
$gene_id
=
$gene
->
dbID
();
$aa
->
store_on_Gene
(
$gene
,
[
$attrib
]);
#
# make sure the seq_region_attrib table was updated
#
$count
=
$db
->
dbc
->
db_handle
->
selectall_arrayref
("
SELECT count(*) FROM gene_attrib
"
.
"
WHERE gene_id =
"
.
$gene
->
dbID
())
->
[
0
]
->
[
0
];
is
(
$count
,
1
,
"
One gene attrib fetched
");
is_rows
(
1
,
$db
,
"
gene_attrib
",
"
where gene_id = ?
",
[
$gene_id
]);
#
# make sure the attrib_type table was updated
#
$count
=
$db
->
dbc
->
db_handle
->
selectall_arrayref
("
SELECT count(*) FROM attrib_type
"
.
"
WHERE code = 'test_code2'
")
->
[
0
]
->
[
0
];
is
(
$count
,
1
,
"
One attrib_type available
");
is_rows
(
1
,
$db
,
"
attrib_type
",
"
where code = ?
",
["
test_code2
"]);
#
# test that we can now retrieve this attribute
...
...
@@ -266,18 +264,14 @@ is($attrib->value, 'test_value2', "Attrib value is test_value2");
# test the removal of this attribute with atrrib code
#
$aa
->
remove_from_Gene
(
$gene
,
"
junk
");
$count
=
$db
->
dbc
->
db_handle
->
selectall_arrayref
("
SELECT count(*) FROM gene_attrib
"
.
"
WHERE gene_id =
"
.
$gene
->
dbID
())
->
[
0
]
->
[
0
];
is
(
$count
,
1
,
"
One gene attrib available
");
is_rows
(
1
,
$db
,
"
gene_attrib
",
"
where gene_id = ?
",
[
$gene_id
]);
#
# test the removal of this attribute
#
$aa
->
remove_from_Gene
(
$gene
,
"
test_code2
");
$count
=
$db
->
dbc
->
db_handle
->
selectall_arrayref
("
SELECT count(*) FROM gene_attrib
"
.
"
WHERE gene_id =
"
.
$gene
->
dbID
())
->
[
0
]
->
[
0
];
is
(
$count
,
0
,
"
Gene attrib has been removed
");
is_rows
(
0
,
$db
,
"
gene_attrib
",
"
where gene_id = ?
",
[
$gene_id
]);
#
# make sure the attribute is no longer retrievable
...
...
@@ -292,18 +286,14 @@ $aa->store_on_Gene($gene, [$attrib]);
#
# make sure the seq_region_attrib table was updated
#
$count
=
$db
->
dbc
->
db_handle
->
selectall_arrayref
("
SELECT count(*) FROM gene_attrib
"
.
"
WHERE gene_id =
"
.
$gene
->
dbID
())
->
[
0
]
->
[
0
];
is
(
$count
,
1
,
"
One attrib added for gene
");
is_rows
(
1
,
$db
,
"
gene_attrib
",
"
where gene_id = ?
",
[
$gene_id
]);
#
# make sure the attrib_type table was updated
#
$count
=
$db
->
dbc
->
db_handle
->
selectall_arrayref
("
SELECT count(*) FROM attrib_type
"
.
"
WHERE code = 'test_code2'
")
->
[
0
]
->
[
0
];
is
(
$count
,
1
,
"
One attrib stored for code test_code2
");
is_rows
(
1
,
$db
,
"
attrib_type
",
"
where code = ?
",
["
test_code2
"]);
@attribs
=
@
{
$aa
->
fetch_all_by_Gene
(
$gene
)};
note
"
attribs:
"
.
scalar
(
@attribs
);
is
(
@attribs
,
1
,
"
One attrib for gene
");
@attribs
=
@
{
$aa
->
fetch_all_by_Gene
(
undef
)};
...
...
@@ -313,9 +303,7 @@ is(@attribs, 1, "One attrib for genes");
# test the removal of this attribute
#
$aa
->
remove_from_Gene
(
$gene
);
$count
=
$db
->
dbc
->
db_handle
->
selectall_arrayref
("
SELECT count(*) FROM gene_attrib
"
.
"
WHERE gene_id =
"
.
$gene
->
dbID
())
->
[
0
]
->
[
0
];
is
(
$count
,
0
,
"
Attrib has been removed from gene
");
is_rows
(
0
,
$db
,
"
gene_attrib
",
"
where gene_id = ?
",
[
$gene_id
]);
#
# test the storage of empty attrib values
...
...
@@ -330,9 +318,7 @@ is($count, 0, "Attrib has been removed from gene");
cmp_ok
(
$new_rows
,
'
>
',
$current_rows
,
'
Asserting the storage of undefined attributes will always store them
');
# now remove again
$aa
->
remove_from_Gene
(
$gene
);
$count
=
$db
->
dbc
->
db_handle
->
selectall_arrayref
("
SELECT count(*) FROM gene_attrib
"
.
"
WHERE gene_id =
"
.
$gene
->
dbID
())
->
[
0
]
->
[
0
];
is
(
$count
,
0
,
"
Attrib has been removed from gene
");
is_rows
(
0
,
$db
,
"
gene_attrib
",
"
where gene_id = ?
",
[
$gene_id
]);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment