Skip to content

Instantly share code, notes, and snippets.

@cybersiddhu
Created October 27, 2012 16:35
Show Gist options
  • Save cybersiddhu/3965263 to your computer and use it in GitHub Desktop.
Save cybersiddhu/3965263 to your computer and use it in GitHub Desktop.
A basic command line application for modware loader
package GAFLoader;
# Other modules:
use namespace::autoclean; #removes all sugar
use Moose; #uses Moose
with 'Modware::Role::Command::WithBCS'; #imports attributes to get an instance of Bio::Chado::Schema object
extends qw/MooseX::App::Cmd::Command/; #makes this being recognized as runnable command
#code that gets executed when you run the comamnd
sub execute {
my ($self) = @_;
# A Bio::Chado::Schema object
my $schema = $self->schema;
}
1; # Magic true value required at end of module
__END__
=head1 NAME
B<GAFLoader2> - [Loads GAF file in the database]
package GAFLoader2;
# Other modules:
use namespace::autoclean; #removes all sugar
use Moose;
use YAML qw/LoadFile/; #exports LoadFile method from YAML module
with 'Modware::Role::Command::WithBCS'; #imports attributes to get an instance of Bio::Chado::Schema object
with 'Modware::Role::Command::WithLogger'; #gets a logger
with 'MooseX::ConfigFromFile'; #provides supports for loading options from a yaml config file
extends qw/MooseX::App::Cmd::Command/; #makes this being recognized as runnable command
#code that gets executed when you run the comamnd
sub execute {
my ($self) = @_;
# A Log::Log4perl object
my $logger = $self->logger;
$logger->info('i understand logging');
# A Bio::Chado::Schema object
my $schema = $self->schema;
}
# method that needed to be implemented to load the config file
# Read MooseX::ConfigFromFile for more
sub get_config_from_file {
my ($self, $file) = @_;
return LoadFile($file);
}
1; # Magic true value required at end of module
__END__
=head1 NAME
B<GAFLoader2> - [Loads GAF file in the database]
package GAFLoader3;
# Other modules:
use namespace::autoclean; #removes all sugar
use Moose;
use YAML qw/LoadFile/; #exports LoadFile method from YAML module
with 'Modware::Role::Command::WithBCS'; #imports attributes to get an instance of Bio::Chado::Schema object
with 'Modware::Role::Command::WithLogger'; #gets a logger
with 'MooseX::ConfigFromFile'; #provides supports for loading options from a yaml config file
extends qw/MooseX::App::Cmd::Command/; #makes this being recognized as runnable command
## add your attributes here
## LWP object/url fetching yaada yaada here
#code that gets executed when you run the comamnd
sub execute {
my ($self) = @_;
# A Log::Log4perl object
my $logger = $self->logger;
$logger->info('i understand logging');
# A Bio::Chado::Schema object
my $schema = $self->schema;
# 1.Prune all GO annotation here
# 2.Log the output here
# Add your GAF loading code here
# 1. read your gene list
# 2. Get GAF section from ebi
# 3. Print the output (for practice)
# 4. Extract feature_id and cvterm_id for GO and GeneId
# 5. Insert them in feature_cvterm
}
# method that needed to be implemented to load the config file
# Read MooseX::ConfigFromFile for more
sub get_config_from_file {
my ($self, $file) = @_;
return LoadFile($file);
}
1; # Magic true value required at end of module
__END__
=head1 NAME
B<GAFLoader3> - [Loads GAF file in the database]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment