22By: Isak Sylvin, @sylvinite"""
33
44#!/usr/bin/env python
5-
65import json
76import logging
87import os
2120 get_scoped_session_registry ,
2221 initialize_database ,
2322)
23+ from microSALT .store .db_manipulator import DB_Manipulator
2424from microSALT .utils .job_creator import Job_Creator
25- from microSALT .utils .pubmlst .get_credentials import main as get_bigsdb_credentials_main
25+ from microSALT .utils .pubmlst .get_credentials import get_bigsdb_access_token
2626from microSALT .utils .referencer import Referencer
2727from microSALT .utils .reporter import Reporter
2828from microSALT .utils .scraper import Scraper
@@ -298,9 +298,7 @@ def refer(ctx):
298298)
299299@click .option ("--output" , help = "Report output folder" , default = "" )
300300@pass_config
301- def finish (
302- config : MicroSALTConfig , sampleinfo_file , input , track , dry , email , skip_update , report , output
303- ):
301+ def finish (config : MicroSALTConfig , sampleinfo_file , input , track , dry , email , report , output ):
304302 """Sequence analysis, typing and resistance identification"""
305303 pool = []
306304 if email :
@@ -316,31 +314,12 @@ def finish(
316314 pool .append (subfolder )
317315
318316 sampleinfo = review_sampleinfo (sampleinfo_file )
319- ext_refs = Referencer (
320- log = logger ,
321- folders = config .folders ,
322- threshold = config .threshold ,
323- pubmlst = config .pubmlst ,
324- pasteur = config .pasteur ,
325- singularity = config .singularity ,
326- containers = config .containers ,
327- sampleinfo = sampleinfo ,
328- )
317+ db_manipulator = DB_Manipulator (log = logger , folders = config .folders , threshold = config .threshold )
329318 try :
330- ext_refs . db_access .check_ref_lock ()
319+ db_manipulator .check_ref_lock ()
331320 except RefUpdateLockError as e :
332- click .echo ("ERROR - {}" . format ( e ) )
321+ click .echo (f "ERROR - { e } " )
333322 click .Abort ()
334- click .echo ("INFO - Checking versions of references.." )
335- try :
336- if not skip_update :
337- ext_refs .identify_new (project = True )
338- ext_refs .update_refs ()
339- click .echo ("INFO - Version check done. Creating sbatch jobs" )
340- else :
341- click .echo ("INFO - Skipping version check." )
342- except Exception as e :
343- click .echo (f"{ e } " )
344323
345324 res_scraper = Scraper (
346325 log = logger ,
@@ -463,7 +442,7 @@ def report(config: MicroSALTConfig, sampleinfo_file, email, type, output, collec
463442@pass_config
464443def get_bigsdb_credentials (config : MicroSALTConfig , service , species ):
465444 """Obtain and store BIGSdb OAuth credentials for SERVICE (pubmlst or pasteur)"""
466- get_bigsdb_credentials_main (service , config , species )
445+ get_bigsdb_access_token (service , config , species )
467446
468447
469448@utils .command ()
0 commit comments