Commit 020a8bff authored by Nicole Bussola's avatar Nicole Bussola
Browse files

concatenate layers dataframe

parent 5e27fb53
import pandas as pd
target = 'ER'
layer1 = 'gene'
layer2 = 'cnv'
layer3 = 'prot'
for split_id in range(10):
PATH = f'data/tcga_breast/{target}/{split_id}'
l1_l2_tr = pd.read_csv(f'{PATH}/{layer1}_{layer2}_tr.txt', sep='\t')
l1_l2_ts = pd.read_csv(f'{PATH}/{layer1}_{layer2}_ts.txt', sep='\t')
l3_tr = pd.read_csv(f'{PATH}/{layer3}_tr.txt', sep='\t')
l3_ts = pd.read_csv(f'{PATH}/{layer3}_ts.txt', sep='\t')
merged_tr = pd.merge(l1_l2_tr, l3_tr, on='Sample')
merged_ts = pd.merge(l1_l2_ts, l3_ts, on='Sample')
merged_tr.to_csv(f'{PATH}/{layer1}_{layer2}_{layer3}_tr.txt', sep='\t', index=False)
merged_ts.to_csv(f'{PATH}/{layer1}_{layer2}_{layer3}_ts.txt', sep='\t', index=False)
# %%
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment