From c81c1c62b152c34ff8887fbcfef3d378193de95c Mon Sep 17 00:00:00 2001 From: Nolan Woods Date: Thu, 17 Jan 2019 09:34:54 -0800 Subject: [PATCH] Add GFF output --- Dimob.pl | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/Dimob.pl b/Dimob.pl index 52ef9cc..3647cbd 100755 --- a/Dimob.pl +++ b/Dimob.pl @@ -22,7 +22,7 @@ =head1 AUTHORS =head1 LAST MAINTAINED - December 16th, 2016 + January 16th, 2019 =cut @@ -138,12 +138,28 @@ =head1 LAST MAINTAINED my $i = 1; open my $fhgd, '>', $outputfile or die "Cannot open output.txt: $!"; - foreach my $island (@islands) { - my $start = $island->[0]; - my $end = $island->[1]; - print $fhgd "GI_$i\t$start\t$end\n"; - $i++; + + if ($outputfile =~ /\.txt$/) { + #legacy output + $logger->info("Warning: txt output is now depreciated. Support has been added to output GFF3 formatted documents. Use (any) other extension to enable GFF output. See: https://github.com/brinkmanlab/islandpath/issues/7"); + foreach my $island (@islands) { + my $start = $island->[0]; + my $end = $island->[1]; + print $fhgd "GI_$i\t$start\t$end\n"; + $i++; + } + } else { + #GFF output + print $fhgd "##gff-version 3\n"; + foreach my $island (@islands) { + my $start = $island->[0]; + my $end = $island->[1]; + #TODO use proper chromosome sequence id + print $fhgd "GI_$i\tislandpath\tgenomic_island\t$start\t$end\t.\t.\t.\tID=GI_$i\n"; + $i++; + } } + close $fhgd; $logger->info("Removing tmp files");