From f08da66ff088b66b008774431b6fa5d9bf6ae6c8 Mon Sep 17 00:00:00 2001 From: elserj Date: Thu, 30 Apr 2020 17:00:58 +0000 Subject: [PATCH] Add db handler for 6 species, will not draw venn diagram, just generate data. Also output summary to file as well as stdout. svn path=/; revision=677 --- interactome_scripts/create_venn_diagram.pl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/interactome_scripts/create_venn_diagram.pl b/interactome_scripts/create_venn_diagram.pl index 6e19896..fb94495 100755 --- a/interactome_scripts/create_venn_diagram.pl +++ b/interactome_scripts/create_venn_diagram.pl @@ -58,6 +58,8 @@ $sth=$dbh->prepare("select * from super_clust where `species` = '$species_array[ $sth=$dbh->prepare("select * from super_clust where `species` = '$species_array[0]' or `species` = '$species_array[1]' or `species` = '$species_array[2]' or `species` = '$species_array[3]'"); }elsif ($species_array_size == 5) { $sth=$dbh->prepare("select * from super_clust where `species` = '$species_array[0]' or `species` = '$species_array[1]' or `species` = '$species_array[2]' or `species` = '$species_array[3]' or `species` = '$species_array[4]'"); +}elsif ($species_array_size == 6) { +$sth=$dbh->prepare("select * from super_clust where `species` = '$species_array[0]' or `species` = '$species_array[1]' or `species` = '$species_array[2]' or `species` = '$species_array[3]' or `species` = '$species_array[4]' or `species` = '$species_array[5]'"); } my $rv = $sth->execute(); @@ -137,6 +139,7 @@ foreach my $clust_id (keys %clust_hash) { # variables needed for venn diagram printing my %venn_hash; +open(SUMMFILE, ">summary.txt"); print "\n\n"; foreach my $key (keys %count_hash) { @@ -152,6 +155,7 @@ foreach my $key (keys %count_hash) { # print "$key\t$id\n"; #} print "$key\t$id_array_size\t$gene_array_size\n"; + print SUMMFILE "$key\t$id_array_size\t$gene_array_size\n"; # create the file to output the genes involved in each Venn set $key =~ s/\t/__/g; # replace the \t in the filename with two working spaces @@ -205,6 +209,7 @@ for (my $i = 0; $i < $species_array_size; $i++) { print "\nFor species $species_array[$i], there were $species_count unique clusters with $species_gene_count genes from $species_gene_model_count genes in the fasta file\n"; + print SUMMFILE "\nFor species $species_array[$i], there were $species_count unique clusters with $species_gene_count genes from $species_gene_model_count genes in the fasta file\n"; # make the text to put on the venn diagram my $j = $i + 1; @@ -254,10 +259,12 @@ my $sth_get_total_species_count=$dbh->prepare("select count(distinct species) fr $sth_get_total_species_count->execute(); my $tot_species_count = $sth_get_total_species_count->fetchrow_array(); print "\nTotal number of clusters across all species was $tot_count across $tot_species_count species\n"; +print SUMMFILE "\nTotal number of clusters across all species was $tot_count across $tot_species_count species\n"; my $tot_count_clusters = keys %clust_hash; print "\nTotal number of clusters among the $species_array_size species = $tot_count_clusters\n"; +print SUMMFILE "\nTotal number of clusters among the $species_array_size species = $tot_count_clusters\n"; # make the strings to store this info to put on the figure my $formatted_tot_count = format_number($tot_count); -- 2.34.1