Skip to content

Commit

Permalink
Merge pull request #42 from jenna-tomkinson/add_main_figure_3
Browse files Browse the repository at this point in the history
Add main figure 3
  • Loading branch information
jenna-tomkinson authored Jun 3, 2024
2 parents f32b3d3 + df481ff commit c5be97d
Show file tree
Hide file tree
Showing 17 changed files with 4,371 additions and 31 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
1.train_models/classify_genotypes/data/nf1_model_pre_evaluation_results.parquet filter=lfs diff=lfs merge=lfs -text
2.evaluate_models/log_reg_plates_3_3p_5_cp_norm_data/model_eval_data/plate_precision_recall.parquet filter=lfs diff=lfs merge=lfs -text
2.evaluate_models/classify_genotypes/model_evaluation_data/precision_recall.parquet filter=lfs diff=lfs merge=lfs -text
1.train_models/classify_genotypes/model_data.parquet filter=lfs diff=lfs merge=lfs -text
1.train_models/classify_genotypes/data/nf1_eval_data.parquet filter=lfs diff=lfs merge=lfs -text
62 changes: 55 additions & 7 deletions 1.train_models/classify_genotypes/classify_genotypes.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,31 @@
},
"outputs": [],
"source": [
"plate5df_path = pathlib.Path(root_dir / \"nf1_painting_repo/3.processing_features/data/single_cell_profiles/Plate_5_sc_feature_selected.parquet\").resolve(strict=True)\n",
"plate3df_path = pathlib.Path(root_dir / \"nf1_painting_repo/3.processing_features/data/single_cell_profiles/Plate_3_sc_feature_selected.parquet\").resolve(strict=True)\n",
"plate3pdf_path = pathlib.Path(root_dir / \"nf1_painting_repo/3.processing_features/data/single_cell_profiles/Plate_3_prime_sc_feature_selected.parquet\").resolve(strict=True)\n",
"plate4df_path = pathlib.Path(root_dir / \"nf1_painting_repo/3.processing_features/data/single_cell_profiles/Plate_4_sc_feature_selected.parquet\").resolve(strict=True)\n",
"plate5df_path = pathlib.Path(\n",
" root_dir\n",
" / \"../nf1_cellpainting_data/3.processing_features/data/single_cell_profiles/Plate_5_sc_feature_selected.parquet\"\n",
").resolve(strict=True)\n",
"plate3df_path = pathlib.Path(\n",
" root_dir\n",
" / \"../nf1_cellpainting_data/3.processing_features/data/single_cell_profiles/Plate_3_sc_feature_selected.parquet\"\n",
").resolve(strict=True)\n",
"plate3pdf_path = pathlib.Path(\n",
" root_dir\n",
" / \"../nf1_cellpainting_data/3.processing_features/data/single_cell_profiles/Plate_3_prime_sc_feature_selected.parquet\"\n",
").resolve(strict=True)\n",
"plate4df_path = pathlib.Path(\n",
" root_dir\n",
" / \"../nf1_cellpainting_data/3.processing_features/data/single_cell_profiles/Plate_4_sc_feature_selected.parquet\"\n",
").resolve(strict=True)\n",
"\n",
"plate5df = pd.read_parquet(plate5df_path)\n",
"plate4df = pd.read_parquet(plate4df_path)\n",
"plate3df = pd.read_parquet(plate3df_path)\n",
"plate3pdf = pd.read_parquet(plate3pdf_path)\n",
"\n",
"# Correct Plate_3_prime plate column bug\n",
"plate3pdf[\"Metadata_Plate\"] = \"Plate_3_prime\"\n",
"\n",
"# Set the seed\n",
"rng = np.random.default_rng(0)"
]
Expand Down Expand Up @@ -368,11 +383,44 @@
"outputs": [],
"source": [
"# Columns common to all plates\n",
"plate_cols = list(set(plate5df.columns) & set(plate3df.columns) & set(plate3pdf.columns) & set(plate4df.columns))\n",
"plate_cols = list(\n",
" set(plate5df.columns)\n",
" & set(plate3df.columns)\n",
" & set(plate3pdf.columns)\n",
" & set(plate4df.columns)\n",
")\n",
"\n",
"restdf = pd.concat(\n",
" [\n",
" rest5df[plate_cols],\n",
" rest3df[plate_cols],\n",
" rest3pdf[plate_cols],\n",
" rest4df[plate_cols],\n",
" ],\n",
" ignore_index=True,\n",
").reset_index(drop=True)\n",
"\n",
"# Add Metadata_datasplit column to restdf\n",
"restdf = restdf.assign(datasplit='rest')\n",
"\n",
"testdf = pd.concat(\n",
" [\n",
" test5df[plate_cols],\n",
" test3df[plate_cols],\n",
" test3pdf[plate_cols],\n",
" test4df[plate_cols],\n",
" ],\n",
" ignore_index=True,\n",
").reset_index(drop=True)\n",
"\n",
"# Add Metadata_datasplit column to testdf\n",
"testdf = testdf.assign(datasplit='test')\n",
"\n",
"restdf = pd.concat([rest5df[plate_cols], rest3df[plate_cols], rest3pdf[plate_cols], rest4df[plate_cols]], ignore_index=True).reset_index(drop=True)\n",
"# Concatenate restdf and testdf vertically\n",
"model_df = pd.concat([restdf, testdf], ignore_index=True)\n",
"\n",
"testdf = pd.concat([test5df[plate_cols], test3df[plate_cols], test3pdf[plate_cols], test4df[plate_cols]], ignore_index=True).reset_index(drop=True)"
"# Save model data to apply the model for evaluation\n",
"model_df.to_parquet(\"./model_data.parquet\")"
]
},
{
Expand Down
3 changes: 3 additions & 0 deletions 1.train_models/classify_genotypes/data/nf1_eval_data.parquet
Git LFS file not shown
Loading

0 comments on commit c5be97d

Please sign in to comment.