Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ensembl
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
ensembl
Commits
31091b44
Commit
31091b44
authored
11 years ago
by
Magali Ruffier
Browse files
Options
Downloads
Patches
Plain Diff
some more cosmetic changes
parent
33b621a6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/t/attributeAdaptor.t
+9
-23
9 additions, 23 deletions
modules/t/attributeAdaptor.t
with
9 additions
and
23 deletions
modules/t/attributeAdaptor.t
+
9
−
23
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
]);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment