@@ -46,17 +46,20 @@ def download_synapse_data(synID:str, save_path:str = None, synToken:str = None):
4646def create_crcpdo_drug_data (fitted_drug_data_path :str , prevDrugFilepath :str , output_drug_data_path :str ):
4747 # import fitted drug data and get drug names from DRUG_NAME column
4848 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 ()})
5050 # 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 )
5356 # get drugs that are only in the crcpdo_drugs_df (aka new drugs only)
5457 new_drugs_df = crcpdo_drugs_df [~ crcpdo_drugs_df .chem_name .isin (prev_drug_df .chem_name )]
5558 else :
5659 # if there's no prev drugs, then all drugs are new
5760 new_drugs_df = crcpdo_drugs_df
5861 # get new drug names
59- new_drug_names = new_drugs_df ['DRUG_NAME ' ].unique ()
62+ new_drug_names = new_drugs_df ['chem_name ' ].unique ()
6063 # call function that gets info for these drugs
6164 update_dataframe_and_write_tsv (new_drug_names ,output_drug_data_path )
6265
0 commit comments