PerturbReason/PerturbReason_dataset_code
012
1# PerturbReason2 3## Data generation4 5### PerturbQA_v2 based on PerturBench (PB)6 7- CREATE:8 - src/data_perturbqa_pb.py | get_perturbation_pairs9 - src/data_perturbqa_pb.py | add_chemical_properties_to_perturbation_pairs10- GET: 11 - src/data_perturbqa_pb.py | get_perturbation_pair_df12 13 14### drug_split_labels_v0112.json / gene_split_train_v0112.json / gene_split_ood_test_v0112.json15 16- _1_create_hetero_graph.py17- _2.2_create_gene_cluster.py18- _3.2.1_ood_split_new.py19 - VERSION = None20 - VERSION = "v0112"21 22### PerturbQA_plus23 24#### Basal 25 26- `python data_perturbqa_control.py --MODE create_dataset_to_cell_type_to_gene_to_control_expr `27- `python data_perturbqa_control.py --MODE calculate_stat_to_expression`28 - basic stats29- `python data_basal_stats.py --MODE add_adaptive_stat_to_expression `30 - ks_thr_gt, u_ks_thr_gt, active_9031 - cdf visualization32- `python data_basal_stats.py --MODE predict_and_save_unseen_cell_ks_thr_u_ks_thr_from_dir `33 - Add predicted ks_thr, u_ks_thr for ood cells34 35#### vanilla36 37- `python data_perturbqa_plus.py --MODE save_jsonl`38 - cf. `python data_perturbqa_pb.py --MODE load_perturbqa_pb_chemical_jsonl`39 - cf. `python data_perturbqa_pb.py --MODE load_perturbqa_genetic_jsonl`40 - cf. `python data_perturbqa_pb.py --MODE load_perturbqa_pb_genetic_special_jsonl`41 42##### vanilla - RNv343- `python data_rn_from_adata.py --MODE get_perturbation_pairs_for_rn_from_adata `44 - generates *csv for RNv3 at `OMICS_DATA/PerturbQA_v2`45- `python data_perturbqa_plus.py --MODE save_geneticRN_with_existing_pert_split_jsonl `46 - generates vanilla geneticRNv3* jsonl47 - cf. `python data_rn_from_adata.py --MODE load_perturbqa_geneticRN_jsonl `48 49#### vanilla - Demeo2550- python data_perturbqa_gene2chem.py --MODE get_perturbation_pairs_for_gene2chem_from_adata51- python data_perturbqa_gene2chem.py --MODE load_perturbqa_gene2chem_jsonl52- python data_perturbqa_plus.py --MODE save_gene2chem_jsonl53 54##### vanilla - vanilla_with_basal55- [finalize vanilla] `python data_generate_finalize_vanilla.py --MODE finalize_all_vanilla_jsonl`56 - generates `PerturbQA_plus/v0205/vanilla_with_basal`57 - cf. `python data_generate_finalize_vanilla.py --MODE save_refactor_vanilla_and_add_basal `58 59#### reasoning_multi_path60 61- `python data_generate_flow_trajectory_mp.py -jp "*.jsonl"`62 - generates `PerturbQA_plus/v0205/reasoning_multi_path`63- `python data_generate_flow_indra.py --MODE match_triplets_with_indra_for_jsonl_dir --reasoning_subdir reasoning_multi_path_mp `64 - generate `PerturbQA_plus/v0205/reasoning_multi_path_indra/indra_subetwork_meta_evs_exact_regardless_filtered`65- verdict & filtering based on verdicts66 - (1) llm-based (deprecated)67 - [prompt cache] ...68 - [verdict (multi-processing)] `python data_generate_prompt_out.py --prompt_type verdict_pathway_thk_v4`69 - generates `PerturbQA_plus/v0205/verdict_pathway_thk_v4/verdict_pathway_thk_v4_cell_conditioned_bfs_footer/qwen3-4b-ins_bf16`70 - [verdict (merge)] `python data_generate_clean.py --MODE finalize_files --prompt_type verdict_pathway_thk_v4 --ordering bfs --is_real_mode yes --pattern "*.jsonl"`71 - merges files in `PerturbQA_plus/v0205/verdict_pathway_thk_v4/verdict_pathway_thk_v4_cell_conditioned_bfs_footer/qwen3-4b-ins_bf16`72 - [file ready] `python data_generate_clean.py --MODE filter_path_by_verdict_llm --prompt_type verdict_pathway_thk_v4`73 - generates `PerturbQA_plus/v0205/reasoning_multi_path_indra/filtered_by_verdict_llm`74 - (2) sign-based v275 - [filtered path as verdict v2] `python data_generate_sign_reach.py --prompt_type verdict_pathway_thk_v4 --model_name sign_reach --reachable t0+t1_v2 --t0_max_ambiguous_edges 1 --t1_stat_low ks_thr --t1_stat_high u_ks_thr --t1_max_ambiguous_edges 1`76 - generates `PerturbQA_plus/v0205/verdict_pathway_thk_v4/verdict_pathway_thk_v4_sign_reach/t0+t1_v2_1_1_ks_thr_u_ks_thr`77 - [file ready v2] `python data_generate_clean.py --MODE filter_path_by_reachable_paths --prompt_type verdict_pathway_thk_v4 --model_name sign_reach --reachable t0+t1_v2 --t0_max_ambiguous_edges 1 --t1_stat_low ks_thr --t1_stat_high u_ks_thr --t1_max_ambiguous_edges 1`78 - generates `PerturbQA_plus/v0205/reasoning_multi_path_indra/filtered_by_t0+t1_v2_1_1_ks_thr_u_ks_thr`79 - (3) sign-based RNv380 - [filtered path as verdict RNv3] `python data_generate_sign_reach.py --input_dir_parent ../OMICS_DATA/PerturbQA_plus/v0205/reasoning_multi_path_mp_indra/ --prompt_type verdict_pathway_thk_v4 --model_name sign_reach --reachable t0+t1_RNv3 --t0_max_ambiguous_edges 1 --t1_stat_low ks_thr --t1_stat_high u_ks_thr --t1_max_ambiguous_edges 1 `81 - generates `PerturbQA_plus/v0205/verdict_pathway_thk_v4/verdict_pathway_thk_v4_sign_reach/t0+t1_RNv3_1_1_ks_thr_u_ks_thr`82 - [file ready RNv3] `python data_generate_clean.py --MODE filter_path_by_reachable_paths --input_dir_parent ../OMICS_DATA/PerturbQA_plus/v0205/reasoning_multi_path_mp_indra/ --prompt_type verdict_pathway_thk_v4 --model_name sign_reach --reachable t0+t1_RNv3 --t0_max_ambiguous_edges 1 --t1_stat_low ks_thr --t1_stat_high u_ks_thr --t1_max_ambiguous_edges 1 `83 - generates `PerturbQA_plus/v0205/reasoning_multi_path_mp_indra/filtered_by_t0+t1_RNv3_1_1_ks_thr_u_ks_thr`84 85#### Reasoning Texts86 87- [prompt cache] `python data_generate_prompt_out.py --return_early_for_cache_prompt True --input_dir_parent ../OMICS_DATA/PerturbQA_plus/v0205/reasoning_multi_path_mp_indra/ --prompt_type reasoning_text --input_dir_name filtered_by_t0+t1_RNv3_1_1_ks_thr_u_ks_thr --t1_stat_low ks_thr --t1_stat_high u_ks_thr --pattern "*cell_id*pert_train*_o.jsonl" `88 - generates `PerturbQA_plus/v0205/reasoning_text_filtered_by_t0+t1_RNv3_1_1_ks_thr_u_ks_thr/reasoning_text_cell_conditioned_flat_bfs/format_prompt_all`89- [reasoning texts (multi-runs)] `python data_generate_prompt_out.py --input_dir_parent ../OMICS_DATA/PerturbQA_plus/v0205/reasoning_multi_path_mp_indra/ --prompt_type reasoning_text --input_dir_name filtered_by_t0+t1_RNv3_1_1_ks_thr_u_ks_thr --pattern "*cell_id*pert_train*_o.jsonl" `90- [reasoning texts (merge)] `python data_generate_clean.py --MODE finalize_files --input_dir_parent ../OMICS_DATA/PerturbQA_plus/v0205/reasoning_multi_path_mp_indra/ --prompt_type reasoning_text --input_dir_name filtered_by_t0+t1_RNv3_1_1_ks_thr_u_ks_thr --is_real_mode yes --pattern "*RNv3*cell_id*pert_train*_o.jsonl" `91 - generates `PerturbQA_plus/v0205/reasoning_text_filtered_by_t0+t1_RNv3_1_1_ks_thr_u_ks_thr/reasoning_text_cell_conditioned_flat_bfs/qwen3-4b-ins_bf16`92- [finalize reasoning texts (merge triplets & filter by keywords | relocate test sets)] `python data_generate_finalize_reasoning.py --MODE finalize_all_train_valid_test_jsonl `93 - generates `PerturbQA_plus/v0205/reasoning_text_filtered_by_t0+t1_RNv3_1_1_ks_thr_u_ks_thr/reasoning_text_cell_conditioned_flat_bfs/qwen3-4b-ins_bf16_finalized_max3k_per_cell`94 95#### Task reformulation96- [generates 3way] `python data_to_3way.py ` # TODO: refactoring this section97 - generates task_3ways in `PerturbQA_plus/v0205/reasoning_text_filtered_by_t0+t1_RNv3_1_1_ks_thr_u_ks_thr`98 - [Deprecate triplet-related paths] generates task_3ways in `PerturbQA_plus/v0205/reasoning_multi_path_indra/filtered_by_t0+t1_RNv3_1_1_ks_thr_u_ks_thr`99 100#### Relation cleaning101- ` python data_relation_disambig.py --remove_conflicts_and_mistakes True --pattern "*jsonl" `102- ` python data_generate_finalize_disambig.py `103 104#### Utils105- [ask finished] `python data_generate_clean.py --MODE ask_finished --input_dir_parent ../OMICS_DATA/PerturbQA_plus/v0205/reasoning_multi_path_mp_indra/ --prompt_type reasoning_text --input_dir_name filtered_by_t0+t1_RNv3_1_1_ks_thr_u_ks_thr --pattern "*RNv3*cell_id*pert_train*_o.jsonl" `106- [stats visualize] `python data_stat_analysis.py --MODE jsonl_dir_to_value_stats_by_keys `107 108#### Model training109- [train SFT] `bash src/sh_model_sft_v2.sh`110 111#### Model Inference & Evaluation112 113- ` python model_inference.py --merge_file_all; python out_answer_eval_compute.py --MODE ours --our_model_pattern "*sft*_all_*_CoT_*" --sleep 0; python out_answer_eval_aggr.py --our_model_pattern "*sft*" `114 - `python model_inference.py --merge_file_all `115 - merges mp inferences jsonls116 - `python out_answer_eval_compute.py --MODE ours --our_model_pattern "*sft*" --sleep 0 `117 - `python out_answer_eval_aggr.py --our_model_pattern "*sft_v4.0*" `118- ` python out_answer_eval_analysis_comprehensive_v2.py `119- ` python out_answer_eval_analysis_vs_stat.py --our_model_pattern "*sft_v4.0*" `120- ` python out_triplet_eval_analysis_sample.py --pipeline del_csv_vis `