diff Perl/convertANI.pl @ 14:5a5c9a6b047b draft

Uploaded
author dereeper
date Tue, 10 Dec 2024 16:20:53 +0000
parents e42d30da7a74
children
line wrap: on
line diff
--- a/Perl/convertANI.pl	Thu May 30 20:07:55 2024 +0000
+++ b/Perl/convertANI.pl	Tue Dec 10 16:20:53 2024 +0000
@@ -5,6 +5,7 @@
 my $file = $ARGV[0];
 my $metadata = $ARGV[1];
 
+
 my %strains;
 open(F,$metadata);
 while(<F>){
@@ -17,6 +18,7 @@
 
 my %ANIs;
 my %genomes;
+my %genome_names;
 my $num_line = 0;
 open(F,$file);
 <F>;
@@ -27,6 +29,11 @@
 	my @infos = split(/\t/,$line);
 	my $genome = $infos[0];
 	$genome = $strains{$genome};
+	$genome_names{$genome}++;
+	if ($genome_names{$genome} > 1){
+		$genome = $genome . ".". $genome_names{$genome};
+	}
+
 	$genomes{$num_line} = $genome;
 	for (my $i = 1; $i <= $#infos; $i++){
 		$ANIs{$i}{$num_line} = $infos[$i];
@@ -36,6 +43,7 @@
 close(F);
 
 print "Genomes";
+
 foreach my $i(sort keys(%ANIs)){
 	print "\t".$genomes{$i};
 }