def test_nisin_complete(self): with TemporaryDirectory() as output_dir: args = ["--minimal", "--enable-tta", "--tta-threshold", "0", "--output-dir", output_dir, helpers.get_path_to_nisin_genbank()] options = build_config(args, isolated=True, modules=antismash.get_all_modules()) antismash.run_antismash(helpers.get_path_to_nisin_genbank(), options) # regen the results update_config({"reuse_results": os.path.join(output_dir, "nisin.json")}) prior_results = read_data(None, options) record = prior_results.records[0] results = prior_results.results[0] tta_results = tta.regenerate_previous_results(results.get("antismash.modules.tta"), record, options) assert isinstance(tta_results, tta.TTAResults) assert len(tta_results.features) == 174 # raise the threshold above the gc_content and ensure regenned has no hits update_config({"tta_threshold": 0.65}) tta_results = tta.regenerate_previous_results(results.get("antismash.modules.tta"), record, options) assert isinstance(tta_results, tta.TTAResults) assert not tta_results.features
def setUp(self): self.config = build_config([ "--cf-create-clusters", "--cf-mean-threshold", "0.6", "--cf-min-cds", "5", "--cf-min-pfams", "5" ], modules=[clusterfinder], isolated=True) update_config({"enabled_cluster_types": []}) self.record = DummyRecord(seq=Seq("A" * 2000)) for start, end, probability, pfam_id in [(10, 20, 0.1, 'PF77777'), (30, 40, 0.3, 'PF00106'), (50, 60, 0.4, 'PF00107'), (60, 70, 0.7, 'PF00109'), (70, 80, 0.98, 'PF08484'), (90, 100, 0.8, 'PF02401'), (100, 110, 0.32, 'PF04369'), (110, 120, 1.0, 'PF00128'), (130, 140, 0.2, 'PF77776'), (500, 505, None, 'PF77775'), (1010, 1020, 0.1, 'PF77774'), (1030, 1040, 0.3, 'PF00106'), (1050, 1060, 0.4, 'PF00107'), (1060, 1070, 0.7, 'PF00109'), (1070, 1080, 0.98, 'PF08484'), (1090, 1100, 0.8, 'PF02401'), (1100, 1110, 0.32, 'PF04369'), (1110, 1120, 1.0, 'PF00128')]: location = FeatureLocation(start, end, strand=1) self.record.add_cds_feature( CDSFeature(location, locus_tag=str(start), translation="A")) pfam = PFAMDomain(location, "dummy_description", protein_start=start + 1, protein_end=end - 1, identifier=pfam_id, tool="test") pfam.domain_id = "pfam_%d" % start pfam.probability = probability self.record.add_pfam_domain(pfam)
def test_nisin_complete(self): with TemporaryDirectory() as output_dir: args = [ "--minimal", "--tta", "--output-dir", output_dir, helpers.get_path_to_nisin_genbank() ] options = build_config(args, isolated=True, modules=antismash.get_all_modules()) antismash.run_antismash(helpers.get_path_to_nisin_genbank(), options) # regen the results update_config( {"reuse_results": os.path.join(output_dir, "nisin.json")}) prior_results = read_data(None, options) record = prior_results.records[0] results = prior_results.results[0] regenned = regenerate_results_for_record(record, options, [tta], results) tta_results = regenned["antismash.modules.tta"] assert isinstance(tta_results, tta.TTAResults) assert len(tta_results.features) == 174
def setUp(self): class DummyModule: def __init__(self): self.was_run = False def get_arguments(self): args = config.args.ModuleArgs("genefinding", "genefinding") args.add_option("gff3", default="", type=str, help="dummy", dest="gff3") return args def run_on_record(self, *_args, **_kwargs): self.was_run = True self.genefinding = DummyModule() options = config.build_config(["--cpus", "1"], isolated=True, modules=[self.genefinding]) config.update_config({"triggered_limit": False}) self.options = options
def setUp(self): build_config([]) self.query_data = fasta.read_fasta( path.get_full_path(__file__, 'data', 'SCO_genes.fasta'))
def setUp(self): self.config = build_config(["--minimal", "--enable-thiopeptides", "--cpus", "1"], isolated=True, modules=antismash.get_all_modules())
def setUp(self): # skipping clusterhmmer and the p450 potential hits for speed self.options = build_config(["--minimal"], isolated=True, modules=antismash.get_all_modules())
def setup_options(self, args): return build_config(args, isolated=True, modules=antismash.get_all_modules())
def setUp(self): self.url = build_config([]).urls.docs_baseurl
def setUp(self): self.config = build_config(["--cf-create-clusters"], modules=[clusterfinder], isolated=True) self.record = DummyRecord()
def setUp(self): self.options = build_config(["--minimal", "--enable-lassopeptides"], isolated=True, modules=antismash.get_all_modules()) check_prereqs(self.options)
def setUp(self): config.build_config([], isolated=True)
def setUp(self): build_config([])
def setUp(self): self.temp_dir = TemporaryDirectory() self.config = build_config(self.get_args() + ["--out", self.temp_dir.name], isolated=True, modules=get_all_modules())
def test_check_prereqs(self): options = build_config(["--check-prereqs"], isolated=False, modules=get_all_modules()) assert run_antismash("", options) == 0
def setUp(self): build_config([], isolated=True, modules=get_all_modules())
def setUp(self): self.options = build_config(["--minimal", "--enable-lanthipeptides"], isolated=True, modules=antismash.get_all_modules()) self.set_fimo_enabled(True)
def setUp(self): self.options = build_config(["--minimal", "--enable-lanthipeptides"], isolated=True, modules=antismash.get_all_modules()) self.set_fimo_enabled(False) assert lanthi_config.get_config().fimo_present is False
def setUp(self): self.config_cpus = 2 build_config(["--cpus", str(self.config_cpus)]) assert get_config().executables assert get_config().cpus == 2
def setUp(self): self.options = build_config(["--minimal"], isolated=True, modules=antismash.get_all_modules()) assert not nrps_pks.is_enabled(self.options) self.tracker = minimock.TraceTracker() minimock.mock("nrps_pks.run_on_record", tracker=self.tracker)
def setUp(self): options = build_config(["--minimal", "--tta"], isolated=True, modules=antismash.get_all_modules()) self.old_config = get_config().__dict__ self.options = update_config(options)
def setUp(self): self.options = build_config(["--minimal", "--enable-nrps-pks"], isolated=True, modules=antismash.get_all_modules())
def setUp(self): self.options = build_config(["--minimal", "--rre-run"], isolated=True, modules=antismash.get_all_modules())
def setUp(self): self.config = build_config([]) self.rules_file = path.get_full_path(__file__, "..", "cluster_rules", "strict.txt") self.signature_file = path.get_full_path(__file__, "..", "data", "hmmdetails.txt") self.signature_names = { sig.name for sig in core.get_signature_profiles() } self.filter_file = path.get_full_path(__file__, "..", "filterhmmdetails.txt") self.results_by_id = { "GENE_1": [ FakeHSPHit("modelA", "GENE_1", 0, 10, 50, 0), FakeHSPHit("modelB", "GENE_1", 0, 10, 50, 0) ], "GENE_2": [ FakeHSPHit("modelC", "GENE_2", 0, 10, 50, 0), FakeHSPHit("modelB", "GENE_2", 0, 10, 50, 0) ], "GENE_3": [ FakeHSPHit("modelC", "GENE_3", 0, 10, 50, 0), FakeHSPHit("modelF", "GENE_3", 0, 10, 50, 0) ], "GENE_4": [ FakeHSPHit("modelA", "GENE_4", 0, 10, 50, 0), FakeHSPHit("modelE", "GENE_4", 0, 10, 50, 0) ], "GENE_5": [ FakeHSPHit("modelA", "GENE_5", 0, 10, 50, 0), FakeHSPHit("modelG", "GENE_5", 0, 10, 50, 0) ] } self.feature_by_id = { "GENE_1": DummyCDS(0, 30000, locus_tag="GENE_1"), "GENE_2": DummyCDS(30000, 50000, locus_tag="GENE_2"), "GENE_3": DummyCDS(70000, 90000, locus_tag="GENE_3"), "GENE_X": DummyCDS(95000, 100000, locus_tag="GENE_X"), # no hits "GENE_4": DummyCDS(125000, 140000, locus_tag="GENE_4"), "GENE_5": DummyCDS(130000, 150000, locus_tag="GENE_5") } self.test_names = { "modelA", "modelB", "modelC", "modelF", "modelG", "a", "b", "c", "d" } self.rules = rule_parser.Parser( "\n".join([ "RULE MetaboliteA CUTOFF 10 NEIGHBOURHOOD 5 CONDITIONS modelA", "RULE MetaboliteB CUTOFF 10 NEIGHBOURHOOD 5 CONDITIONS cds(modelA and modelB)", "RULE MetaboliteC CUTOFF 10 NEIGHBOURHOOD 5 CONDITIONS (modelA and modelB)", "RULE MetaboliteD CUTOFF 20 NEIGHBOURHOOD 5 CONDITIONS minimum(2,[modelC,modelB]) and modelA", "RULE Metabolite0 CUTOFF 1 NEIGHBOURHOOD 3 CONDITIONS modelF", "RULE Metabolite1 CUTOFF 1 NEIGHBOURHOOD 3 CONDITIONS modelG" ]), self.test_names).rules self.features = [] for gene_id in self.feature_by_id: self.features.append(self.feature_by_id[gene_id]) self.features.sort( key=lambda x: x.location.start) # vital for py3 < 3.5 self.record = Record() self.record._record.seq = Seq("A" * 150000) for feature in self.features: self.record.add_cds_feature(feature)
def setUp(self): self.tempdir = TemporaryDirectory(prefix="as_cassis") self.options = build_config( ["--cpus", "2", "--output-dir", self.tempdir.name], isolated=True, modules=[cassis])
def build_config(self, args): self.default_options = build_config(args, isolated=True, modules=get_all_modules()) self.default_options.all_enabled_modules = [] self.default_options.output_dir = self.temp_dir.name
def test_help_options(self): for option in ["--list-plugins"]: options = build_config([option], isolated=False, modules=self.all_modules) ret_val = main.run_antismash("", options) assert ret_val == 0
def setUp(self): self.options = build_config(["--sideload", GOOD_FILE], isolated=True, modules=antismash.main.get_all_modules())
def setUp(self): config.build_config({})
def setUp(self): options = build_config([], isolated=True, modules=get_all_modules()) self.old_config = get_config().__dict__ self.options = update_config(options)