Пример #1
0
def main():
    config_file_path = cmdline_argv[1]
    config = load_config_json(config_file_path, GEXPFeatureDefConfig)

    logger.info("Building BigQuery service...")
    bigquery_service = build_bigquery_service()

    result = []
    for table_item in config.data_table_list:
        logger.info('GEXP table: \'' + table_item.table_name + '\'')
        query = build_feature_query(config, table_item.table_name)

        # Insert BigQuery job
        query_job = submit_query_async(bigquery_service, config.project_id, query)

        # Poll for completion of query
        job_id = query_job['jobReference']['jobId']
        logger.info('job_id = "' + str(job_id) + '\"')

        poll_async_job(bigquery_service, config, job_id)

        query_result = download_query_result(bigquery_service, query_job)
        rows = unpack_rows(query_result, table_item)
        result.extend(rows)

    write_tsv(config.output_csv_path, result, FIELDNAMES)
def main():
    config_file_path = cmdline_argv[1]
    config = load_config_json(config_file_path, MethylationFeatureDefConfig)

    logger.info("Building BigQuery service...")
    bigquery_service = build_bigquery_service()
    query = build_feature_query(config)

    # Insert BigQuery job
    query_job = submit_query_async(bigquery_service, config.project_id, query)

    # Poll for completion of query
    job_id = query_job['jobReference']['jobId']
    logger.info('job_id = "' + str(job_id) + '\"')

    poll_async_job(bigquery_service, config, job_id)

    query_result = download_query_result(bigquery_service, query_job)
    rows = unpack_rows(query_result, config.feature_id_prefix)

    write_tsv(config.output_csv_path, rows, FIELDNAMES)