def compute_regression(input_cancer_type):

    if input_cancer_type == "CCRCC":
        cancer = cptac.Ccrcc()
    elif input_cancer_type == "Endometrial":
        cancer = cptac.Endometrial()
    elif input_cancer_type == "LUAD":
        cancer = cptac.Luad()
    elif input_cancer_type == "HNSCC":
        cancer = cptac.Hnscc()
    elif input_cancer_type == "LSCC":
        cancer = cptac.Lscc()
    elif input_cancer_type == "PDAC":
        cancer = cptac.Pdac()

    df = dc.get_prot_trans_df(cancer)
    results = df.groupby('Gene').apply(regression)
    reg_df = pd.DataFrame(list(results))
    reg_df.index = results.index
    reg_df.reset_index(inplace=True)
    reg_df = reg_df.dropna()
    reg_df['interaction_FDR'] = ssm.fdrcorrection(
        reg_df['interaction_pval'])[1]
    reg_df['condition_FDR'] = ssm.fdrcorrection(reg_df['condition_pval'])[1]
    reg_df['intercept_FDR'] = ssm.fdrcorrection(reg_df['intercept_pval'])[1]
    reg_df['Cancer'] = [input_cancer_type] * len(reg_df)

    file_name = input_cancer_type + '_regressions.csv'
    reg_df.to_csv(file_name, index=False)
Exemple #2
0
def load_cancers(include_pdac=False):
    ccrcc = cptac.Ccrcc()
    en = cptac.Endometrial()
    luad = cptac.Luad()
    hnscc = cptac.Hnscc()
    lscc = cptac.Lscc()
    cancers = [ccrcc, en, luad, hnscc, lscc]
    cancer_names = ['CCRCC', 'Endometrial', 'LUAD', 'HNSCC', 'LSCC']
    if include_pdac:
        pdac = cptac.Pdac()
        cancers.append(pdac)
        cancer_names.append('PDAC')
    return cancers, cancer_names
input_cancer_type = sys.argv[1]
mutated_gene = sys.argv[2]
input_permutation_number = int(sys.argv[3])

cutoff = 15

if input_cancer_type == "CCRCC":
    cancer = cptac.Ccrcc()
elif input_cancer_type == "Endometrial":
    cancer = cptac.Endometrial()
    cutoff = 10
elif input_cancer_type == "LUAD":
    cancer = cptac.Luad()
elif input_cancer_type == "HNSCC":
    cancer = cptac.Hnscc()
elif input_cancer_type == "LSCC":
    cancer = cptac.Lscc()
elif input_cancer_type == "PDAC":
    cancer = cptac.Pdac()

mutation_df = cancer.get_somatic_mutation()
mutation_df = mutation_df[mutation_df.Gene == mutated_gene]
mutation_df = mutation_df[mutation_df.Mutation != 'Silent']
mutation_df = mutation_df[mutation_df.Mutation != 'RNA']
mutation_df = mutation_df[mutation_df.Mutation != 'synonymous SNV']
mutation_df.reset_index(inplace=True)
prot_trans_df = dc.get_prot_trans_df(cancer)
prot_trans_df = prot_trans_df[prot_trans_df.Tissue == 'tumor']
prot_trans_df['Mutation'] = prot_trans_df.Patient_ID.isin(
    mutation_df.Patient_ID)
    test_coord_1 = ((index_1, 1), (index_2, 1), (index_3, 1))  # C3N-01515
    test_vals_1 = ('No_Mutation', 'No_Mutation', 'No_Mutation')

    # Test Del
    test_coord_2 = ((index_4, 1), (index_5, 1), (index_6, 1))
    test_vals_2 = ('Deletion', 'Deletion', 'Deletion')
    # Test Amp
    test_coord_3 = ((index_7, 1), (index_8, 1), (index_9, 1))
    test_vals_3 = ('Amplification', 'Amplification', 'Amplification')

    test_coord_vals = [(test_coord_1, test_vals_1),
                       (test_coord_2, test_vals_2),
                       (test_coord_3, test_vals_3)]

    for coord, vals in test_coord_vals:
        PASS = check_getter(df, dimensions, headers, coord, vals)

    print_test_result(PASS)


k = cptac.Ccrcc()
g = cptac.Gbm()
h = cptac.Hnscc()

print("\nRunning tests:\n")
test_genotype_ccrcc_KRAS()
test_genotype_gbm_KRAS()
test_genotype_hnscc_KRAS()

print("Version:", cptac.version())
Exemple #5
0
import warnings

warnings.filterwarnings("ignore")

input_cancer_type = sys.argv[1]
if input_cancer_type == "ccrcc":
    ccrcc = cptac.Ccrcc()
    cancer_list = [ccrcc]
elif input_cancer_type == "en":
    en = cptac.Endometrial()
    cancer_list = [en]
elif input_cancer_type == "luad":
    luad = cptac.Luad()
    cancer_list = [luad]
elif input_cancer_type == "hnscc":
    hnscc = cptac.Hnscc()
    cancer_list = [hnscc]
elif input_cancer_type == "lscc":
    lscc = cptac.Lscc()
    cancer_list = [lscc]
# brca = cptac.Brca()
# ccrcc = cptac.Ccrcc()
# colon = cptac.Colon()
# en = cptac.Endometrial()
# gbm = cptac.Gbm()
# luad = cptac.Luad()
# ovarian = cptac.Ovarian()
# hnscc  = cptac.Hnscc()
# lscc = cptac.Lscc()

# type_dict = {brca:"brca",ccrcc:"ccrcc",colon:"colon",en:"endometrial",gbm:"gbm",luad:"luad",