use strict;
use warnings;
+use GD; # required for image creation
+use GD::Text::Align; # required for formatting
+use Number::Format qw(:subs); # required for adding commas to numbers
+
use lib "$ENV{HOME}/scripts/jaiswallab/interactome_scripts";
use DbiFloret;
+print "User credentials for the supercluster database\n";
my $dbh = DbiFloret::dbconnect;
-my @species_array = ("Vitis_vinifera", "Eucalyptus_grandis", "Arabidopsis_thaliana", "Populus_trichocarpa");
-my $array_size = @species_array;
+# create the database handler to get the total number of gene models in the fasta file
+# Assumes the fasta has been loaded to the protein sequences database
+print "User credentials for the protein sequences database\n";
+my $dbh_seq = DbiFloret::dbconnect;
+
+my @species_array = ("Aegilops_tauschii", "Hordeum_vulgare", "TmDV92", "TmG3116", "Triticum_urartu");
+#my @species_array = ("Aegilops_tauschii", "Hordeum_vulgare", "TmDV92", "TmG3116");
+#my @species_array = ("Aegilops_tauschii", "Hordeum_vulgare", "TmDV92");
+my $species_array_size = @species_array;
my %gene_hash;
my %super_hash;
-my $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]'");
+my $sth;
+
+if ($species_array_size == 3) {
+$sth=$dbh->prepare("select * from super_clust where `species` = '$species_array[0]' or `species` = '$species_array[1]' or `species` = '$species_array[2]'");
+}elsif ($species_array_size == 4) {
+$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]'");
+}
my $rv = $sth->execute();
foreach my $super_id (keys %super_hash) {
if(defined($clust_hash{$super_id})) {
my $oldhash = $clust_hash{$super_id};
- for (my $i=0;$i<$array_size;$i++) {
+ for (my $i=0;$i<$species_array_size;$i++) {
if($super_hash{$super_id}->{'species'} =~ /$species_array[$i]/) {
if($clust_hash{$super_id} !~ /$species_array[$i]/) {
$oldhash = "$oldhash\t$species_array[$i]";
}else{
- for (my $i=0;$i<$array_size;$i++) {
+ for (my $i=0;$i<$species_array_size;$i++) {
if($super_hash{$super_id}->{'species'} =~ /$species_array[$i]/) {
if(defined($clust_hash{$super_id})) {
$clust_hash{$super_id} = "$clust_hash{$super_id}\t$species_array[$i]";
}
}
-# print "\nTotal number of genes for each species\n";
-#
-# for (my $k = 0; $k<$array_size; $k++) {
- # my $gene_count = 0;
- # foreach my $super_id (keys %super_hash) {
- # while($super_hash{$super_id}->{'species'} =~ /$species_array[$k]/g) {
- # $gene_count++;
- # }
- # }
- # print "$species_array[$k]\t$gene_count\n";
-# }
-#print "\n\nCluster counts and gene counts for each Venn set\n";
+# variables needed for venn diagram printing
+my %venn_hash;
+
+
print "\n\n";
foreach my $key (keys %count_hash) {
my @gene_array = split ("\t", $count_hash{$key}->{'genes'});
}
close(output_file);
-
+ # try to set the variable for printing to the venn diagram
+ my $string = "spec_";
+ my $sub_count_string = "";
+ for (my $i = 0; $i < $species_array_size; $i++) {
+ if ($key =~ $species_array[$i]) {
+ $sub_count_string = $sub_count_string . $i+1;
+ }
+ }
+ my $count_string = $string . $sub_count_string . "_count";
+ my $formatted_id_size = format_number($id_array_size);
+ my $formatted_gene_size = format_number($gene_array_size);
+ $formatted_gene_size = "($formatted_gene_size)";
+ # pad the numbers so that they appear center aligned
+ my $pad_size = ((length $formatted_gene_size) - (length $formatted_id_size))/2;
+ my $spaces = "";
+ for (my $i = 0; $i < $pad_size; $i++) {
+ $spaces = $spaces . " ";
+ }
+
+ $venn_hash{$count_string} = "$spaces$formatted_id_size\n$formatted_gene_size";
}
+
+
my $sth_get_species_cluster_count=$dbh->prepare("select count(distinct super_id) from super_clust where species like ?");
-my $sth_get_species_gene_count=$dbh->prepare("select count(gene) from super_clust where species like?");
+my $sth_get_species_gene_count=$dbh->prepare("select count(gene) from super_clust where species like ?");
+
-foreach my $species (@species_array) {
- $sth_get_species_cluster_count->execute($species);
+for (my $i = 0; $i < $species_array_size; $i++) {
+ $sth_get_species_cluster_count->execute($species_array[$i]);
my $species_count = $sth_get_species_cluster_count->fetchrow_array();
- $sth_get_species_gene_count->execute($species);
+ $sth_get_species_gene_count->execute($species_array[$i]);
my $species_gene_count = $sth_get_species_gene_count->fetchrow_array();
- print "\nFor species $species, there were $species_count unique clusters with $species_gene_count genes\n";
+
+ my $safe_species_table = $dbh_seq->quote_identifier("$species_array[$i]");
+ my $sth_get_gene_model_count=$dbh_seq->prepare("select count(gene_id) from $safe_species_table");
+ $sth_get_gene_model_count->execute();
+ my $species_gene_model_count = $sth_get_gene_model_count->fetchrow_array();
+
+
+ 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";
+
+ # make the text to put on the venn diagram
+ my $j = $i + 1;
+ my $det_string_line_1 = "spec_". $j . "_det_line_1";
+ my $det_string = "spec_" . $j . "_det";
+ my $formatted_species = format_number($species_count);
+ my $formatted_genes = format_number($species_gene_count);
+ my $formatted_gene_model_count = format_number($species_gene_model_count);
+
+ my $species;
+ # this will change the species name to be genus initial followed by a dot then species
+ ($species = $species_array[$i]) =~ s/(\w)\w*_(\w*)/$1\. $2/;
+
+ if ($i == 1) {
+ my $det_text = "$formatted_gene_model_count gene models in fasta\n$formatted_species clusters\n$formatted_genes gene models in clusters";
+ # pad the text so that it appears center aligned
+ my $pad_size = ((length "$formatted_genes gene models in clusters") - (length $species))/2;
+ my $spaces = "";
+ for (my $k = 0; $k < $pad_size; $k++) {
+ $spaces = $spaces . " ";
+ }
+
+ $venn_hash{$det_string_line_1} = "$spaces$species";
+ $venn_hash{$det_string} = $det_text;
+ }else{
+ # pad the text so that it appears center aligned
+ my $pad_size = ((length $species) - (length $formatted_gene_model_count))/2;
+ my $spaces = "";
+ for (my $k = 0; $k < $pad_size; $k++) {
+ $spaces = $spaces . " ";
+ }
+ my $det_text = "$spaces$formatted_gene_model_count\n$spaces$formatted_species\n$spaces$formatted_genes";
+
+ $venn_hash{$det_string_line_1} = $species;
+ $venn_hash{$det_string} = $det_text;
+ }
}
my $sth_get_total_cluster_count=$dbh->prepare("select count(distinct super_id) from super_clust");
my $tot_count_clusters = keys %clust_hash;
-print "\nTotal number of clusters among the $array_size species = $tot_count_clusters\n";
+print "\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);
+my $formatted_tot_count_clusters = format_number($tot_count_clusters);
+my $tot_clust_string = "$formatted_tot_count total unique\ngene clusters identified\nin sequenced genomes\nof $tot_species_count species";
+my $tot_string = "$formatted_tot_count_clusters clusters had a\nmember in at least one\nof these $species_array_size species";
+###############################################################################
+# The below portion will draw the venn diagram #
+###############################################################################
+my $img;
+
+if($species_array_size == 3) {
+
+ # Open the venn diagram png file that already has the shapes
+ $img = newFromPng GD::Image('/home/justin/scripts/jaiswallab/Personnel/elserj/venn_sources/3_set_venn_source.png',1);
+
+ # make some colors
+ my $white = $img->colorAllocateAlpha(255,255,255,127);
+ my $black = $img->colorAllocate(0,0,0);
+ my $red = $img->colorAllocate(255,0,0);
+ my $blue = $img->colorAllocate(0,0,255);
+ my $green = $img->colorAllocate(0,212,0);
+
+ #$img->transparent($white);
+ $img->interlaced('true');
+ $img->alphaBlending(1);
+ $img->saveAlpha(1);
+
+ #define the locations for text to go
+ # species details
+ my @spec_1_det = (60,375);
+ my @spec_2_det = (370,22);
+ my @spec_3_det = (800,375);
+
+ my $spec_1_det = "$venn_hash{spec_1_det_line_1}\n$venn_hash{spec_1_det}";
+ my $spec_2_det = "$venn_hash{spec_2_det_line_1}\n$venn_hash{spec_2_det}";
+ my $spec_3_det = "$venn_hash{spec_3_det_line_1}\n$venn_hash{spec_3_det}";
+
+
+ $img->stringFT($red,'/usr/share/fonts/truetype/arial.ttf',22,0,$spec_1_det[0],$spec_1_det[1],"$spec_1_det");
+ $img->stringFT($green,'/usr/share/fonts/truetype/arial.ttf',22,0,$spec_2_det[0],$spec_2_det[1],"$spec_2_det");
+ $img->stringFT($blue,'/usr/share/fonts/truetype/arial.ttf',22,0,$spec_3_det[0],$spec_3_det[1],"$spec_3_det");
+
+ my @tot_clust = (100,600);
+ my @tot = (600,650);
+
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',22,0,$tot_clust[0],$tot_clust[1],"$tot_clust_string");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',22,0,$tot[0],$tot[1],"$tot_string");
+
+ # species individual counts
+ my @spec_1_pos = (320,440);
+ my @spec_2_pos = (480,200);
+ my @spec_3_pos = (650,440);
+
+
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_1_pos[0],$spec_1_pos[1],"$venn_hash{spec_1_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_2_pos[0],$spec_2_pos[1],"$venn_hash{spec_2_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_3_pos[0],$spec_3_pos[1],"$venn_hash{spec_3_count}");
+
+ # 2 species combinations
+ my @spec_12_pos = (390,310);
+ my @spec_13_pos = (490,465);
+ my @spec_23_pos = (580,310);
+
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_12_pos[0],$spec_12_pos[1],"$venn_hash{spec_12_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_13_pos[0],$spec_13_pos[1],"$venn_hash{spec_13_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_23_pos[0],$spec_23_pos[1],"$venn_hash{spec_23_count}");
+
+ # 3 species combination
+ my @spec_123_pos = (490,375);
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_123_pos[0],$spec_123_pos[1],"$venn_hash{spec_123_count}");
+
+}
+if($species_array_size == 4) {
+
+ # Open the venn diagram png file that already has the shapes
+ $img = newFromPng GD::Image('/home/justin/scripts/jaiswallab/Personnel/elserj/venn_sources/4_set_venn_source.png',1);
+
+ # make some colors
+ my $white = $img->colorAllocateAlpha(255,255,255,127);
+ my $black = $img->colorAllocate(0,0,0);
+ my $red = $img->colorAllocate(255,0,0);
+ my $blue = $img->colorAllocate(0,0,255);
+ my $green = $img->colorAllocate(0,212,0);
+ my $yellow = $img->colorAllocate(255,255,0);
+ my $gray = $img->colorAllocate(128,128,128);
+ my $salmon = $img->colorAllocate(255,103,103);
+
+ #$img->transparent($white);
+ $img->interlaced('true');
+ $img->alphaBlending(1);
+ $img->saveAlpha(1);
+
+ # define the locations for text to go
+ # species details
+ my @spec_1_det = (90,475);
+ my @spec_2_det = (400,125);
+ my @spec_3_det = (850,150);
+ my @spec_4_det = (1100,375);
+
+ my $spec_1_det = "$venn_hash{spec_1_det_line_1}\n$venn_hash{spec_1_det}";
+ my $spec_2_det = "$venn_hash{spec_2_det_line_1}\n$venn_hash{spec_2_det}";
+ my $spec_3_det = "$venn_hash{spec_3_det_line_1}\n$venn_hash{spec_3_det}";
+ my $spec_4_det = "$venn_hash{spec_4_det_line_1}\n$venn_hash{spec_4_det}";
+
+ $img->stringFT($gray,'/usr/share/fonts/truetype/arial.ttf',22,0,$spec_1_det[0],$spec_1_det[1],"$spec_1_det");
+ $img->stringFT($green,'/usr/share/fonts/truetype/arial.ttf',22,0,$spec_2_det[0],$spec_2_det[1],"$spec_2_det");
+ $img->stringFT($blue,'/usr/share/fonts/truetype/arial.ttf',22,0,$spec_3_det[0],$spec_3_det[1],"$spec_3_det");
+ $img->stringFT($salmon,'/usr/share/fonts/truetype/arial.ttf',22,0,$spec_4_det[0],$spec_4_det[1],"$spec_4_det");
+
+ my @tot_clust = (170,800);
+ my @tot = (950,850);
+
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',22,0,$tot_clust[0],$tot_clust[1],"$tot_clust_string");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',22,0,$tot[0],$tot[1],"$tot_string");
+
+ # species individual counts
+ my @spec_1_pos = (390,540);
+ my @spec_2_pos = (590,360);
+ my @spec_3_pos = (820,360);
+ my @spec_4_pos = (1030,540);
+
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_1_pos[0],$spec_1_pos[1],"$venn_hash{spec_1_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_2_pos[0],$spec_2_pos[1],"$venn_hash{spec_2_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_3_pos[0],$spec_3_pos[1],"$venn_hash{spec_3_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_4_pos[0],$spec_4_pos[1],"$venn_hash{spec_4_count}");
+
+ # 2 species combinations
+ my @spec_12_pos = (490,450);
+ my @spec_13_pos = (520,660);
+ my @spec_14_pos = (720,850);
+ my @spec_23_pos = (710,450);
+ my @spec_24_pos = (900,650);
+ my @spec_34_pos = (920,450);
+
+
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_12_pos[0],$spec_12_pos[1],"$venn_hash{spec_12_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_13_pos[0],$spec_13_pos[1],"$venn_hash{spec_13_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_14_pos[0],$spec_14_pos[1],"$venn_hash{spec_14_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_23_pos[0],$spec_23_pos[1],"$venn_hash{spec_23_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_24_pos[0],$spec_24_pos[1],"$venn_hash{spec_24_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_34_pos[0],$spec_34_pos[1],"$venn_hash{spec_34_count}");
+ #
+ # 3 species combinations
+ my @spec_123_pos = (620,570);
+ my @spec_124_pos = (795,750);
+ my @spec_134_pos = (815,570);
+ my @spec_234_pos = (590,750);
+
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_123_pos[0],$spec_123_pos[1],"$venn_hash{spec_123_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_124_pos[0],$spec_124_pos[1],"$venn_hash{spec_124_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_134_pos[0],$spec_134_pos[1],"$venn_hash{spec_134_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_234_pos[0],$spec_234_pos[1],"$venn_hash{spec_234_count}");
+
+ # 4 species combination
+ my @spec_1234_pos = (700,650);
+
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_1234_pos[0],$spec_1234_pos[1],"$venn_hash{spec_1234_count}");
+}
+if($species_array_size == 5) {
+
+ # Open the venn diagram png file that already has the shapes
+ $img = newFromPng GD::Image('/home/justin/scripts/jaiswallab/Personnel/elserj/venn_sources/5_set_venn_source.png',1);
+
+ # make some colors
+ my $white = $img->colorAllocateAlpha(255,255,255,127);
+ my $black = $img->colorAllocate(0,0,0);
+ my $blue = $img->colorAllocate(0,0,205);
+ my $green = $img->colorAllocate(0,212,0);
+ my $yellow = $img->colorAllocate(192,192,0);
+ my $orange = $img->colorAllocate(255,153,51);
+ my $maroon = $img->colorAllocate(102,0,102);
+
+
+ #$img->transparent($white);
+ $img->interlaced('true');
+ $img->alphaBlending(1);
+ $img->saveAlpha(1);
+
+ # define the locations for text to go
+ # species details
+ my @spec_1_det = (100,280);
+ my @spec_2_det = (400,30);
+ my @spec_3_det = (800,250);
+ my @spec_4_det = (770,575);
+ my @spec_5_det = (120,600);
+
+ my $spec_1_det = "$venn_hash{spec_1_det_line_1}\n$venn_hash{spec_1_det}";
+ my $spec_2_det = "$venn_hash{spec_2_det_line_1}\n$venn_hash{spec_2_det}";
+ my $spec_3_det = "$venn_hash{spec_3_det_line_1}\n$venn_hash{spec_3_det}";
+ my $spec_4_det = "$venn_hash{spec_4_det_line_1}\n$venn_hash{spec_4_det}";
+ my $spec_5_det = "$venn_hash{spec_5_det_line_1}\n$venn_hash{spec_5_det}";
+
+ $img->stringFT($blue,'/usr/share/fonts/truetype/arial.ttf',22,0,$spec_1_det[0],$spec_1_det[1],"$spec_1_det");
+ $img->stringFT($green,'/usr/share/fonts/truetype/arial.ttf',22,0,$spec_2_det[0],$spec_2_det[1],"$spec_2_det");
+ $img->stringFT($maroon,'/usr/share/fonts/truetype/arial.ttf',22,0,$spec_3_det[0],$spec_3_det[1],"$spec_3_det");
+ $img->stringFT($yellow,'/usr/share/fonts/truetype/arial.ttf',22,0,$spec_4_det[0],$spec_4_det[1],"$spec_4_det");
+ $img->stringFT($orange,'/usr/share/fonts/truetype/arial.ttf',22,0,$spec_5_det[0],$spec_5_det[1],"$spec_5_det");
+
+ my @tot_clust = (50,50);
+ my @tot = (430,700);
+
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',22,0,$tot_clust[0],$tot_clust[1],"$tot_clust_string");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',22,0,$tot[0],$tot[1],"$tot_string");
+
+ # species individual counts
+ my @spec_1_pos = (260,380);
+ my @spec_2_pos = (460,170);
+ my @spec_3_pos = (660,290);
+ my @spec_4_pos = (660,540);
+ my @spec_5_pos = (365,600);
+
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_1_pos[0],$spec_1_pos[1],"$venn_hash{spec_1_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_2_pos[0],$spec_2_pos[1],"$venn_hash{spec_2_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_3_pos[0],$spec_3_pos[1],"$venn_hash{spec_3_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_4_pos[0],$spec_4_pos[1],"$venn_hash{spec_4_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_5_pos[0],$spec_5_pos[1],"$venn_hash{spec_5_count}");
+
+
+ # 2 species combinations
+ my @spec_12_pos = (400,285);
+ my @spec_13_pos = (635,365);
+ my @spec_14_pos = (345,360);
+ my @spec_15_pos = (340,460);
+ my @spec_23_pos = (580,285);
+ my @spec_24_pos = (575,532);
+ my @spec_25_pos = (485,260);
+ my @spec_34_pos = (640,455);
+ my @spec_35_pos = (400,530);
+ my @spec_45_pos = (500,560);
+
+
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_12_pos[0],$spec_12_pos[1],"$venn_hash{spec_12_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_13_pos[0],$spec_13_pos[1],"$venn_hash{spec_13_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_14_pos[0],$spec_14_pos[1],"$venn_hash{spec_14_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_15_pos[0],$spec_15_pos[1],"$venn_hash{spec_15_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_23_pos[0],$spec_23_pos[1],"$venn_hash{spec_23_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_24_pos[0],$spec_24_pos[1],"$venn_hash{spec_24_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_25_pos[0],$spec_25_pos[1],"$venn_hash{spec_25_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_34_pos[0],$spec_34_pos[1],"$venn_hash{spec_34_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_35_pos[0],$spec_35_pos[1],"$venn_hash{spec_35_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_45_pos[0],$spec_45_pos[1],"$venn_hash{spec_45_count}");
+
+ # 3 species combinations
+ my @spec_123_pos = (575,350);
+ my @spec_124_pos = (400,330);
+ my @spec_125_pos = (465,320);
+ my @spec_134_pos = (630,415);
+ my @spec_135_pos = (405,485);
+ my @spec_145_pos = (405,405);
+ my @spec_234_pos = (580,468);
+ my @spec_235_pos = (540,300);
+ my @spec_345_pos = (470,505);
+
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_123_pos[0],$spec_123_pos[1],"$venn_hash{spec_123_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_124_pos[0],$spec_124_pos[1],"$venn_hash{spec_124_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_125_pos[0],$spec_125_pos[1],"$venn_hash{spec_125_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_134_pos[0],$spec_134_pos[1],"$venn_hash{spec_134_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_135_pos[0],$spec_135_pos[1],"$venn_hash{spec_135_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_145_pos[0],$spec_145_pos[1],"$venn_hash{spec_145_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_234_pos[0],$spec_234_pos[1],"$venn_hash{spec_234_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_235_pos[0],$spec_235_pos[1],"$venn_hash{spec_235_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_345_pos[0],$spec_345_pos[1],"$venn_hash{spec_345_count}");
+
+ # 4 species combinations
+ my @spec_1234_pos = (570,415);
+ my @spec_1235_pos = (515,345);
+ my @spec_1245_pos = (445,365);
+ my @spec_1345_pos = (440,450);
+ my @spec_2345_pos = (520,480);
+
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_1234_pos[0],$spec_1234_pos[1],"$venn_hash{spec_1234_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_1235_pos[0],$spec_1235_pos[1],"$venn_hash{spec_1235_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_1245_pos[0],$spec_1245_pos[1],"$venn_hash{spec_1245_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_1345_pos[0],$spec_1345_pos[1],"$venn_hash{spec_1345_count}");
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_2345_pos[0],$spec_2345_pos[1],"$venn_hash{spec_2345_count}");
+
+ # 5 species combination
+ my @spec_12345_pos = (495,410);
+
+ $img->stringFT($black,'/usr/share/fonts/truetype/arial.ttf',14,0,$spec_12345_pos[0],$spec_12345_pos[1],"$venn_hash{spec_12345_count}");
+}
+# convert the image to PNG and print it
+open (TESTOUT, ">test.png") || die;
+my $png_data = $img->png;
+binmode TESTOUT;
+print TESTOUT $png_data;
+close TESTOUT;