Esempio n. 1
0
def main():
    client = utils.get_mongo_client()
    db = utils.get_database(client, 'omni')
    path = 'data/TSO500_UniqueVariants_runs1-6.csv'
    # path = 'data/TSO500_UniqueVariants_4.csv'
    var_list = TSO500.read_tso_unique_variants(path)
    outF = open("data/decisions.tsv", "w")
    h = "gene\tcdot\tpdot\tgene_category\tmutation_type\treport_status\treasons\tlack_of_reasons\t" \
        "is_protein_altering\tin_clinvar\tis_clinvar_benign\tis_clinvar_pathogenic\tclinvar_explain\t" \
        "is_gain_of_function\tis_loss_of_function\thotspots\tpredicted_deleterious\tis_truncating_variants\tis_near_GOF_LOF_mutation\t" \
        "omni_gene\tomni_cdot\tomni_pdot"
    # print(h)
    outF.write(h)
    outF.write("\n")

    for index, variant in enumerate(var_list):
        key = get_key_from_variant(variant)
        annotated = get_annotated_snv(key, db)
        if not 'reasons' in annotated:
            annotated['reasons'] = []
        if not 'lack_of_reasons' in annotated:
            annotated['lack_of_reasons'] = []

        is_tso_snv_reportable(annotated)
        s = f"{annotated['gene']}\t{annotated['cdot']}\t{annotated['pdot']}\t{annotated['gene_category']}\t{annotated['mutation_type']}\t" \
            f"{annotated['report_status']}\t{annotated['reasons']}\t{annotated['lack_of_reasons']}\t" \
            f"{annotated['is_protein_altering']}\t{annotated['in_clinvar']}\t{annotated['is_clinvar_benign']}\t{annotated['is_clinvar_pathogenic']}\t{annotated['clinvar_explain']}\t" \
            f"{annotated['is_gain_of_function']}\t{annotated['is_loss_of_function']}\t{annotated['hotspots']}\t{annotated['predicted_deleterious']}\t" \
            f"{annotated['is_truncating_variants']}\t{annotated['is_near_GOF_LOF_mutation']}\t" \
            f"{annotated['HGNC_Symbol']}\t{annotated['omni_c_dot']}\t{annotated['omni_p_dot']}"
        # print(s)
        outF.write(s)
        outF.write("\n")
    outF.close()
Esempio n. 2
0
def main():
    empty_output_dir()
    client = utils.get_mongo_client()
    db = utils.get_database(client, 'omni')
    fake_id_dict = read_variants.read_fake_ids()
    disease_icd_dict = read_variants.read_disease_icd_dict()
    omni_to_jax_disease_dict = read_variants.read_omni_to_jax_disease_dict()
    disease_path_to_reportable_disease_dict = read_variants.read_omni_reportable_disease_name_dict(
    )
    variant_groups_dict = read_variants.read_variant_groups_dict()
    io_drug_dict = additional_io.get_io_drug_dict()
    patients = read_variants.read_immune_results_file(
        get_immune_results_file_path())
    read_variants.read_all_variants(patients, get_variant_file_path())
    read_variants.read_summary_interprations(patients, get_summary_file_path())
    strands = annotate.read_strands('data/strands.xlsx')
    num = 1
    with open('output/manifest.txt', "w") as file:
        for order_id in patients.keys():
            patient = patients[order_id]
            read_variants.add_patient_data(
                patient, fake_id_dict, disease_icd_dict,
                omni_to_jax_disease_dict,
                disease_path_to_reportable_disease_dict)

            handle_one_patient(patient, db, strands, variant_groups_dict,
                               io_drug_dict)
            # create_recommendations(patient,db)
            create_one_report(patient)
            out_string = generate_manifest_string(num, order_id, patient)
            print(out_string)
            # file.write(out_string)
            num += 1
def retrieve_all_player_ranks():
    mongo_client = get_mongo_client()
    database = mongo_client["tennis"]
    collection = database["player_ranks"]

    player_ranks = pd.DataFrame(list(collection.find({}, {'_id': False})))
    return player_ranks
def record_all_player_ranks(player_ranks):
    mongo_client = get_mongo_client()
    database = mongo_client["tennis"]
    collection = database["player_ranks"]

    # Remove previous ranks
    collection.remove()

    # Insert new ranks
    records = player_ranks.to_dict(orient='records')
    result = collection.insert_many(records)
    return result.acknowledged
Esempio n. 5
0
def main():
    client = utils.get_mongo_client()
    db = utils.get_database(client,'omni')
    path = 'data/TSO500_UniqueVariants_runs1-6.csv'
    # path = 'data/TSO500_UniqueVariants_4.csv'
    var_list = TSO500.read_tso_unique_variants(path)
    variants_to_analyze = []
    for index, variant in enumerate(var_list):
        key = get_key_from_variant(variant)
        annotated = get_annotated_snv(key,db)
        if annotated == None:
            variants_to_analyze.append(variant)
            if len(variants_to_analyze) >= 100:
                report_on_variants(db, variants_to_analyze)
                variants_to_analyze = []
    if len(variants_to_analyze)>0:
        report_on_variants(db, variants_to_analyze)
Esempio n. 6
0
def get_tournament_collection():
    mongo_client = get_mongo_client()
    database = mongo_client["tennis"]
    return database["tournaments"]
def get_matches_collection():
    mongo_client = get_mongo_client()
    database = mongo_client["tennis"]
    return database["matches"]
Esempio n. 8
0
def get_player_collection():
    mongo_client = get_mongo_client()
    database = mongo_client["tennis"]
    return database["players"]
Esempio n. 9
0
def get_country_collection():
    mongo_client = get_mongo_client()
    database = mongo_client["tennis"]
    return database["countries"]
Esempio n. 10
0
def get_log_collection():
    myclient = get_mongo_client()
    mydb = myclient["tennis"]
    return mydb["logs"]