From 8c9dfb54563c7ab6e8c738a4578ca37ca12fcf6f Mon Sep 17 00:00:00 2001 From: preecej Date: Mon, 17 Oct 2011 22:10:01 +0000 Subject: [PATCH] Adding gradient heat-map feature. In progress... svn path=/; revision=186 --- .../perl_singletons/pathway_gene_swapper.pl | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/preecej/perl_singletons/pathway_gene_swapper.pl b/preecej/perl_singletons/pathway_gene_swapper.pl index 7f74b3a..6ff71d8 100644 --- a/preecej/perl_singletons/pathway_gene_swapper.pl +++ b/preecej/perl_singletons/pathway_gene_swapper.pl @@ -59,7 +59,7 @@ pathway_gene_swapper.pl -i INPUT_FILE -g GENE_FILE -c CONFIG_FILE -o OUTPUT_FILE current working directory is assumed) -s use provided gene symbols instead of config file's LabelPrefix -h apply a heat-map to any multi-mapped set of paralogs - (NOTE: precludes custom box-coloring via the config file) + (NOTE: precludes custom box-coloring for paralogs) -L Remove literature references. -v View verbose information -G Display GPML input/output documents @@ -359,12 +359,37 @@ sub import_data $new_symbol = ""; # reset for next iter. } + # determine the original gene(s) with the highest # of homologs in the new + # gene set + my $max_homolog_count = 0; # count for heat map calibration + my @most_popular_genes; # identity of the gene(s) with the highest number of homologs + foreach my $orig_gene_key (keys %swap_genes) + { + if ($max_homolog_count < scalar(@{$swap_genes{$orig_gene_key}})) + { + $max_homolog_count = scalar(@{$swap_genes{$orig_gene_key}}); + @most_popular_genes = (); # new max; refresh + push @most_popular_genes, $orig_gene_key; + } + else + { + if ($max_homolog_count == scalar(@{$swap_genes{$orig_gene_key}})) + { + push @most_popular_genes, $orig_gene_key; + } + } + } + if ($verbose) # give add'l stats on gene and homolog counts { print "[Total number of original genes and homologs]\n" . "Original gene count: " . $original_gene_count . "\n" . "Replacement homolog count: $replacement_homolog_count\n\n"; + print "[Highest number of homologs per gene]\n"; + print "Number of homologs: $max_homolog_count\n"; + print "Gene(s): @most_popular_genes\n\n"; + print "[Number of homologs per original gene]\n"; foreach my $orig_gene_key (keys %swap_genes) { @@ -829,6 +854,10 @@ sub export_data init; +print "[Available Gradients]" +print Dumper(available_gradients()) . "\n\n"; +exit + import_data; show_input; swap_genes(); -- 2.34.1