# Path: exac.py
# ADMINISTRATORS = (
#     'exac.browser.errors@gmail.com',
# )
# DEPLOYMENT_ENVIRONMENT = os.getenv('DEPLOYMENT_ENV', 'development')
# MONGO_HOST = os.getenv('MONGO_HOST', 'mongo')
# MONGO_PORT = os.getenv('MONGO_PORT', 27017)
# MONGO_URL = 'mongodb://%s:%s' % (MONGO_HOST, MONGO_PORT)
#      EXOME_FILES_DIRECTORY = '/Users/msolomon/Projects/exacg/feb2017releasetestdata/170226/exomes/'
#      GENOME_FILES_DIRECTORY = '/Users/msolomon/Projects/exacg/feb2017releasetestdata/170226/genomes/'
#      EXOMES_SITES_VCFS = glob.glob(os.path.join(os.path.dirname(__file__), EXOME_FILES_DIRECTORY, 'gnomad.exomes.sites.X.vcf.bgz'))
#      GENOMES_SITES_VCFS = glob.glob(os.path.join(os.path.dirname(__file__), GENOME_FILES_DIRECTORY, 'gnomad.genomes.sites.coding.X.vcf.bgz'))
#     EXOME_FILES_DIRECTORY = '/var/data/loading_data/exomes'
#     GENOME_FILES_DIRECTORY = '/var/data/loading_data/genomes'
#     EXOMES_SITES_VCFS = glob.glob(os.path.join(os.path.dirname(__file__), EXOME_FILES_DIRECTORY, os.getenv('EXOMES_SINGLE_VCF')))
#     GENOMES_SITES_VCFS = glob.glob(os.path.join(os.path.dirname(__file__), GENOME_FILES_DIRECTORY, os.getenv('GENOMES_VCF_GLOB')))
#     EXOME_FILES_DIRECTORY = '/var/data/loading_data/exomes'
#     GENOME_FILES_DIRECTORY = '/var/data/loading_data/genomes'
#     EXOMES_SITES_VCFS = glob.glob(os.path.join(os.path.dirname(__file__), EXOME_FILES_DIRECTORY, os.getenv('EXOMES_SINGLE_VCF_TEST')))
#     GENOMES_SITES_VCFS = glob.glob(os.path.join(os.path.dirname(__file__), GENOME_FILES_DIRECTORY, os.getenv('GENOMES_VCF_GLOB_TEST')))
# SHARED_FILES_DIRECTORY = '../data/loading_data/shared_files'
# READ_VIZ_DIRECTORY = '../data/readviz'
# REGION_LIMIT = 1E5
# EXON_PADDING = 50
# GENE_CACHE_DIR = os.path.join(os.path.dirname(__file__), 'gene_cache')
# GENES_TO_CACHE = {l.strip('\n') for l in open(os.path.join(os.path.dirname(__file__), 'genes_to_cache.txt'))}
# def environment_test():
# def connect_db():
# def parse_tabix_file_subset(tabix_filenames, subset_i, subset_n, record_parser):
# def load_individual_coverage_files(coverage_files, collection):
#     def load_coverage(coverage_files, collection, i, n, db):
# def load_base_coverage_exomes():
# def load_base_coverage_genomes():
# def load_variants_in_file_using_tabix(sites_file, i, n, db_collection):
# def load_variants_single_vcf(sites_vcfs, collection_name):
#     def load_variants(sites_file, i, n, collection_name):
# def load_all_variants_in_file(sites_file, collection_name):
# def load_variants_chunks(sites_vcfs, collection_name):
# def load_variants(sites_vcfs, collection_name):
# def load_exome_variants():
# def load_genome_variants():
# def drop_exome_variants():
# def drop_genome_variants():
# def load_mnps():
# def load_constraint_information():
# def load_gene_models():
# def load_cnv_models():
# def drop_cnv_genes():
# def load_cnv_genes():
# def load_dbsnp_file():
#     def load_dbsnp(dbsnp_file, i, n, db):
# def load_db():
# def create_cache():
# def precalculate_metrics(variant_collection, metric_collection, chrom=None):
# def precalculate_metrics_exomes():
# def precalculate_metrics_genomes():
# def get_db():
# def homepage():
# def awesome_autocomplete(query):
# def awesome():
# def variant_data(variant_str, source):
# def variant_page(variant_str):
# def variant_api(variant_str):
# def get_gene_data(db, gene_id, gene, request_type, cache_key):
# def gene_page(gene_id):
# def gene_api(gene_id):
# def get_transcript_data(db, transcript_id, transcript, request_type, cache_key):
# def transcript_template(transcript_id):
# def transcript_api(transcript_id):
# def region_page(region_id):
# def region_json(region_id):
# def dbsnp_page(rsid):
# def dbsnp_json(rsid):
# def not_found_page(query):
# def error_page(query):
# def page_not_found(error):
# def downloads_page():
# def about_page():
# def participants_page():
# def terms_page():
# def contact_page():
# def faq_page():
# def loader_verification(path):
# def text_page():
# def read_viz_files(path):
# def report_variant(variant_id, dataset):
# def submit_variant_report():


