@@ -46,17 +46,20 @@ def download_synapse_data(synID:str, save_path:str = None, synToken:str = None):
46
46
def create_crcpdo_drug_data (fitted_drug_data_path :str , prevDrugFilepath :str , output_drug_data_path :str ):
47
47
# import fitted drug data and get drug names from DRUG_NAME column
48
48
fitted_drug_df = pd .read_csv (fitted_drug_data_path )
49
- crcpdo_drugs_df = pd .DataFrame ({"DRUG_NAME " :fitted_drug_df ['DRUG_NAME' ].unique ()})
49
+ crcpdo_drugs_df = pd .DataFrame ({"chem_name " :fitted_drug_df ['DRUG_NAME' ].unique ()})
50
50
# if there is a prev drug file, check for new drugs
51
- if prevDrugFilepath != None and prevDrugFilepath != "" :
52
- prev_drug_df = pd .read_csv (prevDrugFilepath )
51
+ if prevDrugFilepath != "" :
52
+ if prevDrugFilepath .__contains__ (".tsv" ):
53
+ prev_drug_df = pd .read_csv (prevDrugFilepath , sep = '\t ' )
54
+ else :
55
+ prev_drug_df = pd .read_csv (prevDrugFilepath )
53
56
# get drugs that are only in the crcpdo_drugs_df (aka new drugs only)
54
57
new_drugs_df = crcpdo_drugs_df [~ crcpdo_drugs_df .chem_name .isin (prev_drug_df .chem_name )]
55
58
else :
56
59
# if there's no prev drugs, then all drugs are new
57
60
new_drugs_df = crcpdo_drugs_df
58
61
# get new drug names
59
- new_drug_names = new_drugs_df ['DRUG_NAME ' ].unique ()
62
+ new_drug_names = new_drugs_df ['chem_name ' ].unique ()
60
63
# call function that gets info for these drugs
61
64
update_dataframe_and_write_tsv (new_drug_names ,output_drug_data_path )
62
65
0 commit comments