From: preecej Date: Sat, 30 Jul 2011 00:42:34 +0000 (+0000) Subject: Adds simple read-in of csv gene-swapping file X-Git-Url: http://gitweb.planteome.org/?a=commitdiff_plain;h=f9edf7714e658493237c53c72ed1fc1ec05fb204;p=old-jaiswallab-svn%2F.git Adds simple read-in of csv gene-swapping file svn path=/; revision=135 --- diff --git a/preecej/perl_singletons/pathway_gene_swapper.pl b/preecej/perl_singletons/pathway_gene_swapper.pl index 46aa497..b6134a0 100644 --- a/preecej/perl_singletons/pathway_gene_swapper.pl +++ b/preecej/perl_singletons/pathway_gene_swapper.pl @@ -97,6 +97,7 @@ my $debug = 0; # debugging switch # global data containers my %configs; # holds global configuration settings +my %swap_genes; # holds original and swapped genes my $gpml_doc; #holds imported GPML data for manipulation and output $Data::Dumper::Pad = "... "; @@ -224,6 +225,31 @@ Reads, parses, and stores source GPML. sub import_data { print "Opening input file and reading header info...\n\n"; + #open the file + #read a line + #skip header line + #split line on comma + #get original gene and swapped gene + #add genes to %swap_genes + open(CONFIG_FILE, $input_gene_file) or die("Could not open $input_gene_file"); + + my $line = ; + while () + { + $line = $_; + chomp $line; + my @line_ary = split(',',$line); + my $data_field = $line_ary[0]; + my $data_val = $line_ary[1]; + + $swap_genes{$data_field} = $data_val; + } + #test:display %swap_genes + if ($debug) { print "...\n" + . Dumper(\%swap_genes) . "\n\n"; } + + + }