from flask.ext.script import Manager
from exac import app
import exac
def load_db():
    exac.load_db()
#
#
# @manager.command
# def load_base_coverage():
#     exac.load_base_coverage()

@manager.command
def load_base_coverage_exomes():
    exac.load_base_coverage_exomes()

@manager.command
def load_base_coverage_genomes():
    exac.load_base_coverage_genomes()

@manager.command
def load_exome_variants():
    exac.load_exome_variants()

@manager.command
def load_genome_variants():
    exac.load_genome_variants()

@manager.command
def drop_exome_variants():
    exac.drop_exome_variants()

@manager.command
def drop_genome_variants():

# Path: exac.py
# ADMINISTRATORS = (
#     'exac.browser.errors@gmail.com',
# )
# DEPLOYMENT_ENVIRONMENT = os.getenv('DEPLOYMENT_ENV', 'development')
# MONGO_HOST = os.getenv('MONGO_HOST', 'mongo')
# MONGO_PORT = os.getenv('MONGO_PORT', 27017)
# MONGO_URL = 'mongodb://%s:%s' % (MONGO_HOST, MONGO_PORT)
#      EXOME_FILES_DIRECTORY = '/Users/msolomon/Projects/exacg/feb2017releasetestdata/170226/exomes/'
#      GENOME_FILES_DIRECTORY = '/Users/msolomon/Projects/exacg/feb2017releasetestdata/170226/genomes/'
#      EXOMES_SITES_VCFS = glob.glob(os.path.join(os.path.dirname(__file__), EXOME_FILES_DIRECTORY, 'gnomad.exomes.sites.X.vcf.bgz'))
#      GENOMES_SITES_VCFS = glob.glob(os.path.join(os.path.dirname(__file__), GENOME_FILES_DIRECTORY, 'gnomad.genomes.sites.coding.X.vcf.bgz'))
#     EXOME_FILES_DIRECTORY = '/var/data/loading_data/exomes'
#     GENOME_FILES_DIRECTORY = '/var/data/loading_data/genomes'
#     EXOMES_SITES_VCFS = glob.glob(os.path.join(os.path.dirname(__file__), EXOME_FILES_DIRECTORY, os.getenv('EXOMES_SINGLE_VCF')))
#     GENOMES_SITES_VCFS = glob.glob(os.path.join(os.path.dirname(__file__), GENOME_FILES_DIRECTORY, os.getenv('GENOMES_VCF_GLOB')))
#     EXOME_FILES_DIRECTORY = '/var/data/loading_data/exomes'
#     GENOME_FILES_DIRECTORY = '/var/data/loading_data/genomes'
#     EXOMES_SITES_VCFS = glob.glob(os.path.join(os.path.dirname(__file__), EXOME_FILES_DIRECTORY, os.getenv('EXOMES_SINGLE_VCF_TEST')))
#     GENOMES_SITES_VCFS = glob.glob(os.path.join(os.path.dirname(__file__), GENOME_FILES_DIRECTORY, os.getenv('GENOMES_VCF_GLOB_TEST')))
# SHARED_FILES_DIRECTORY = '../data/loading_data/shared_files'
# READ_VIZ_DIRECTORY = '../data/readviz'
# REGION_LIMIT = 1E5
# EXON_PADDING = 50
# GENE_CACHE_DIR = os.path.join(os.path.dirname(__file__), 'gene_cache')
# GENES_TO_CACHE = {l.strip('\n') for l in open(os.path.join(os.path.dirname(__file__), 'genes_to_cache.txt'))}
# def environment_test():
# def connect_db():
# def parse_tabix_file_subset(tabix_filenames, subset_i, subset_n, record_parser):
# def load_individual_coverage_files(coverage_files, collection):
#     def load_coverage(coverage_files, collection, i, n, db):
# def load_base_coverage_exomes():
# def load_base_coverage_genomes():
# def load_variants_in_file_using_tabix(sites_file, i, n, db_collection):
# def load_variants_single_vcf(sites_vcfs, collection_name):
#     def load_variants(sites_file, i, n, collection_name):
# def load_all_variants_in_file(sites_file, collection_name):
# def load_variants_chunks(sites_vcfs, collection_name):
# def load_variants(sites_vcfs, collection_name):
# def load_exome_variants():
# def load_genome_variants():
# def drop_exome_variants():
# def drop_genome_variants():
# def load_mnps():
# def load_constraint_information():
# def load_gene_models():
# def load_cnv_models():
# def drop_cnv_genes():
# def load_cnv_genes():
# def load_dbsnp_file():
#     def load_dbsnp(dbsnp_file, i, n, db):
# def load_db():
# def create_cache():
# def precalculate_metrics(variant_collection, metric_collection, chrom=None):
# def precalculate_metrics_exomes():
# def precalculate_metrics_genomes():
# def get_db():
# def homepage():
# def awesome_autocomplete(query):
# def awesome():
# def variant_data(variant_str, source):
# def variant_page(variant_str):
# def variant_api(variant_str):
# def get_gene_data(db, gene_id, gene, request_type, cache_key):
# def gene_page(gene_id):
# def gene_api(gene_id):
# def get_transcript_data(db, transcript_id, transcript, request_type, cache_key):
# def transcript_template(transcript_id):
# def transcript_api(transcript_id):
# def region_page(region_id):
# def region_json(region_id):
# def dbsnp_page(rsid):
# def dbsnp_json(rsid):
# def not_found_page(query):
# def error_page(query):
# def page_not_found(error):
# def downloads_page():
# def about_page():
# def participants_page():
# def terms_page():
# def contact_page():
# def faq_page():
# def loader_verification(path):
# def text_page():
# def read_viz_files(path):
# def report_variant(variant_id, dataset):
# def submit_variant_report():


# Path: manage.py
from flask.ext.script import Manager
from exac import app
import exac

def load_db():
    exac.load_db()
#
#
# @manager.command
# def load_base_coverage():
#     exac.load_base_coverage()

@manager.command
def load_base_coverage_exomes():
    exac.load_base_coverage_exomes()

@manager.command
def load_base_coverage_genomes():
    exac.load_base_coverage_genomes()

@manager.command
def load_exome_variants():
    exac.load_exome_variants()

@manager.command
def load_genome_variants():
    exac.load_genome_variants()

@manager.command
def drop_exome_variants():
    exac.drop_exome_variants()

@manager.command
def drop_genome_variants():

    exac.drop_genome_variants()