Skip to content

Commit

Permalink
add --noSubfeature option to flatfile-to-json.pl
Browse files Browse the repository at this point in the history
  • Loading branch information
rbuels committed Jul 24, 2013
1 parent bbb82b6 commit 5a71902
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 30 deletions.
25 changes: 5 additions & 20 deletions bin/flatfile-to-json.pl
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,9 @@ =head1 USAGE
[ --out <output directory> ] \
[ --key <human-readable track name> ] \
[ --className <CSS class name for displaying features> ] \
[ --getType ] \
[ --getPhase ] \
[ --getSubfeatures ] \
[ --getLabel ] \
[ --urltemplate "http://example.com/idlookup?id={id}" ] \
[ --arrowheadClass <CSS class> ] \
[ --noSubfeatures ] \
[ --subfeatureClasses '{ JSON-format subfeature class map }' ] \
[ --clientConfig '{ JSON-format extra configuration for this track }' ] \
[ --thinType <BAM -thin_type> ] \
Expand Down Expand Up @@ -77,26 +74,14 @@ =head2 Optional
CSS class for features. Defaults to "feature".
=item --getType
Include the type of the features in the JSON.
=item --getPhase
Include the phase of the features in the JSON.
=item --getSubfeatures
Include subfeatures in the JSON.
=item --getLabel
Include a label for the features in the JSON.
=item --urltemplate "http://example.com/idlookup?id={id}"
Template for a URL to be visited when features are clicked on.
=item --noSubfeatures
Do not format subfeature data.
=item --arrowheadClass <CSS class>
CSS class for arrowheads.
Expand Down
4 changes: 4 additions & 0 deletions release-notes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
run like:
bin/prepare-refseqs.pl --sizes myrefs.sizes

* Added a '--noSubfeatures' option for flatfile-to-json.pl to skip
importing subfeatures (since `--getSubfeatures` is on by default
for some time).

* The "JBrowse" link on the left side of the menu bar, and the
browser title, now display the "About this browser" title instead
of JBrowse, if `aboutThisBrowser` is set in the configuration.
Expand Down
6 changes: 3 additions & 3 deletions src/perl5/Bio/JBrowse/Cmd/FlatFileToJson.pm
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ sub option_definitions {
"getType",
"getPhase",
"getSubs|getSubfeatures",
"noSubfeatures",
"getLabel",
"urltemplate=s",
"menuTemplate=s",
Expand Down Expand Up @@ -83,9 +84,6 @@ sub run {


my %config = (
type => $self->opt('getType') || $self->opt('type') ? 1 : 0,
phase => $self->opt('getPhase'),
subfeatures => $self->opt('getSubs'),
style => {
%{ $self->opt('clientConfig') || {} },
className => $self->opt('cssClass'),
Expand Down Expand Up @@ -127,6 +125,7 @@ sub make_gff_stream {

return Bio::JBrowse::FeatureStream::GFF3_LowLevel->new(
parser => $p,
no_subfeatures => $self->opt('noSubfeatures'),
track_label => $self->opt('trackLabel')
);
}
Expand All @@ -145,6 +144,7 @@ sub make_bed_stream {
);

return Bio::JBrowse::FeatureStream::BioPerl->new(
no_subfeatures => $self->opt('noSubfeatures'),
stream => sub { $io->next_feature },
track_label => $self->opt('trackLabel'),
);
Expand Down
17 changes: 10 additions & 7 deletions src/perl5/Bio/JBrowse/FeatureStream.pm
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,18 @@ sub flatten_to_feature {
@{$f}{ @{$class->{fields}} }
);

for my $subfeature_field (qw( subfeatures derived_features )) {
if( my $sfi = $class->{field_idx}{ $subfeature_field } ) {
$f[ $sfi+1 ] = [
map {
$self->flatten_to_feature($_)
} @{$f[$sfi+1]}
];
unless( $self->{no_subfeatures} ) {
for my $subfeature_field (qw( subfeatures derived_features )) {
if ( my $sfi = $class->{field_idx}{ $subfeature_field } ) {
$f[ $sfi+1 ] = [
map {
$self->flatten_to_feature($_)
} @{$f[$sfi+1]}
];
}
}
}

# use Data::Dump 'dump';
# print dump($_)."\n" for \@f, $class;

Expand Down

0 comments on commit 5a71902

Please sign in to comment.