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
6e2afb3c
Commit
6e2afb3c
authored
12 years ago
by
Andy Yates
Browse files
Options
Downloads
Patches
Plain Diff
allow for column configuration
parent
e40dbbdc
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
misc-scripts/import/sort_feature_table.pl
+12
-1
12 additions, 1 deletion
misc-scripts/import/sort_feature_table.pl
with
12 additions
and
1 deletion
misc-scripts/import/sort_feature_table.pl
+
12
−
1
View file @
6e2afb3c
...
...
@@ -11,6 +11,7 @@ use POSIX qw/strftime/;
my
(
$db_name
,
$db_host
,
$db_user
,
$db_pass
,
$db_port
,
$help
);
my
@tables
;
my
@columns
;
my
(
$optimise
,
$nobackup
,
$nolock
);
GetOptions
("
db_name|dbname|database=s
"
=>
\
$db_name
,
...
...
@@ -22,12 +23,17 @@ GetOptions ("db_name|dbname|database=s" => \$db_name,
'
optimise!
'
=>
\
$optimise
,
'
nolock!
'
=>
\
$nolock
,
'
nobackup!
'
=>
\
$nobackup
,
'
columns=s@
'
=>
\
@columns
,
"
h|help!
"
=>
\
$help
,
);
if
(
$help
)
{
&usage
;
exit
0
;}
unless
(
$db_name
and
$db_host
)
{
print
"
Insufficient arguments
\n
";
&usage
;
exit
1
;}
if
(
!
@columns
)
{
@columns
=
qw/seq_region_id seq_region_start seq_region_end/
;
}
sub
get_adaptor
{
my
$dba
=
Bio::EnsEMBL::DBSQL::
DBAdaptor
->
new
(
-
species
=>
'
tmp
',
...
...
@@ -67,7 +73,8 @@ sub sort_table {
}
info
("
Re-ordering table
");
$dba
->
dbc
()
->
do
("
ALTER TABLE
${table}
ORDER BY seq_region_id, seq_region_start, seq_region_end
");
my
$cols
=
join
('
,
',
@columns
);
$dba
->
dbc
()
->
do
("
ALTER TABLE
${table}
ORDER BY
$cols
");
if
(
!
$nolock
)
{
info
("
Unlocking table %s
",
$table
);
...
...
@@ -166,6 +173,10 @@ Options:
-nolock Stop the code from applying for table locks
-columns Specify the columns to sort on. Defaults to
seq_region_id, seq_region_start and seq_region_end.
Multiple parameters allowed
-help
";
}
...
...
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