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
78b6a763
Commit
78b6a763
authored
20 years ago
by
Glenn Proctor
Browse files
Options
Downloads
Patches
Plain Diff
Various changes to integrate better with config system.
parent
aeeab642
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
misc-scripts/xref_mapping/XrefMapper/BasicMapper.pm
+17
-48
17 additions, 48 deletions
misc-scripts/xref_mapping/XrefMapper/BasicMapper.pm
with
17 additions
and
48 deletions
misc-scripts/xref_mapping/XrefMapper/BasicMapper.pm
+
17
−
48
View file @
78b6a763
...
...
@@ -655,22 +655,16 @@ sub submit_depend_job {
sub
store
{
my
(
$self
,
$target_file_name
)
=
@_
;
my
(
$self
,
$xref
,
$target_file_name
)
=
@_
;
my
$type
=
get_ensembl_object_type
(
$target_file_name
);
# get or create the appropriate analysis ID
my
$analysis_id
=
get_analysis_id
(
$type
);
# TODO - get this from config
my
$dbi
=
DBI
->
connect
("
dbi:mysql:host=ecs1g;port=3306;database=arne_core_20_34
",
"
ensadmin
",
"
ensembl
",
{'
RaiseError
'
=>
1
})
||
die
"
Can't connect to database
";
my
$analysis_id
=
$self
->
get_analysis_id
(
$type
);
# get current max object_xref_id
my
$max_object_xref_id
=
0
;
my
$sth
=
$dbi
->
prepare
("
SELECT MAX(object_xref_id) FROM object_xref
");
my
$sth
=
$
self
->
dbi
()
->
prepare
("
SELECT MAX(object_xref_id) FROM object_xref
");
$sth
->
execute
();
my
$max_object_xref_id
=
(
$sth
->
fetchrow_array
())[
0
];
if
(
!
defined
$max_object_xref_id
)
{
...
...
@@ -679,7 +673,6 @@ sub store {
print
"
Maximum existing object_xref_id =
$max_object_xref_id
\n
";
}
#my $ox_sth = $dbi->prepare("INSERT INTO object_xref(ensembl_id, ensembl_object_type, xref_id) VALUES(?,?,?)");
#my $ix_sth = $dbi->prepare("INSERT INTO identity_xref VALUES(?,?,?,?,?,?,?,?,?,?,?)");
...
...
@@ -739,7 +732,7 @@ sub store {
print
"
Read
$total_lines
lines from
$total_files
exonerate output files
\n
";
# write relevant xrefs to file
dump_xrefs
(
\
%primary_xref_ids
);
$self
->
dump_xrefs
(
$xref
,
\
%primary_xref_ids
);
}
...
...
@@ -749,23 +742,20 @@ sub get_ensembl_object_type {
my
$filename
=
shift
;
my
$type
;
if
(
$filename
=~
/gene/i
)
{
$type
=
"
Gene
";
}
elsif
(
$filename
=~
/transcript/i
)
{
if
(
$filename
=~
/_dna\./i
)
{
$type
=
"
Transcript
";
}
elsif
(
$filename
=~
/
translation
/i
)
{
}
elsif
(
$filename
=~
/
_protein\.
/i
)
{
$type
=
"
Translation
";
}
else
{
print
STDERR
"
Cannot deduce Ensembl object type from filename
$filename
";
print
STDERR
"
Cannot deduce Ensembl object type from filename
$filename
\n
";
}
print
"
###
$filename
$type
\n
";
return
$type
;
}
...
...
@@ -773,27 +763,14 @@ sub get_ensembl_object_type {
sub
get_analysis_id
{
my
$ensembl_type
=
shift
;
my
(
$self
,
$ensembl_type
)
=
@_
;
my
%typeToLogicName
=
(
'
transcript
'
=>
'
XrefExonerateDNA
',
'
translatio
n
'
=>
'
XrefExonerateProtein
'
);
my
%typeToLogicName
=
(
'
dna
'
=>
'
XrefExonerateDNA
',
'
protei
n
'
=>
'
XrefExonerateProtein
'
);
my
$logic_name
=
$typeToLogicName
{
lc
(
$ensembl_type
)};
# TODO - get these details from Config
my
$host
=
"
ecs1g
";
my
$port
=
3306
;
my
$database
=
"
arne_core_20_34
";
my
$user
=
"
ensadmin
";
my
$password
=
"
ensembl
";
my
$dbi
=
DBI
->
connect
("
dbi:mysql:host=
$host
;port=
$port
;database=
$database
",
"
$user
",
"
$password
",
{'
RaiseError
'
=>
1
})
||
die
"
Can't connect to database
";
my
$sth
=
$dbi
->
prepare
("
SELECT analysis_id FROM analysis WHERE logic_name='
"
.
$logic_name
.
"
'
");
my
$sth
=
$self
->
dbi
()
->
prepare
("
SELECT analysis_id FROM analysis WHERE logic_name='
"
.
$logic_name
.
"
'
");
$sth
->
execute
();
my
$analysis_id
;
...
...
@@ -806,7 +783,7 @@ sub get_analysis_id {
}
else
{
print
"
No analysis with logic_name
$logic_name
found, creating ...
\n
";
$sth
=
$dbi
->
prepare
("
INSERT INTO analysis (logic_name, created) VALUES ('
"
.
$logic_name
.
"
', NOW())
");
$sth
=
$
self
->
dbi
()
->
prepare
("
INSERT INTO analysis (logic_name, created) VALUES ('
"
.
$logic_name
.
"
', NOW())
");
# TODO - other fields in analysis table
$sth
->
execute
();
$analysis_id
=
$sth
->
{'
mysql_insertid
'};
...
...
@@ -821,21 +798,15 @@ sub get_analysis_id {
sub
dump_xrefs
{
my
$xref_ids_hashref
=
shift
;
my
(
$self
,
$xref
,
$xref_ids_hashref
)
=
@_
;
my
@xref_ids
=
keys
%$xref_ids_hashref
;
open
(
XREF
,
"
>xref.txt
");
# TODO - get this from config
my
$xref_dbi
=
DBI
->
connect
("
dbi:mysql:host=ecs1g;port=3306;database=glenn_test_xref
",
"
ensro
",
"",
{'
RaiseError
'
=>
1
})
||
die
"
Can't connect to database
";
my
$xref_dbi
=
$xref
->
dbi
();
my
$core_dbi
=
DBI
->
connect
("
dbi:mysql:host=ecs1g;port=3306;database=arne_core_20_34
",
"
ensro
",
"",
{'
RaiseError
'
=>
1
})
||
die
"
Can't connect to database
";
my
$core_dbi
=
$self
->
dbi
();
# get current highest internal ID from xref
my
$max_xref_id
=
0
;
...
...
@@ -885,9 +856,7 @@ sub dump_xrefs {
print
XREF
"
$core_xref_id
\t
$accession
\t
$label
\t
$description
\n
";
$source_ids
{
$source_id
}
=
$source_id
;
$core_xref_id
++
;
if
(
$source_id
==
1001
)
{
print
"
xref
$xref_id
has source_id 1001
\n
";
}
}
# Now get the dependent xrefs for each of these xrefs and write them as well
...
...
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