Skip to content

Commit

Permalink
Remove trailing whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonPetrov committed Jun 30, 2017
1 parent f8fc6a3 commit 7f9dc64
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 37 deletions.
67 changes: 33 additions & 34 deletions RfamWeb/lib/RfamWeb/Controller/Family.pm
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Extracts values from the parameters. Accepts "acc", "id" and "entry", in lieu
of having them as path components.
We're using C<auto> to do all of this, rather than C<begin>, because of problems
with adding method modifiers when the C<begin> method has the C<Deserialize>
with adding method modifiers when the C<begin> method has the C<Deserialize>
action class added, e.g. C<sub begin : ActionClass('Deserialize') { }>. Ideally
we'd just do this stuff in an C<after> method, but it seems that method modifiers
just don't work when the C<Deserialize> C<ActionClass> is applied..
Expand All @@ -80,13 +80,13 @@ just don't work when the C<Deserialize> C<ActionClass> is applied..

sub auto : Private {
my ( $this, $c ) = @_;

# get a handle on the entry, if supplied as params, and detaint it
my $tainted_entry = $c->req->param('acc') ||
$c->req->param('id') ||
$c->req->param('entry') ||
'';

if ( $tainted_entry ) {
$c->log->debug( 'Family::begin: got a tainted entry' )
if $c->debug;
Expand Down Expand Up @@ -116,12 +116,12 @@ sub auto : Private {
The L<Section> base class sets the C<end> action to use the L<RenderView>
C<ActionClass>, but that screws up the RESTful serialisation. Reset C<end> here
to use a serialiser to render the output, and rely on the mapping between
to use a serialiser to render the output, and rely on the mapping between
MIME type and serialiser to do the right thing.
=cut

sub end : ActionClass( 'Serialize' ) { }
sub end : ActionClass( 'Serialize' ) { }

#-------------------------------------------------------------------------------

Expand All @@ -141,14 +141,14 @@ sub family : Chained( '/' )
my $tainted_entry = $c->stash->{param_entry} ||
$entry_arg ||
'';

$c->log->debug( "Family::family: tainted_entry: |$tainted_entry|" )
if $c->debug;

my $entry;
if ( $tainted_entry ) {
( $entry ) = $tainted_entry =~ m/^([\w-]+)$/;
$c->stash->{rest}->{error} = 'Invalid Rfam family accession or ID'
$c->stash->{rest}->{error} = 'Invalid Rfam family accession or ID'
unless defined $entry;
}
else {
Expand All @@ -163,7 +163,7 @@ sub family : Chained( '/' )

=head2 family_page : Chained('family') PathPart('') Args(0) ActionClass('REST')
End-point of a chain handling family data. Generates a family page (HTML)
End-point of a chain handling family data. Generates a family page (HTML)
or an XML output. Implemented using C::C::REST; accepts GET requests only.
=cut
Expand Down Expand Up @@ -210,7 +210,7 @@ sub family_page_GET_html : Private {
->search( { clan_acc => $clan->clan_acc },
{ join => [ 'rfam_acc' ],
order_by => [ 'rfam_id' ] } );

if ( $clan and defined $clan->clan_acc ) {
$c->log->debug( 'Family::family_page: adding clan info' ) if $c->debug;
$c->stash->{clan} = $clan;
Expand All @@ -220,11 +220,11 @@ sub family_page_GET_html : Private {

#---------------------------------------

$c->log->debug( 'Family::family_page: adding summary info' )
$c->log->debug( 'Family::family_page: adding summary info' )
if $c->debug;
$c->forward( 'get_summary_data' );

$c->log->debug( 'Family::family_page: adding wikipedia info' )
$c->log->debug( 'Family::family_page: adding wikipedia info' )
if $c->debug;
$c->forward( 'get_wikipedia' );

Expand All @@ -242,7 +242,7 @@ sub family_page_GET_html : Private {
if $c->debug;

$c->cache_page( 43200 ) unless $ENV{NO_CACHE}; # cache for 12 hours

$c->stash->{pageType} = 'family';
$c->stash->{template} = 'pages/layout.tt';
}
Expand All @@ -255,7 +255,7 @@ sub family_page_GET : Private {

# there was a problem retrieving family data
unless ( $c->stash->{rfam} ) {
$c->log->debug( 'Family::family_page_GET: problem retrieving family data' )
$c->log->debug( 'Family::family_page_GET: problem retrieving family data' )
if $c->debug;

$c->stash->{rest}->{error} ||= 'Could not retrieve family data.';
Expand All @@ -267,7 +267,7 @@ sub family_page_GET : Private {
# for XML output...
if ( ( $c->req->accepted_content_types->[0] || '' ) eq 'text/xml' ) {

$c->log->debug( 'Family::family_page_GET: emitting XML' )
$c->log->debug( 'Family::family_page_GET: emitting XML' )
if $c->debug;

$c->stash->{template} = $c->stash->{rfam}
Expand All @@ -276,7 +276,7 @@ sub family_page_GET : Private {
}
else {

$c->log->debug( 'Family::family_page_GET: emitting something other than XML or HTML' )
$c->log->debug( 'Family::family_page_GET: emitting something other than XML or HTML' )
if $c->debug;

# populate a data structure with family data that should go into, say, a JSON
Expand All @@ -292,7 +292,7 @@ sub family_page_GET : Private {
acc => $r->rfam_acc,
description => $r->description,
comment => $r->comment,
clan => {
clan => {
id => undef,
acc => undef,
},
Expand Down Expand Up @@ -353,7 +353,7 @@ sub old_family : Chained( '/' )
$c->res->redirect( $c->uri_for( '/family', $c->stash->{param_entry}, $c->req->params ) );
}
else {
$c->log->debug( 'Family::old_family: no entry specified' )
$c->log->debug( 'Family::old_family: no entry specified' )
if $c->debug;

$c->stash->{rest}->{error} = 'No valid family accession/ID';
Expand Down Expand Up @@ -409,25 +409,25 @@ the relevant row into the stash.

sub get_data : Private {
my ( $this, $c, $entry ) = @_;

# check for a family
my $rfam = $c->stash->{db}->resultset('Family')
->search( [ { rfam_acc => $entry },
{ rfam_id => $entry } ] )
->single;

unless ( defined $rfam ) {
$c->log->debug( 'Family::get_data: no row for that accession/ID' )
if $c->debug;

$c->stash->{template} = ( ( $c->req->accepted_content_types->[0] || '' ) eq 'text/xml' )
? 'rest/family/error_xml.tt'
: 'components/blocks/family/error.tt';

$this->status_not_found( $c, message => 'No valid Rfam family accession or ID' );

return;
}
}

$c->log->debug( 'Family::get_data: got a family' )
if $c->debug;
Expand Down Expand Up @@ -472,10 +472,10 @@ sub get_summary_data : Private {
my $seed_tree_data = $c->stash->{db}->resultset( 'AlignmentAndTree' )
->find( { rfam_acc => $c->stash->{acc},
type => 'seed' },
{ columns => [ qw{ type
treemethod
average_length
percent_id
{ columns => [ qw{ type
treemethod
average_length
percent_id
number_of_sequences } ] } );

$c->stash->{alignment_info}->{seed} = $seed_tree_data;
Expand All @@ -491,11 +491,11 @@ Retrieves sequence data for the family.

sub get_regions_data : Private {
my ( $this, $c ) = @_;

$c->log->debug( 'Family::get_regions_data: family has |'
. $c->stash->{rfam}->num_full . '| regions' ) if $c->debug;

$c->stash->{region_rs} =
$c->stash->{region_rs} =
$c->stash->{db}->resultset('FullRegion')
->search( { rfam_acc => $c->stash->{acc} },
{ join => { 'rfamseq_acc' => 'ncbi' },
Expand All @@ -510,7 +510,7 @@ sub get_regions_data : Private {
ncbi_taxid
length ) ],
order_by => [ 'bit_score DESC' ] } );

$c->stash->{limits} = $this->{refseqRegionsLimits};

$c->log->debug('Family::get_regions_data: added regions to stash')
Expand All @@ -536,7 +536,7 @@ sub get_wikipedia : Private {
prefetch => [ 'wikitext' ] } );
$article = $rs->next;
};

return unless ( $article and $article->wikitext );

$c->stash->{article} = $article;
Expand Down Expand Up @@ -609,10 +609,10 @@ sub build_fasta : Private {
->search( { rfamseq_acc => $_,
rfam_acc => $c->stash->{acc} },
{ columns => [ qw( rfamseq_acc
seq_start
seq_start
seq_end ) ] } );
while ( my $row = $rs->next ) {
$fasta .= '>' .
$fasta .= '>' .
$row->get_column('rfamseq_acc') . '/' .
$row->seq_start . '-' . $row->seq_end . "\n";
}
Expand All @@ -621,7 +621,7 @@ sub build_fasta : Private {
return $fasta;
}

#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------

=head1 AUTHOR
Expand All @@ -635,7 +635,7 @@ Jennifer Daub, C<jd7@sanger.ac.uk>
Copyright (c) 2007: Genome Research Ltd.
Authors: John Tate (jt6@sanger.ac.uk), Paul Gardner (pg5@sanger.ac.uk),
Authors: John Tate (jt6@sanger.ac.uk), Paul Gardner (pg5@sanger.ac.uk),
Jennifer Daub (jd7@sanger.ac.uk)
This is free software; you can redistribute it and/or modify it under
Expand All @@ -656,4 +656,3 @@ this program. If not, see <http://www.gnu.org/licenses/>.
__PACKAGE__->meta->make_immutable;

1;

4 changes: 1 addition & 3 deletions RfamWeb/lib/RfamWeb/Roles/Family/StructureMethods.pm
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Jennifer Daub, C<jd7@sanger.ac.uk>
Copyright (c) 2007: Genome Research Ltd.
Authors: John Tate (jt6@sanger.ac.uk), Paul Gardner (pg5@sanger.ac.uk),
Authors: John Tate (jt6@sanger.ac.uk), Paul Gardner (pg5@sanger.ac.uk),
Jennifer Daub (jd7@sanger.ac.uk)
This is free software; you can redistribute it and/or modify it under
Expand All @@ -144,5 +144,3 @@ this program. If not, see <http://www.gnu.org/licenses/>.
=cut

1;


0 comments on commit 7f9dc64

Please sign in to comment.