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
c2cd37cd
Commit
c2cd37cd
authored
20 years ago
by
Glenn Proctor
Browse files
Options
Downloads
Patches
Plain Diff
Added name2species_id lookup.
Allowed for file extensions when guessing source ID from file name.
parent
a0e0a02e
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/BaseParser.pm
+27
-3
27 additions, 3 deletions
misc-scripts/xref_mapping/BaseParser.pm
with
27 additions
and
3 deletions
misc-scripts/xref_mapping/BaseParser.pm
+
27
−
3
View file @
c2cd37cd
...
...
@@ -21,6 +21,7 @@ my $base_dir = ".";
my
$dbi
;
my
%dependent_sources
;
my
%taxonomy2species_id
;
my
%name2species_id
;
my
%filetype2parser
=
(
"
UniProtSwissProt
"
=>
"
SwissProtParser
",
...
...
@@ -112,14 +113,14 @@ sub new {
}
# --------------------------------------------------------------------------------
# Get source ID for a particular file; matches
end of
url field
# Get source ID for a particular file; matches url field
sub get_source_id_for_filename {
my (
$self
,
$file
) =
@_
;
my
$sql
=
"
SELECT
source_id
FROM
source
WHERE
url
LIKE
'
%/" . $file . "
'"
;
#
print
$sql
.
"
\
n
"
;
my
$sql
=
"
SELECT
source_id
FROM
source
WHERE
url
LIKE
'
%/" . $file . "
%
'"
;
print
$sql
.
"
\
n
"
;
my
$sth
= dbi()->prepare(
$sql
);
$sth
->execute();
my
@row
=
$sth
->fetchrow_array();
...
...
@@ -266,6 +267,29 @@ sub taxonomy2species_id {
}
# --------------------------------------------------------------------------------
# Get & cache a hash of all the species IDs & species names.
sub
name2species_id
{
my
$self
=
shift
;
if
(
!
defined
%name2species_id
)
{
my
$dbi
=
dbi
();
my
$sth
=
$dbi
->
prepare
("
SELECT species_id, name FROM species
");
$sth
->
execute
()
||
die
$dbi
->
errstr
;
while
(
my
@row
=
$sth
->
fetchrow_array
())
{
my
$species_id
=
$row
[
0
];
my
$name
=
$row
[
1
];
$name2species_id
{
$name
}
=
$species_id
;
}
}
return
%name2species_id
;
}
# --------------------------------------------------------------------------------
# Update a row in the source table
...
...
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