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
6ca670c0
Commit
6ca670c0
authored
20 years ago
by
Glenn Proctor
Browse files
Options
Downloads
Patches
Plain Diff
Added (largely untested) dependent xref dumping.
parent
a2d9fe77
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/exonerate_prototype.pl
+28
-13
28 additions, 13 deletions
misc-scripts/xref_mapping/exonerate_prototype.pl
with
28 additions
and
13 deletions
misc-scripts/xref_mapping/exonerate_prototype.pl
+
28
−
13
View file @
6ca670c0
...
...
@@ -11,7 +11,7 @@ use IPC::Open3;
my
$queryfile
=
"
xref_dna.fasta
";
my
$targetfile
=
"
ensembl_transcripts.fasta
";
#
run_mapping($queryfile, $targetfile, ".");
run_mapping
(
$queryfile
,
$targetfile
,
"
.
");
store
(
$targetfile
);
sub
run_mapping
{
...
...
@@ -143,7 +143,7 @@ sub store {
my
$object_xref_id
=
$max_object_xref_id
+
1
;
# keep a (unique) list of xref IDs that need to be written out to file as well
my
%xref_ids
;
my
%
primary_
xref_ids
;
foreach
my
$file
(
glob
("
*.map
"))
{
...
...
@@ -165,7 +165,7 @@ sub store {
# TODO - evalue?
$object_xref_id
++
;
$xref_ids
{
$query_id
}
=
$query_id
;
$
primary_
xref_ids
{
$query_id
}
=
$query_id
;
# Store in database
# create entry in object_xref and get its object_xref_id
...
...
@@ -184,11 +184,11 @@ sub store {
close
(
IDENTITY_XREF
);
close
(
OBJECT_XREF
);
# write relevant xrefs to file
dump_xrefs
(
\
%xref_ids
);
print
"
Read
$total_lines
lines from
$total_files
exonerate output files
\n
";
# write relevant xrefs to file
dump_xrefs
(
\
%primary_xref_ids
);
}
...
...
@@ -321,21 +321,36 @@ sub dump_xrefs {
my
$sql
=
"
SELECT * FROM xref WHERE xref_id
$id_str
";
my
$sth
=
$xref_dbi
->
prepare
(
$sql
);
$sth
->
execute
();
my
$xref_sth
=
$xref_dbi
->
prepare
(
$sql
);
$xref_sth
->
execute
();
my
(
$xref_id
,
$accession
,
$label
,
$description
,
$source_id
,
$species_id
);
$sth
->
bind_columns
(
\
$xref_id
,
\
$accession
,
\
$label
,
\
$description
,
\
$source_id
,
\
$species_id
);
$
xref_
sth
->
bind_columns
(
\
$xref_id
,
\
$accession
,
\
$label
,
\
$description
,
\
$source_id
,
\
$species_id
);
# note the xref_id we write to the file is NOT the one we've just read
# note the xref_id we write to the file is NOT the one we've just read
# from the internal xref database as the ID may already exist in the core database
while
(
my
@row
=
$sth
->
fetchrow_array
())
{
while
(
my
@row
=
$
xref_
sth
->
fetchrow_array
())
{
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
$sql
=
"
SELECT x.accession, x.label, x.description, x.source_id FROM dependent_xref dx, xref x WHERE x.xref_id=dx.master_xref_id AND master_xref_id
$id_str
";
my
$dep_sth
=
$xref_dbi
->
prepare
(
$sql
);
$dep_sth
->
execute
();
$dep_sth
->
bind_columns
(
\
$accession
,
\
$label
,
\
$description
,
\
$source_id
);
while
(
my
@row
=
$dep_sth
->
fetchrow_array
())
{
print
XREF
"
$core_xref_id
\t
$accession
\t
$label
\t
$description
\t
DEPENDENT
\n
";
$source_ids
{
$source_id
}
=
$source_id
;
$core_xref_id
++
;
}
#print "source_ids: " . join(" ", keys(%source_ids)) . "\n";
}
# while @xref_ids
close
(
XREF
);
...
...
@@ -379,6 +394,6 @@ sub dump_xrefs {
close
(
EXTERNAL_DB
);
# TODO - dependent xrefs
}
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