- Non-standard Perl modules: Switch, XML::DOM
- The input file must be a valid GPML file
- - The CSV file must have a single-line column header
- If the second column contains
+ - The CSV file must have a single-line column header.
+
+ The first column must have one and only one gene -- the
+ "original" gene.
+
+ The second column may have one or more genes or gene variants
+ -- the "replacement" gene(s).
+
+ If the second column contains multiple genes or gene variants,
+ multiple PathVisio boxes will be drawn in place of the
+ original.
+
- The config file may have any or all of the following entries:
+
Title=
MaintainedBy=
Organism=
use Cwd;
use Switch;
use Getopt::Std;
+use Data::Dumper;
# specific
use XML::DOM;
# declarations
# ---------------------------------------------------------------------------
+# command-line options
my %opts; # arg options
my $input_gpml_file;
my $input_gene_file;
my $verbose = 0; # flag for verbose output
my $debug = 0; # debugging switch
-my $gpml_doc;
+# global data containers
+my %configs; # holds global configuration settings
+my $gpml_doc; #holds imported GPML data for manipulation and output
+
+$Data::Dumper::Pad = "... ";
+
+# ---------------------------------------------------------------------------
+=head1 FUNCTIONS
+
+=over
+
+=cut
+# ---------------------------------------------------------------------------
+
# ---------------------------------------------------------------------------
-# functions
+=item B<hash config($file_path)>
+Reads a configuration file and sets config values.
+Returns a hash with config values set.
+=cut
# ---------------------------------------------------------------------------
+sub config($)
+{
+ if ($debug) { print "...Config file path: $_[0]\n"; }
+
+ my %local_config_hash;
+
+ open(CONFIG_FILE, $_[0]) or die("Could not open $_[0]");
+
+ while (<CONFIG_FILE>)
+ {
+ my $line = $_;
+ chomp $line;
+ my @line_ary = split('=',$line);
+ my $data_field = $line_ary[0];
+ my $data_val = $line_ary[1];
+
+ $local_config_hash{$data_field} = $data_val;
+ }
+
+ return %local_config_hash;
+}
+# ---------------------------------------------------------------------------
+=item B<void init()>
+Reads in command-line values, calls for config settings, and begins
+screen output.
+=cut
# ---------------------------------------------------------------------------
sub init
{
$input_gene_file = getcwd() . "\/$value";
}
}
- case "c" {
+ case "c" {
if ($value =~ /\//) { # assume path
$input_config_file = $value;
} else {
$input_config_file = getcwd() . "\/$value";
}
}
- case "o" {
+ case "o" {
if ($value =~ /\//) { # assume path
$output_file = $value;
} else {
case "d" { $debug = 1; }
}
}
-
+
system "clear";
print "\n"
. "------------------------------------------------------------\n"
. "------------------ Pathway Gene Swapper --------------------\n"
. "------------------------------------------------------------\n"
. "\n"
- . "Input File: $input_gpml_file\n"
- . " $input_gene_file\n"
- . " $input_config_file\n"
+ . "Input Files:\n"
+ . " - PathVisio File (GPML): $input_gpml_file\n"
+ . " - Gene List (CSV): $input_gene_file\n"
+ . " - Configuration settings: $input_config_file\n"
+ . "\n"
. "Output File: $output_file\n"
+ . "\n"
. "Running in verbose mode? " . ($verbose ? "Yes" : "No") . "\n"
- . "Running in debug mode? " . ($verbose ? "Yes" : "No") . "\n"
+ . "Running in debug mode? " . ($debug ? "Yes" : "No") . "\n"
. "\n"
. "------------------------------------------------------------\n"
. "------------------------------------------------------------\n"
. "------------------------------------------------------------\n"
. "\n";
+
+ %configs = config($input_config_file);
+
+ if ($debug) { print "...<DEBUG: \%configs>\n"
+ . Dumper(\%configs) . "\n\n"; }
}
-# read, parse, and store source GPML
+
+# ---------------------------------------------------------------------------
+=item B<void import_data()>
+Reads, parses, and stores source GPML.
+=cut
# ---------------------------------------------------------------------------
sub import_data
{
}
-# spit out the data to make sure you've read in the files correctly
+# ---------------------------------------------------------------------------
+=item B<void show_input()>
+Spits out the data to make sure you've read in the files correctly.
+Verbose only.
+=cut
# ---------------------------------------------------------------------------
sub show_input
{
print "\n";
}
-# substitute gene data
+# ---------------------------------------------------------------------------
+=item B<void swap_genes()>
+Substitutes gene data.
+=cut
# ---------------------------------------------------------------------------
sub swap_genes
{
- print "Swapping gene data...\n";
+ print "Swapping gene data...\n\n";
# -------------------------------------------------------------------------
# [PathVisio Perl Pseudo-Script]
}
-# display the transformed data
+# ---------------------------------------------------------------------------
+=item B<void show_output()>
+Displays the transformed data. Verbose only.
+=cut
# ---------------------------------------------------------------------------
sub show_output
+{
+ print "[Modified GPML]\n";
+ print "\n";
+}
+
+# ---------------------------------------------------------------------------
+=item B<void export_data()>
+Writes the transformed GPML doc out to the specified output file.
+=cut
+# ---------------------------------------------------------------------------
+sub export_data
{
print "Writing GPML to new output file...\n";
print "\n";
}
+=back
+=cut
+
# ---------------------------------------------------------------------------
# main
# ---------------------------------------------------------------------------
if ($verbose) { show_input; }
swap_genes();
if ($verbose) { show_output; }
-
+export_data;
exit;