def post(self): """Load a case into Scout.""" variant_threshold = request.form.get('variant_threshold', 5000) variant_type = request.form.get('variant_type', 'clinical') vcf_config = (request.form.get('vcf_config') or current_app.config['SCOUT_VCF_CONFIG']) mongo_info = current_app.config['SCOUT_MONGODB_SETTINGS'] mongo_auth = {} for key, value in iteritems(mongo_info): if key == 'db': mongo_auth['mongo_db'] = value else: mongo_auth[key] = value scout_config_path = request.form['scout_config'] scout_config = ConfigParser(scout_config_path) load_mongo_db(scout_config, vcf_config, variant_type=variant_type, variant_number_threshold=variant_threshold, **mongo_auth) return jsonify(success=True)
def load_case( self, scout_config_path, variant_type="clinical", vcf_config=None, variant_threshold=5000, mongo_auth=None ): """Load a case into Scout.""" vcf_config = vcf_config or self.config["scout"]["vcf_config"] if mongo_auth is None: # adapt to scout input mongo_info = self.config["scout"]["auth"] mongo_auth = {} for key, value in iteritems(mongo_info): if key == "db": mongo_auth["mongo_db"] = value else: mongo_auth[key] = value scout_config = ConfigParser(scout_config_path) vcf = load_mongo_db( scout_config, vcf_config, variant_type=variant_type, variant_number_threshold=variant_threshold, **mongo_auth ) return vcf
def load(vcf_file, ped_file, scout_config_file, vcf_config_file, family_type, mongo_db, username, variant_type, madeline, coverage_report, password, owner, port, host, verbose, rank_score_threshold, variant_number_threshold): """ Load the mongo database. Command line arguments will override what's in the config file. """ # Check if vcf file exists and that it has the correct naming: logger = logging.getLogger(__name__) scout_configs = {} scout_validation_file = os.path.join(BASE_PATH, 'config_spec/scout_config.ini') logger.info("Running load_mongo") if scout_config_file: scout_configs = ConfigParser(scout_config_file, configspec=scout_validation_file) logger.info("Using scout config file {0}".format(scout_config_file)) if vcf_file: scout_configs['load_vcf'] = vcf_file logger.info("Using command line specified vcf {0}".format(vcf_file)) scout_configs['igv_vcf'] = vcf_file if ped_file: logger.info( "Using command line specified ped file {0}".format(ped_file)) scout_configs['ped'] = ped_file if madeline: logger.info( "Using command line specified madeline file {0}".format(madeline)) scout_configs['madeline'] = madeline if coverage_report: logger.info("Using command line specified coverage report {0}".format( coverage_report)) scout_configs['coverage_report'] = coverage_report if owner: logger.info("Using command line specified owner {0}".format(institute)) scout_configs['owner'] = owner if not scout_configs.get('load_vcf', None): logger.warning( "Please provide a vcf file.(Use flag '-vcf/--vcf_file')") sys.exit(0) # Check that the ped file is provided: if not scout_configs.get('ped', None): logger.warning( "Please provide a ped file.(Use flag '-ped/--ped_file')") sys.exit(0) # Check that the config file is provided: if not vcf_config_file: logger.warning( "Please provide a vcf config file.(Use flag '-config/--config_file')" ) sys.exit(0) my_vcf = load_mongo_db(scout_configs, vcf_config_file, family_type, mongo_db=mongo_db, username=username, password=password, variant_type=variant_type, port=port, host=host, rank_score_threshold=rank_score_threshold, variant_number_threshold=variant_number_threshold)