diff --git a/src/perl5/Bio/JBrowse/Cmd/IndexNames.pm b/src/perl5/Bio/JBrowse/Cmd/IndexNames.pm index d0f7be3067..0296ec882f 100644 --- a/src/perl5/Bio/JBrowse/Cmd/IndexNames.pm +++ b/src/perl5/Bio/JBrowse/Cmd/IndexNames.pm @@ -18,7 +18,6 @@ use Storable (); use File::Path (); use File::Temp (); use List::Util (); -use Data::Dumper; use Encode qw(decode encode); use GenomeDB (); @@ -80,7 +79,6 @@ sub run { unless( @$refSeqs ) { die "No reference sequences defined in configuration, nothing to do.\n"; } - print Dumper($gdb->trackList); my @tracks = grep $self->track_is_included( $_->{label} ), @{ $gdb->trackList || [] }; unless( @tracks ) { @@ -367,7 +365,6 @@ sub find_names_files { # read either names.txt or names.json files my $name_records_iterator; my $names_txt = File::Spec->catfile( $dir, 'names.txt' ); - print "$names_txt\n"; if( -e decode('UTF-8',$names_txt) ) { push @files, $self->make_file_record( $track, $names_txt ); } diff --git a/src/perl5/Bio/JBrowse/FeatureStream/Genbank.pm b/src/perl5/Bio/JBrowse/FeatureStream/Genbank.pm index 1e0b77d078..0fbe3552af 100644 --- a/src/perl5/Bio/JBrowse/FeatureStream/Genbank.pm +++ b/src/perl5/Bio/JBrowse/FeatureStream/Genbank.pm @@ -10,7 +10,6 @@ use strict; use warnings; use base 'Bio::JBrowse::FeatureStream'; -use Data::Dumper; use Bio::JBrowse::FeatureStream::Genbank::LocationParser; @@ -32,12 +31,11 @@ sub _aggregate_features_from_gbk_record { # get index of top level feature ('mRNA' at current writing) my $indexTopLevel; my $count = 0; - print Dumper $record; foreach my $feat ( @{$record->{FEATURES}} ){ - if ( _isTopLevel( $feat ) ){ - $indexTopLevel = $count; - } - $count++; + if ( _isTopLevel( $feat ) ){ + $indexTopLevel = $count; + } + $count++; } return unless defined $indexTopLevel; @@ -56,52 +54,55 @@ sub _aggregate_features_from_gbk_record { delete $f->{SEQUENCE}; $f->{end} = $locations[-1]{end}; - $f->{type} = $record->{FEATURES}[$indexTopLevel]{name}; - $f->{seq_id} ||= $seq_id; - - %$f = ( %{$record->{FEATURES}[$indexTopLevel]{feature} || {}}, %$f ); # get other attrs - if( $f->{type} eq 'gene' ) { - print "here2\n"; - $f->{name} = $record->{FEATURES}[$indexTopLevel]{feature}{gene}; - $f->{description} = $record->{FEATURES}[$indexTopLevel]{feature}{product} || $f->{FEATURES}[$indexTopLevel]{feature}{note}; - } + #for my $f ( @features ) { + $f->{start} += $offset + 1; + $f->{end} += $offset; + $f->{strand} = 1 unless defined $f->{strand}; + $f->{type} = $record->{FEATURES}[$indexTopLevel]{name}; + $f->{seq_id} ||= $seq_id; + + %$f = ( %{$record->{FEATURES}[$indexTopLevel]{feature} || {}}, %$f ); # get other attrs + if( $f->{type} eq 'mRNA' ) { + $f->{name} = $record->{FEATURES}[$indexTopLevel]{feature}{gene}; + $f->{description} = $record->{FEATURES}[$indexTopLevel]{feature}{product} || $f->{FEATURES}[$indexTopLevel]{feature}{note}; + } - # convert FEATURES to subfeatures - $f->{subfeatures} = []; - if ( scalar( @{$record->{FEATURES} || [] }) > $indexTopLevel ) { - for my $i ( $indexTopLevel + 1 .. $#{$record->{FEATURES}} ) { - my $feature = $record->{FEATURES}[$i]; - my @sublocations = _parseLocation( $feature->{location} ); - for my $subloc ( @sublocations ) { - $subloc->{start} += $offset + 1; - $subloc->{end} += $offset; - - my $newFeature = { - %{ $feature->{feature}||{} }, - %$subloc, - type => $feature->{name} - }; - - $newFeature->{seq_id} ||= $seq_id; - - push @{$f->{subfeatures}}, $newFeature; + # convert FEATURES to subfeatures + $f->{subfeatures} = []; + if ( scalar( @{$record->{FEATURES} || [] }) > $indexTopLevel ) { + for my $i ( $indexTopLevel + 1 .. $#{$record->{FEATURES}} ) { + my $feature = $record->{FEATURES}[$i]; + my @sublocations = _parseLocation( $feature->{location} ); + for my $subloc ( @sublocations ) { + $subloc->{start} += $offset + 1; + $subloc->{end} += $offset; + + my $newFeature = { + %{ $feature->{feature}||{} }, + %$subloc, + type => $feature->{name} + }; + + $newFeature->{seq_id} ||= $seq_id; + + push @{$f->{subfeatures}}, $newFeature; + } } } - } +# } return $f; } sub _isTopLevel { my $feat = shift; - my @topLevelFeatures = qw( gene ); # add more as needed? + my @topLevelFeatures = qw( mRNA ); # add more as needed? my $isTopLevel = 0; foreach my $thisTopFeat ( @topLevelFeatures ){ - if ( $feat->{'name'} =~ m/$thisTopFeat/ ){ - print "here\n"; - $isTopLevel = 1; - last; - } + if ( $feat->{'name'} =~ m/$thisTopFeat/ ){ + $isTopLevel = 1; + last; + } } return $isTopLevel; } @@ -114,7 +115,7 @@ sub _getRegionOffset { my $f = shift; my $offset = 0; - if ( grep {$_ =~ /REGION\:/} @{$f->{'VERSION'}} ){ # this is a region file + if ( grep {$_ =~ /REGION\:/} @{$f->{'VERSION'}} ){ # this is a region file # get array item after REGION token my $count = 0; my $regionIndexInArray;