Skip to content

Commit

Permalink
Better defaults / auto cpu ram
Browse files Browse the repository at this point in the history
  • Loading branch information
tseemann committed Sep 5, 2019
1 parent 1c57d20 commit 1b3e017
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions bin/shovill
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use POSIX qw(strftime);

# Globals
my $EXE = basename($PROGRAM_NAME);
my $VERSION = "1.0.7";
my $VERSION = "1.0.8";
my $AUTHOR = "Torsten Seemann";
my $URL = "https://github.com/tseemann/shovill";
my $BAM = "$EXE.bam";
Expand All @@ -28,7 +28,7 @@ my $KMER_READ_FRAC = 0.75; # ensure max kmer below this prop of read length
my $MIN_BQ = 3; # for trimming and stats and pilon
my $MIN_MQ = 60; # for pilon
my $MIN_FLASH_OVERLAP = 20; # for stitching
my $MIN_RAM_GB = 4; # for all tools
my $MIN_RAM_GB = 2; # for all tools
my $TRIMOPT = "ILLUMINACLIP:$ADAPTERS:1:30:11 LEADING:$MIN_BQ TRAILING:$MIN_BQ MINLEN:30 TOPHRED33";

my @CMDLINE = ($0, @ARGV); # save this for printing to log later
Expand Down Expand Up @@ -62,6 +62,10 @@ if ($ENV{TRAVIS} eq 'true') {
delete $VERSION{'skesa'};
}

# Hardware stats
my $CORES = num_cpus();
my $MEMORY = avail_ram_gb();

# Options
my(@Options, $version,
$outdir, $force, $cpus, $tmpdir, $keepfiles, $namefmt,
Expand All @@ -78,10 +82,6 @@ msg("Written by $AUTHOR");
msg("Homepage is $URL");
msg("Operating system is $OSNAME");
msg("Perl version is $PERL_VERSION");

# Hardware stats
my $CORES = num_cpus();
my $MEMORY = avail_ram_gb();
msg("Machine has $CORES CPU cores and $MEMORY GB RAM");

# Check options
Expand Down Expand Up @@ -689,8 +689,8 @@ sub setOptions {
{OPT=>"keepfiles!", VAR=>\$keepfiles, DEFAULT=>0, DESC=>"Keep intermediate files"},
"RESOURCES",
{OPT=>"tmpdir=s", VAR=>\$tmpdir, DEFAULT=>$ENV{TMPDIR} || '', DESC=>"Fast temporary directory"},
{OPT=>"cpus=i", VAR=>\$cpus, DEFAULT=>$ENV{SHOVILL_CPUS} || 8, DESC=>"Number of CPUs to use (0=ALL)"},
{OPT=>"ram=f", VAR=>\$ram, DEFAULT=>$ENV{SHOVILL_RAM} || 16, DESC=>"Try to keep RAM usage below this many GB"},
{OPT=>"cpus=i", VAR=>\$cpus, DEFAULT=>$ENV{SHOVILL_CPUS} || $CORES, DESC=>"Number of CPUs to use (0=ALL)"},
{OPT=>"ram=f", VAR=>\$ram, DEFAULT=>$ENV{SHOVILL_RAM} || min(16,$MEMORY), DESC=>"Try to keep RAM usage below this many GB"},
"ASSEMBLER",
{OPT=>"assembler=s",VAR=>\$assembler, DEFAULT=>$ENV{SHOVILL_ASSEMBLER} || 'spades', DESC=>"Assembler: ".join(' ', keys %ASSEMBLER) },
{OPT=>"opts=s", VAR=>\$opts, DEFAULT=>'', DESC=>"Extra assembler options in quotes eg. spades: \"--untrusted-contigs locus.fna\" ..."},
Expand Down
6 changes: 3 additions & 3 deletions test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ $SHOVILL --version
$SHOVILL --check
$SHOVILL --help
! $SHOVILL --doesnotexist
$SHOVILL --outdir "$OUTDIR" --R1 "$TESTDIR/R1.fq.gz" --R2 "$TESTDIR/R2.fq.gz" \
--ram 3 --cpus 8 --depth 25 --force
grep '>' "$OUTDIR/contigs.fa"
rm -frv "$OUTDIR"
$SHOVILL --outdir "$OUTDIR" --R1 "$TESTDIR/R1.fq.gz" --R2 "$TESTDIR/R2.fq.gz" \
--depth 25 --force --trim
grep '>' "$OUTDIR/contigs.fa" | head

0 comments on commit 1b3e017

Please sign in to comment.