Skip to content

Commit

Permalink
Add new --check option to check deps installed
Browse files Browse the repository at this point in the history
  • Loading branch information
tseemann committed Jul 9, 2017
1 parent 518113b commit 3eff911
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,16 @@ If you are using the [OSX Brew](http://brew.sh/) or [LinuxBrew](http://brew.sh/l
```
brew tap homebrew/science
brew tap tseemann/bioinformatics-linux
brew install abricate --HEAD
brew install abricate
abricate --check
```

### Bioconda
If you use [Conda](https://conda.io/docs/install/quick.html)
follow the instructions to add the [Bioconda channel](https://bioconda.github.io/):
```
conda install abricate
abricate --check
```

### Source
Expand All @@ -53,7 +55,7 @@ You will also need to install these dependencies manually:
Then install directly from github:
```
git clone https://github.com/tseemann/abricate.git
./abricate/bin/abricate --help
./abricate/bin/abricate --check
```

## Input
Expand Down
18 changes: 15 additions & 3 deletions bin/abricate
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use Cwd qw(abs_path);
my $VERSION = "0.5-dev";
my $EXE = just_filename( $FindBin::RealScript );

my(@Options, $debug, $quiet, $list, $summary,
my(@Options, $debug, $quiet, $list, $summary, $check,
$datadir, $db, $minid,
$noheader, $csv, $nopath);
setOptions();
Expand All @@ -44,6 +44,8 @@ my @COLUMNS = qw(
);
$COLUMNS[0] = '#'.$COLUMNS[0];

my @REQUIRE = qw(blastn makeblastdb seqret gzip unzip);

#..............................................................................
# Option parsing

Expand All @@ -56,10 +58,19 @@ if ($list) {
list_databases($datadir);
exit;
}

if ($check) {
$debug=1;
msg("Checking dependencies are installed:");
require_exe( @REQUIRE );
msg("OK.");
exit;
}

$OUTSEP = ',' if $csv; # default is tab

# check if 'blastn' installed
require_exe('blastn', 'gzip', 'seqret', 'makeblastdb', 'unzip');
# check if dependencies are installed
require_exe( @REQUIRE );

# check if blastn > 2.2.30 to support 'gaps' custom field
my($version) = qx(blastn -version 2>&1);
Expand Down Expand Up @@ -301,6 +312,7 @@ sub setOptions {
{OPT=>"quiet!", VAR=>\$quiet, DEFAULT=>0, DESC=>"Quiet mode, no stderr output"},
{OPT=>"version!", VAR=>\&version, DESC=>"Print version and exit"},
{OPT=>"list!", VAR=>\$list, DEFAULT=>0, DESC=>"List included databases"},
{OPT=>"check!", VAR=>\$check, DEFAULT=>0, DESC=>"Check dependencies are installed"},
{OPT=>"summary!", VAR=>\$summary, DEFAULT=>0, DESC=>"Summarize multiple reports into a table"},
{OPT=>"datadir=s", VAR=>\$datadir, DEFAULT=>"$FindBin::RealBin/../db", DESC=>"Location of database folders"},
{OPT=>"db=s", VAR=>\$db, DEFAULT=>"resfinder", DESC=>"Database to use"},
Expand Down

0 comments on commit 3eff911

Please sign in to comment.