diff --git a/bin/generate-names.pl b/bin/generate-names.pl index d402b89484..ebd34ba49c 100755 --- a/bin/generate-names.pl +++ b/bin/generate-names.pl @@ -19,6 +19,11 @@ =head1 OPTIONS Data directory to process. Default 'data/'. +=item --tracks [,...] + +Comma-separated list of which tracks to include in the names index. If +not passed, all tracks are indexed. + =item --thresh Optional LazyPatricia chunking threshold. Default 200. See @@ -59,6 +64,7 @@ =head1 OPTIONS $Data::Dumper::Indent = 1; my %trackHash; +my @includedTrackNames; my @tracksWithNames; my $outDir = "data"; @@ -68,8 +74,11 @@ =head1 OPTIONS GetOptions("dir|out=s" => \$outDir, "thresh=i" => \$thresh, "verbose+" => \$verbose, + 'tracks=s' => \@includedTrackNames, "help|h|?" => \$help) or pod2usage(); +my %includedTrackNames = map { $_ => 1 } @includedTrackNames; + pod2usage( -verbose => 2 ) if $help; unless (-d $outDir) { @@ -86,7 +95,8 @@ =head1 OPTIONS mkdir($nameDir) unless (-d $nameDir); my @refSeqs = @{ $gdb->refSeqs }; -my @tracks = @{ $gdb->trackList }; +my @tracks = grep { !%includedTrackNames || $includedTrackNames{ $_->{label} } } + @{ $gdb->trackList }; # open the root file; we lock this file while we're # reading the name lists, deleting all the old lazy-* diff --git a/release-notes.txt b/release-notes.txt index 18671a7496..cd025dd4f3 100644 --- a/release-notes.txt +++ b/release-notes.txt @@ -1,5 +1,11 @@ {{$NEXT}} + * Added a `--tracks` option to `generate-names.pl` that allows users + to manually specify which tracks will be indexed to enable + autocompletion and searching for their feature names in the JBrowse + location box. Thanks to Steffi Geisen for her ongoing help in + enhancing the scalability of name indexing. + * Fixed off-by-one error in Wiggle track display code: wiggle data was incorrectly displayed shifted one base to the left of its proper position. Thanks to Steffi Geisen for noticing this. diff --git a/tests/perl_tests/generate-names.pl.t b/tests/perl_tests/generate-names.pl.t index 64dd36a9c0..54680b8a89 100644 --- a/tests/perl_tests/generate-names.pl.t +++ b/tests/perl_tests/generate-names.pl.t @@ -16,4 +16,11 @@ system $^X, 'bin/generate-names.pl', ( ); ok( ! $?, 'generate-names.pl also ran ok on volvox test data' ); + +system $^X, 'bin/generate-names.pl', ( + '--out' => "$tempdir", + '--tracks' => 'ExampleFeatures,NameTest' + ); +ok( ! $?, 'generate-names.pl also ran ok with the --tracks option' ); + done_testing;