Skip to content

Commit

Permalink
Issue #89 | add sw= date= to contig desc
Browse files Browse the repository at this point in the history
  • Loading branch information
tseemann committed Aug 4, 2018
1 parent 58df627 commit ce2b154
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bin/shovill
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use File::Temp;
use List::Util qw(min max);
use English qw(-no_match_vars);
use Cwd qw(realpath getcwd);
use POSIX qw(strftime);

# Globals
my $EXE = basename($PROGRAM_NAME);
Expand Down Expand Up @@ -350,6 +351,7 @@ else {
my $ncontigs = 0;
my $nbases = 0;
my $seq = read_fasta($asm);
my $metadata = "sw=$EXE-$asmdir/$VERSION date=".strftime("%Y%m%d",localtime);
my %len = map { ( $_ => length($seq->{$_}) ) } (keys %{$seq});
for my $id (sort { $len{$b} <=> $len{$a} } keys %{$seq}) {
# spades >NODE_1_length_114969_cov_29.8803_pilon
Expand All @@ -376,7 +378,7 @@ for my $id (sort { $len{$b} <=> $len{$a} } keys %{$seq}) {
$cov = sprintf "%.1f", $cov;
my $corr = $changes->{$id} || 0;
# $id =~ s/_pilon$// unless $nocorr;
my $newid = sprintf "$namefmt len=$len cov=$cov corr=$corr origname=$id", $ncontigs;
my $newid = "$namefmt len=$len cov=$cov corr=$corr origname=$id $metadata";
$seq->{$newid} = $seq->{$id};
delete $seq->{$id};
}
Expand Down

0 comments on commit ce2b154

Please sign in to comment.