[Bio] / FigKernelPackages / RAST_submission.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/RAST_submission.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10, Thu Oct 29 16:20:08 2009 UTC revision 1.11, Fri Nov 20 17:38:06 2009 UTC
# Line 209  Line 209 
209      }      }
210    
211      my %lens = map { $_->[0] => length($_->[1]) } @$seqs;      my %lens = map { $_->[0] => length($_->[1]) } @$seqs;
212      my $tmp = "tmp.$$.fasta";      my $tmp = "$FIG_Config::temp/tmp.$$.fasta";
213      &gjoseqlib::print_alignment_as_fasta($tmp,$seqs);      &gjoseqlib::print_alignment_as_fasta($tmp,$seqs);
214      system "formatdb -i $tmp -pF";      system "formatdb -i $tmp -pF";
215      my @blastout = `blastall -m8 -i $tmp -d $tmp -p blastn -FF -e 1.0e-100`;      my @blastout = `blastall -m8 -i $tmp -d $tmp -p blastn -FF -e 1.0e-100`;
# Line 819  Line 819 
819  #     return { status => 'ok', contents => $txt };  #     return { status => 'ok', contents => $txt };
820  }  }
821    
822    sub get_job_metadata
823    {
824        my($self, $params) = @_;
825    
826        my $job_id = $params->{-job};
827    
828        $job_id =~ /^\d+$/ or return { status => 'error', error_msg => 'invalid job id'};
829    
830        my $res = {};
831        my $job = $self->get_job_for_reading($job_id, $res);
832        return $res if !$job;
833    
834        my $keys = $params->{-key};
835        $keys = [$keys] unless ref($keys);
836    
837        for my $key (@$keys)
838        {
839            $res->{metadata}->{$key} = $job->metaxml->get_metadata($key);
840        }
841        $res->{status} = 'ok';
842        return $res;
843    }
844    
845    sub get_job_for_reading
846    {
847        my($self, $job_id, $res) = @_;
848    
849        my $job = $self->rast_dbmaster->Job->init({ id => $job_id });
850        if (!ref($job))
851        {
852            $res->{status} = 'error';
853            $res->{error_msg} = 'Job not found';
854            return;
855        }
856    
857        if (!$self->user_may_access_job($job))
858        {
859            $res->{status} = 'error';
860            $res->{error_msg} = 'Access denied';
861            return;
862        }
863        return $job;
864    }
865    
866    sub get_job_for_modification
867    {
868        my($self, $job_id, $res) = @_;
869    
870        my $job = $self->rast_dbmaster->Job->init({ id => $job_id });
871        if (!ref($job))
872        {
873            $res->{status} = 'error';
874            $res->{error_msg} = 'Job not found';
875            return;
876        }
877    
878        if (!($self->user_may_access_job($job) && $self->user_owns_job($job)))
879        {
880            $res->{status} = 'error';
881            $res->{error_msg} = 'Access denied';
882            return;
883        }
884        return $job;
885    }
886    
887  sub user_may_access_job  sub user_may_access_job
888  {  {
889      my($self, $job) = @_;      my($self, $job) = @_;

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3