Skip to content

Commit

Permalink
Remove some print commands
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Mar 4, 2020
1 parent b38dd21 commit 7778cca
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 45 deletions.
3 changes: 0 additions & 3 deletions src/perl5/Bio/JBrowse/Cmd/IndexNames.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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 ();
Expand Down Expand Up @@ -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 ) {
Expand Down Expand Up @@ -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 );
}
Expand Down
85 changes: 43 additions & 42 deletions src/perl5/Bio/JBrowse/FeatureStream/Genbank.pm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use strict;
use warnings;

use base 'Bio::JBrowse::FeatureStream';
use Data::Dumper;

use Bio::JBrowse::FeatureStream::Genbank::LocationParser;

Expand All @@ -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;
Expand All @@ -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;
}
Expand All @@ -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;
Expand Down

0 comments on commit 7778cca

Please sign in to comment.