--- families_on_tree.cgi 2014/05/02 22:17:50 1.3 +++ families_on_tree.cgi 2014/05/05 18:05:26 1.4 @@ -205,8 +205,17 @@ push(@\$html,"
`\n\$tree\n`
\n"); } +sub fam_in_set { + my(\$fam,\$set) = @_; + + my @fams = split(/,/,\$set); + my \$i; + for (\$i=0; (\$i < @fams) && (\$fam ne \$fams[\$i]); \$i++) {} + return (\$i < @fams); +} + sub show_family1 { - my(\$cgi,\$dataDF,\$html,\$family) = @_; + my(\$cgi,\$dataDF,\$html,\$families) = @_; \$dataDF =~ /([^\/]+)\$/; my \$dataD = \$1; @@ -214,20 +223,21 @@ my \$func; foreach \$_ (`cut -f1,2 \$dataDF/families.all`) { - if ((\$_ =~ /^(\d+)\t(\S[^\t]*\S)/) && (\$1 == \$family)) { \$func = \$2 } +# if ((\$_ =~ /^(\d+)\t(\S[^\t]*\S)/) && (\$1 == \$families)) { \$func = \$2 } + if ((\$_ =~ /^(\d+)\t(\S[^\t]*\S)/) && &fam_in_set(\$1,\$families)) { \$func = \$2 } } my %genome_names = map { (\$_ =~ /^(\S+)\t(\S.*\S)/) ? (\$1 => \$2) : () } `cat \$dataDF/genome.names`; my \$col_hdrs = ['','Genome','Genome Name','Peg']; my @tuples = map { my \$tuple = \$_; \$tuple->[3] = &peg_link(\$tuple->[3]); \$tuple } sort { \$a->[1] cmp \$b->[1] } - map { ((\$_ =~ /^(\d+)\t([^\t]*)\t(fig\|(\d+\.\d+)\.peg\.\d+)/) && (\$1 == \$family)) ? + map { ((\$_ =~ /^(\d+)\t([^\t]*)\t(fig\|(\d+\.\d+)\.peg\.\d+)/) && &fam_in_set(\$1,\$families)) ? [\$cgi->checkbox(-name => "check.\$3",-checked => 1,-label => ''), \$4, \$genome_names{\$4}, \$3] : () } `cut -f1,2,4 \$dataDF/families.all`; - push(@\$html,\$cgi->start_form(-action => "./families_on_tree.cgi")); - push(@\$html,"

\n",&HTML::make_table(\$col_hdrs,\@tuples,"Distribution of Family \$family: \$func"),\$cgi->hr,"\n"); + push(@\$html,\$cgi->start_form(-action => "./families5_on_tree.cgi")); + push(@\$html,"

\n",&HTML::make_table(\$col_hdrs,\@tuples,"Distribution of Family \$families: \$func"),\$cgi->hr,"\n"); push(@\$html,"\n"); push(@\$html,"\n"); push(@\$html,\$cgi->submit('alignment'),