From 7efa497c0ebb7a939b916d70f99e280c55071ef7 Mon Sep 17 00:00:00 2001 From: Robert Buels Date: Mon, 21 Jan 2013 11:09:40 -0500 Subject: [PATCH] move ExternalSorter perl module into Bio::JBrowse namespace --- bin/ucsc-to-json.pl | 4 ++-- src/perl5/Bio/JBrowse/Cmd/NCFormatter.pm | 6 +++--- src/perl5/{ => Bio/JBrowse}/ExternalSorter.pm | 8 ++++---- src/perl5/Bio/JBrowse/HashStore.pm | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) rename src/perl5/{ => Bio/JBrowse}/ExternalSorter.pm (94%) diff --git a/bin/ucsc-to-json.pl b/bin/ucsc-to-json.pl index be78d075cb..89ecae52fa 100755 --- a/bin/ucsc-to-json.pl +++ b/bin/ucsc-to-json.pl @@ -115,7 +115,7 @@ =head1 EXAMPLE use JSON 2; use GenomeDB; use NameHandler; -use ExternalSorter; +use Bio::JBrowse::ExternalSorter; my $trackdb = "trackDb"; my ($indir, $tracks, $arrowheadClass, $subfeatureClasses, $clientConfig, $db, @@ -274,7 +274,7 @@ =head1 EXAMPLE }; my %chromCounts; - my $sorter = ExternalSorter->new($compare, $sortMem); + my $sorter = Bio::JBrowse::ExternalSorter->new($compare, $sortMem); for_columns("$indir/" . $trackMeta->{tableName}, sub { $chromCounts{$_[0]->[$chromCol]} += 1; diff --git a/src/perl5/Bio/JBrowse/Cmd/NCFormatter.pm b/src/perl5/Bio/JBrowse/Cmd/NCFormatter.pm index 42e33eba82..7cf33ce8b5 100644 --- a/src/perl5/Bio/JBrowse/Cmd/NCFormatter.pm +++ b/src/perl5/Bio/JBrowse/Cmd/NCFormatter.pm @@ -3,7 +3,7 @@ package Bio::JBrowse::Cmd::NCFormatter; use base 'Bio::JBrowse::Cmd'; use GenomeDB; -use ExternalSorter; +use Bio::JBrowse::ExternalSorter; sub _format { my ( $self, %args ) = @_; @@ -13,9 +13,9 @@ sub _format { my $types = $self->opt('type'); @$types = split /,/, join ',', @$types; - # The ExternalSorter will get flattened [chrom, [start, end, ...]] + # The Bio::JBrowse::ExternalSorter will get flattened [chrom, [start, end, ...]] # arrays from the feature_stream - my $sorter = ExternalSorter->new( + my $sorter = Bio::JBrowse::ExternalSorter->new( do { my $startIndex = $feature_stream->startIndex; my $endIndex = $feature_stream->endIndex; diff --git a/src/perl5/ExternalSorter.pm b/src/perl5/Bio/JBrowse/ExternalSorter.pm similarity index 94% rename from src/perl5/ExternalSorter.pm rename to src/perl5/Bio/JBrowse/ExternalSorter.pm index f16925dd93..8b710ed113 100644 --- a/src/perl5/ExternalSorter.pm +++ b/src/perl5/Bio/JBrowse/ExternalSorter.pm @@ -1,11 +1,11 @@ =head1 NAME -ExternalSorter - efficiently sort arrayrefs with a given comparison function +Bio::JBrowse::ExternalSorter - efficiently sort arrayrefs with a given comparison function =head1 SYNOPSIS # make a new sorter that sorts by column 4, then column 3 - my $sorter = ExternalSorter->new( + my $sorter = Bio::JBrowse::ExternalSorter->new( sub ($$) { $_[0]->[4] <=> $_[1]->[4] || @@ -29,7 +29,7 @@ ExternalSorter - efficiently sort arrayrefs with a given comparison function =cut -package ExternalSorter; +package Bio::JBrowse::ExternalSorter; use strict; use warnings; @@ -128,7 +128,7 @@ sub flush { # each segment must have at least one element return if ($#sorted < 0); - croak "ExternalSorter is already finished" + croak "Bio::JBrowse::ExternalSorter is already finished" if $self->{finished}; my $fh = File::Temp->new( $self->{tmpDir} ? (DIR => $self->{tmpDir}) : (), diff --git a/src/perl5/Bio/JBrowse/HashStore.pm b/src/perl5/Bio/JBrowse/HashStore.pm index 7cd3914b6e..f4632b97ff 100644 --- a/src/perl5/Bio/JBrowse/HashStore.pm +++ b/src/perl5/Bio/JBrowse/HashStore.pm @@ -36,7 +36,7 @@ use File::Path (); use Cache::Ref::FIFO (); -use ExternalSorter; +use Bio::JBrowse::ExternalSorter; my $bucket_class = 'Bio::JBrowse::HashStore::Bucket'; @@ -137,7 +137,7 @@ reading them back in sorted order. sub sort_stream { my ( $self, $in_stream ) = @_; - my $sorter = ExternalSorter->new( + my $sorter = Bio::JBrowse::ExternalSorter->new( sub ($$) { $_[0]->[0] cmp $_[1]->[0] }, 32_000_000 );