[Bio] / RAST / MGRAST.pm Repository:
ViewVC logotype

View of /RAST/MGRAST.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Wed Jun 25 20:50:13 2008 UTC (11 years, 4 months ago) by wilke
Branch: MAIN
CVS Tags: mgrast_dev_02212011, rast_rel_2014_0912, rast_rel_2008_07_21, rast_rel_2010_0928, rast_2008_0924, rast_rel_2008_09_30, rast_rel_2010_0526, rast_rel_2014_0729, rast_rel_2009_05_18, mgrast_rel_2008_0923, rast_rel_2009_0925, rast_rel_2010_1206, rast_rel_2010_0118, mgrast_rel_2008_0924, rast_rel_2009_02_05, rast_rel_2011_0119, mgrast_rel_2008_0625, rast_rel_2008_12_18, rast_rel_2008_08_07, mgrast_rel_2008_1110_v2, rast_rel_2008_10_09, rast_release_2008_09_29, mgrast_rel_2008_0806, mgrast_rel_2008_0919, rast_rel_2009_07_09, rast_rel_2010_0827, mgrast_rel_2008_1110, myrast_33, rast_rel_2011_0928, rast_rel_2008_09_29, mgrast_rel_2008_0917, rast_rel_2008_10_29, mgrast_dev_02222011, rast_rel_2009_03_26, rast_rel_2008_11_24, HEAD
shared functions for mgrast

package RAST::MGRAST;

require WebApplication;

use strict;
use warnings;

#use base qw( Exporter );
#our @EXPORT = qw (is_public_metagenome );

1;


  
sub is_public_metagenome {
  my ($master, $id_or_job) = @_;

  unless (ref($master) && defined($id_or_job)) {
    die "No master or id in method 'is_public_metagenome'\n";
  }

  my $id;
  if (ref $id_or_job){
    $id = $id_or_job->genome_id;
  }
  else{
    $id = $id_or_job;
  }
  my $public_scope = $master->Scope->get_objects( { name => 'Public' } );
  unless (scalar(@$public_scope)) {
    die "Could not find public scope in database.\n";
  }
  
  $public_scope = $public_scope->[0];
  my $is_public = $master->Rights->get_objects( { scope => $public_scope,
						  name => 'view',
						  data_type => 'genome',
						  data_id => $id,
						  granted => 1 } );
  return scalar(@$is_public);
}


sub get_public_metagenomes {
  my ($master) = @_;

  unless ( ref($master) ) {
    die "No master or id in method 'is_public_metagenome'\n";
  }

  my $public_scope = $master->Scope->get_objects( { name => 'Public' } );
  unless (scalar(@$public_scope)) {
    die "Could not find public scope in database.\n";
  }
  
  $public_scope = $public_scope->[0];
  my $public_mg = $master->Rights->get_objects( { scope => $public_scope,
						  name => 'view',
						  data_type => 'genome',
						  granted => 1 } );
  return $public_mg;
}

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3