Repository: widdowquinn/pyani

Issue:
TypeError: subcmd_index() missing 1 required positional argument: 'logger'
#### Summary:
I am trying to index my local fasta format genomes and it gives the error that 1 positional argument 'logger' is missing


#### Description:
I am doing pyANI analysis, I downloaded the script from github and its dependencies. While indexing my fasta files for subsequent scirpts. It give a postional error in the script.
**Script**
pyani index indir ../../genomes/

#### Reproducible Steps:
Downloading any fasta format file from NCBI
Establishing pyANI (pyani version: 0.3.0-alpha) and its dependencies
running the script as mentioned with the indir argument.
pyani index indir ../../genomes/

#### Current Output:
TypeError: subcmd_index() missing 1 required positional argument: 'logger'

#### Expected Output:
md5 index files from fasta


#### pyani Version:
(pyani version: 0.3.0-alpha)

#### installed dependencies
bioconda 

#### Python Version:
Python 3.8
#### Operating System:


Discussion:

Patch:
diff --git a/pyani/scripts/subcommands/subcmd_aniblastall.py b/pyani/scripts/subcommands/subcmd_aniblastall.py
index 4dedc73..f91208c 100644
--- a/pyani/scripts/subcommands/subcmd_aniblastall.py
+++ b/pyani/scripts/subcommands/subcmd_aniblastall.py
@@ -43,7 +43,7 @@ from argparse import Namespace
 from logging import Logger
 
 
-def subcmd_aniblastall(args: Namespace, logger: Logger):
+def subcmd_aniblastall(args: Namespace):
     """Perform ANIblastall on all genome files in an input directory.
 
     :param args:
diff --git a/pyani/scripts/subcommands/subcmd_index.py b/pyani/scripts/subcommands/subcmd_index.py
index 8d7560c..30c896b 100644
--- a/pyani/scripts/subcommands/subcmd_index.py
+++ b/pyani/scripts/subcommands/subcmd_index.py
@@ -39,15 +39,16 @@
 # THE SOFTWARE.
 """Provides the index subcommand for pyani."""
 
+import logging
+
 from argparse import Namespace
-from logging import Logger
 
 from Bio import SeqIO
 
 from pyani import download, pyani_files
 
 
-def subcmd_index(args: Namespace, logger: Logger) -> int:
+def subcmd_index(args: Namespace) -> int:
     """Generate a file with the MD5 hash for each genome in an input directory.
 
     :param args:  Namespace, received command-line arguments
@@ -58,6 +59,8 @@ def subcmd_index(args: Namespace, logger: Logger) -> int:
 
     Genome files (FASTA) are identified from the file extension.
     """
+    logger = logging.getLogger(__name__)
+
     # Get list of FASTA files in the input directory
     logger.info("Scanning directory %s for FASTA files", args.indir)
     fpaths = pyani_files.get_fasta_paths(args.indir)


Test patch:
diff --git a/tests/test_subcmd_02_index.py b/tests/test_subcmd_02_index.py
index 6486785..400c186 100644
--- a/tests/test_subcmd_02_index.py
+++ b/tests/test_subcmd_02_index.py
@@ -83,7 +83,7 @@ class TestIndexSubcommand(unittest.TestCase):
         """Test indexing of downloaded files."""
         # Create index
         print(self.argsdict["index"])
-        subcommands.subcmd_index(self.argsdict["index"], self.logger)
+        subcommands.subcmd_index(self.argsdict["index"])
 
         # Check class and label files
         for fname in ("labels.txt", "classes.txt"):