Example #1
0
def legacy_tetra_mpl_namespace(tmp_path, legacy_ani_namespace):
    """Namespace for legacy ANIm script tests.

    Uses the base namespace to run ANIm with mpl output
    """
    return modify_namespace(legacy_ani_namespace,
                            method="TETRA",
                            gmethod="mpl")
Example #2
0
def legacy_anim_mpl_namespace(tmp_path, legacy_ani_namespace):
    """Namespace for legacy ANIm script tests.

    Runs ANIm with matplotlib output
    """
    return modify_namespace(legacy_ani_namespace, gmethod="mpl")
Example #3
0
def legacy_anib_sns_namespace(tmp_path, legacy_ani_namespace):
    """Namespace for legacy ANIm script tests.

    Uses the base namespace to run ANIm with seaborn output
    """
    return modify_namespace(legacy_ani_namespace, method="ANIb")
Example #4
0
def kraken_namespace(base_download_namespace, tmp_path):
    """Namespace for downloading C. blochmannia with Kraken labels."""
    return modify_namespace(base_download_namespace,
                            kraken=True,
                            outdir=tmp_path / "kraken")
Example #5
0
def dryrun_namespace(base_download_namespace):
    """Namespace for pyani download dry run."""
    return modify_namespace(base_download_namespace, dryrun=True)
Example #6
0
    def setUp(self):
        """Configure parameters for tests."""
        testdir = Path("tests")
        self.testdirs = TestDirs(
            testdir / "test_output" / "legacy_scripts",
            testdir / "test_targets" / "legacy_scripts",
            testdir / "test_output" / "legacy_scripts" / "C_blochmannia",
        )
        self.testdirs.outdir.mkdir(exist_ok=True)
        self.exes = Executables("nucmer", "delta-filter", "blastn", "blastall",
                                "makeblastdb", "formatdb")

        # Base namespaces for each script
        self.base_download = Namespace(
            outdirname=self.testdirs.dldir,
            taxon="203804",
            verbose=False,
            force=True,
            noclobber=False,
            logfile=None,
            format="fasta",
            email="*****@*****.**",
            retries=20,
            batchsize=10000,
            timeout=10,
        )
        self.base_ani = Namespace(
            outdirname=self.testdirs.outdir /
            f"ANIm_seaborn_{anim.get_version()}",
            indirname=self.testdirs.dldir,
            verbose=False,
            force=True,
            fragsize=1020,
            logfile="test_ANIm.log",
            skip_nucmer=False,
            skip_blastn=False,
            noclobber=False,
            nocompress=False,
            graphics=True,
            gformat="pdf,png",
            gmethod="seaborn",
            labels=None,
            classes=None,
            method="ANIm",
            scheduler="multiprocessing",
            workers=None,
            sgeargs=None,
            sgegroupsize=10000,
            maxmatch=False,
            nucmer_exe=self.exes.nucmer,
            filter_exe=self.exes.filter,
            blastn_exe=self.exes.blastn,
            blastall_exe=self.exes.blastall,
            makeblastdb_exe=self.exes.makeblastdb,
            formatdb_exe=self.exes.formatdb,
            write_excel=False,
            rerender=False,
            subsample=None,
            seed=None,
            jobprefix="ANI",
        )

        # Null logger instance
        self.logger = logging.getLogger("TestLegacyScripts logger")
        self.logger.addHandler(logging.NullHandler())

        # Command-line namespaces
        self.argsdict = {
            "download":
            self.base_download,
            "anim_seaborn":
            self.base_ani,  #  Baseline namespace
            "anim_mpl":
            modify_namespace(
                self.base_ani,
                {
                    "outdirname":
                    self.testdirs.outdir / f"ANIm_mpl_{anim.get_version()}",
                    "gmethod": "mpl",
                },
            ),
            "anib_seaborn":
            modify_namespace(
                self.base_ani,
                {
                    "outdirname": self.testdirs.outdir / "ANIb_seaborn",
                    "method": "ANIb"
                },
            ),
            "anib_mpl":
            modify_namespace(
                self.base_ani,
                {
                    "outdirname": self.testdirs.outdir / "ANIb_mpl",
                    "gmethod": "mpl",
                    "method": "ANIb",
                },
            ),
            "tetra_seaborn":
            modify_namespace(
                self.base_ani,
                {
                    "outdirname": self.testdirs.outdir / "TETRA_seaborn",
                    "method": "TETRA",
                },
            ),
            "tetra_mpl":
            modify_namespace(
                self.base_ani,
                {
                    "outdirname": self.testdirs.outdir / "TETRA_mpl",
                    "gmethod": "mpl",
                    "method": "TETRA",
                },
            ),
        }