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
b895556d
Commit
b895556d
authored
17 years ago
by
Patrick Meidl
Browse files
Options
Downloads
Patches
Plain Diff
now prints proper history trees
parent
5008d927
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/id_mapping/utils/batch_id_history.pl
+52
-38
52 additions, 38 deletions
misc-scripts/id_mapping/utils/batch_id_history.pl
with
52 additions
and
38 deletions
misc-scripts/id_mapping/utils/batch_id_history.pl
+
52
−
38
View file @
b895556d
...
...
@@ -103,49 +103,63 @@ if ($outfile) {
while
(
my
$sid
=
<
$infh
>
)
{
# skip comments
next
if
(
/^#/
);
# skip comments
and empty lines
next
if
(
/^#/
or
/^\s?\n$/
);
chomp
(
$sid
);
print
$outfh
"
\n
$sid
\n
";
print
$outfh
"
\n
$sid
\n
\n
";
# fetch initial archive id
my
$archiveStableId
=
$aa
->
fetch_by_stable_id
(
$sid
);
if
(
$archiveStableId
)
{
my
$archive_id
=
$aa
->
fetch_by_stable_id
(
$sid
);
# get archive id history
my
$history
=
$aa
->
fetch_archive_id_history
(
$archiveStableId
);
# group archive ids by release
my
$release
;
foreach
my
$arch_id
(
@$history
)
{
push
@
{
$release
->
{
$arch_id
->
release
}
},
$arch_id
;
}
# loop over releases and print results
foreach
my
$r
(
sort
{
$a
<=>
$b
}
keys
%$release
)
{
print
$outfh
"
\n
Release
$r
(
"
.
$release
->
{
$r
}
->
[
0
]
->
assembly
.
"
,
"
.
$release
->
{
$r
}
->
[
0
]
->
db_name
.
"
)
\n
";
# loop over archive ids
foreach
my
$a
(
@
{
$release
->
{
$r
}
})
{
print
$outfh
"
"
.
$a
->
stable_id
.
"
.
"
.
$a
->
version
.
"
\n
";
# print peptide sequence
if
(
$pep_seq
)
{
foreach
my
$pep
(
@
{
$a
->
get_all_translation_archive_ids
})
{
print
$outfh
"
Peptide
"
.
$pep
->
stable_id
.
"
>
"
.
$pep
->
get_peptide
.
"
\n
";
}
}
}
}
unless
(
$archive_id
)
{
print
$outfh
"
Not found in database.
\n
";
next
;
}
my
$history
=
$archive_id
->
get_history_tree
;
next
unless
$history
;
if
(
$history
->
is_incomplete
)
{
print
$outfh
"
NOTE: History tree is incomplete.
\n\n
";
}
my
$matrix
=
[]
;
# get unique stable IDs (regardless of version)
my
@unique_ids
=
@
{
$history
->
get_unique_stable_ids
};
my
$i
=
0
;
foreach
my
$id
(
@unique_ids
)
{
$matrix
->
[
$i
++
]
->
[
0
]
=
$id
;
}
# get all releases for which we have nodes in this graph
my
@releases
=
@
{
$history
->
get_release_display_names
};
my
$j
=
1
;
foreach
my
$release
(
@releases
)
{
$matrix
->
[
scalar
(
@unique_ids
)]
->
[
$j
++
]
=
$release
;
}
# print a "graphical" representation of the tree
my
$fmt
=
"
%-20s
"
.
("
%-6s
"
x
scalar
(
@releases
))
.
"
\n
";
foreach
my
$a_id
(
@
{
$history
->
get_all_ArchiveStableIds
})
{
my
(
$x
,
$y
)
=
@
{
$history
->
coords_by_ArchiveStableId
(
$a_id
)
};
$matrix
->
[
$y
]
->
[
$x
+
1
]
=
$a_id
->
version
;
}
for
(
my
$i
=
0
;
$i
<
@$matrix
;
$i
++
)
{
print
$outfh
sprintf
(
$fmt
,
@
{
$matrix
->
[
$i
]
});
}
# current versions in history
print
$outfh
"
\n
Current stable IDs in this tree:
\n
";
my
@current
=
@
{
$history
->
get_all_current_ArchiveStableIds
};
if
(
@current
)
{
map
{
print
$outfh
"
"
.
$_
->
stable_id
.
"
.
"
.
$_
->
version
.
"
\n
"
}
@current
;
}
else
{
print
$outfh
"
Not found in archive.
\n
\n
";
print
$outfh
"
none
\n
";
}
}
...
...
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