minor fixes
[sgn.git] / lib / CXGN / Blast / SeqQuery / Plugin / ProteinSequence.pm
blob16e01b463dd2dbc1b2f557f2d942489ef4936f74
2 package CXGN::Blast::SeqQuery::Plugin::ProteinSequence;
4 use Moose;
6 use Bio::Seq;
8 sub name {
9 return "protein sequence";
12 sub type {
13 return 'protein';
16 sub example {
17 return "VHYNLFKMNGFHHTEIWDRHESFECSSVGSEESHSLEGGEKLYHDPSTEGQKEAGPKSELTSGVKSLDRCLSNPRSLGEIPASYEISEYE
18 HLIEQEMRWLKANYQIKLRELKDQHLGLPPKASKPPTGSSKRKKKTKNKNSCLETLLKSSDCGKTISSESNGLSCPISVSQRARKCEAIK
19 GSPNVRDMVSSAKSFFTRTLLPNSLHRTTSLPVDAVDI";
22 sub validate {
23 my $self = shift;
24 my $c = shift;
25 my $input = shift;
27 eval {
28 my $s = Bio::Seq->new(-seq => $input);
30 if ($s->seq() !~ /^[ACDEFGHIKLMNPQRSTVWYX\n\s\t]$/i) {
31 $c->stash->{rest} = { error=> "Protein sequence contains illegal characters: ".($s->id)};
32 return;
35 if ($@) {
36 $c->stash->{rest} = {error => "The sequence does not seem to be a legal protein sequence.", };
37 return;
40 return "OK";
43 sub process {
44 my $self = shift;
45 my $c = shift;
46 my $sequence = shift;
48 return ">Untitled Sequence\n$sequence\n";