# Path: diagnostic_primers/config.py
# class ConfigSyntaxError(Exception):
# class PDPCollectionException(PDPException):
# class PDPEncoder(json.JSONEncoder):
# class PDPCollection(object):
# class PDPData(object):
#     def __init__(self, message):
#     def __init__(self, msg="Problem with PDPCollection"):
#     def default(self, obj):
#     def __init__(self, name="pdp.py"):
#     def from_tab(self, filename):
#     def from_json(self, filename):
#     def add_data(
#         self,
#         name=None,
#         groups=None,
#         seqfile=None,
#         filtered_seqfile=None,
#         features=None,
#         primers=None,
#         primersearch=None,
#         target_amplicons=None,
#     ):
#     def write_json(self, outfilename):
#     def write_tab(self, outfilename):
#     def __parse_row(row):
#     def data(self):
#     def groups(self):
#     def get_groupmembers(self, val):
#     def __getitem__(self, key):
#     def __len__(self):
#     def __init__(
#         self,
#         name,
#         groups,
#         seqfile,
#         filtered_seqfile,
#         features,
#         primers,
#         primersearch,
#         target_amplicons,
#     ):
#     def stitch(self, outdir=None):
#     def replace_ambiguities(self, outdir=None):
#     def create_filtered_genome(self, filteredpath, spacerlen, suffix, flanklen=0):
#     def write_primers(self, outfilename, fmt="fasta"):
#     def name(self):
#     def name(self, value):
#     def groups(self):
#     def groups(self, value):
#     def seqfile(self):
#     def seqfile(self, value):
#     def target_amplicons(self):
#     def target_amplicons(self, value):
#     def filtered_seqfile(self):
#     def filtered_seqfile(self, value):
#     def filestem(self):
#     def features(self):
#     def features(self, value):
#     def primers(self):
#     def primers(self, value):
#     def primersearch(self):
#     def primersearch(self, value):
#     def seqnames(self):
#     def needs_stitch(self):
#     def has_ambiguities(self):
# 
# Path: diagnostic_primers/blast.py
# def build_commands(collection, blastexe, blastdb, outdir=None, existingfiles=[]):
# def build_blastscreen_cmd(queryfile, blastexe, blastdb, outdir=None):
# def apply_screen(blastfile, primerjson, jsondir=None, maxaln=15):
# def parse_blasttab(fhandle):


import os
import subprocess
import shlex
import shutil
from diagnostic_primers import config, blast
from tools import PDPTestCase
        cmd = blast.build_blastscreen_cmd(
            self.primerfile, self.blastexe, self.screendb, self.outdir
        )
        testcmd = " ".join(
            [
                "blastn",
                "-out",
                os.path.join(self.outdir, "primers.blasttab"),
                "-outfmt",
                "6",
                "-query",
                self.primerfile,
                "-db",
                self.screendb,
                "-max_target_seqs",
                "1",
                "-task",
                "blastn-short",
                "-perc_identity",
                "90",
                "-ungapped",
            ]
        )
        # We must test the string representation of the NcbiblastnCommandline
        self.assertEqual(str(cmd), testcmd)

    def test_blastscreen_cmds(self):
        """BLASTN primer screening command lines build without error."""
        pdpc = config.PDPCollection()
        pdpc.from_json(self.config)

# Path: diagnostic_primers/config.py
# class ConfigSyntaxError(Exception):
# class PDPCollectionException(PDPException):
# class PDPEncoder(json.JSONEncoder):
# class PDPCollection(object):
# class PDPData(object):
#     def __init__(self, message):
#     def __init__(self, msg="Problem with PDPCollection"):
#     def default(self, obj):
#     def __init__(self, name="pdp.py"):
#     def from_tab(self, filename):
#     def from_json(self, filename):
#     def add_data(
#         self,
#         name=None,
#         groups=None,
#         seqfile=None,
#         filtered_seqfile=None,
#         features=None,
#         primers=None,
#         primersearch=None,
#         target_amplicons=None,
#     ):
#     def write_json(self, outfilename):
#     def write_tab(self, outfilename):
#     def __parse_row(row):
#     def data(self):
#     def groups(self):
#     def get_groupmembers(self, val):
#     def __getitem__(self, key):
#     def __len__(self):
#     def __init__(
#         self,
#         name,
#         groups,
#         seqfile,
#         filtered_seqfile,
#         features,
#         primers,
#         primersearch,
#         target_amplicons,
#     ):
#     def stitch(self, outdir=None):
#     def replace_ambiguities(self, outdir=None):
#     def create_filtered_genome(self, filteredpath, spacerlen, suffix, flanklen=0):
#     def write_primers(self, outfilename, fmt="fasta"):
#     def name(self):
#     def name(self, value):
#     def groups(self):
#     def groups(self, value):
#     def seqfile(self):
#     def seqfile(self, value):
#     def target_amplicons(self):
#     def target_amplicons(self, value):
#     def filtered_seqfile(self):
#     def filtered_seqfile(self, value):
#     def filestem(self):
#     def features(self):
#     def features(self, value):
#     def primers(self):
#     def primers(self, value):
#     def primersearch(self):
#     def primersearch(self, value):
#     def seqnames(self):
#     def needs_stitch(self):
#     def has_ambiguities(self):
# 
# Path: diagnostic_primers/blast.py
# def build_commands(collection, blastexe, blastdb, outdir=None, existingfiles=[]):
# def build_blastscreen_cmd(queryfile, blastexe, blastdb, outdir=None):
# def apply_screen(blastfile, primerjson, jsondir=None, maxaln=15):
# def parse_blasttab(fhandle):


# Path: tests/test_blast.py
import os
import subprocess
import shlex
import shutil
from diagnostic_primers import config, blast
from tools import PDPTestCase

        cmd = blast.build_blastscreen_cmd(
            self.primerfile, self.blastexe, self.screendb, self.outdir
        )
        testcmd = " ".join(
            [
                "blastn",
                "-out",
                os.path.join(self.outdir, "primers.blasttab"),
                "-outfmt",
                "6",
                "-query",
                self.primerfile,
                "-db",
                self.screendb,
                "-max_target_seqs",
                "1",
                "-task",
                "blastn-short",
                "-perc_identity",
                "90",
                "-ungapped",
            ]
        )
        # We must test the string representation of the NcbiblastnCommandline
        self.assertEqual(str(cmd), testcmd)

    def test_blastscreen_cmds(self):
        """BLASTN primer screening command lines build without error."""
        pdpc = config.PDPCollection()
        pdpc.from_json(self.config)

        blast.build_commands(pdpc, self.blastexe, self.screendb, self.outdir)