This repository has been archived by the owner on Feb 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
252 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,252 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import numpy as np\n", | ||
"import pandas as pd\n", | ||
"import pciSeq\n", | ||
"import tifffile as tf" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"label_image = tf.imread(\"../data/strip_of_tissue/mask/Base_1_stitched-1.tif.segmented.compressed.tif\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 6, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"label_image -= 1" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 11, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"label_image = label_image.reshape(label_image.shape[-2:])" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 12, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"(26107, 38994)" | ||
] | ||
}, | ||
"execution_count": 12, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"label_image.shape" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 40, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stderr", | ||
"output_type": "stream", | ||
"text": [ | ||
"/home/gire/anaconda3/lib/python3.7/site-packages/IPython/core/interactiveshell.py:3063: DtypeWarning: Columns (15) have mixed types.Specify dtype option on import or set low_memory=False.\n", | ||
" interactivity=interactivity, compiler=compiler, result=result)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"coords_list = []\n", | ||
"for i in range(28, 35):\n", | ||
" spots_df = pd.read_csv(f\"../data/strip_of_tissue/dw/spots_DW.fov_{i:03d}.csv.gz\", sep=\"\\t\")\n", | ||
" coords_list.append(spots_df.loc[spots_df[\"target\"].values.astype(\"S\") != b'nan', (\"target\", \"xc\", \"yc\")])" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 42, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"spots_df = pd.concat(coords_list)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 39, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/html": [ | ||
"<div>\n", | ||
"<style scoped>\n", | ||
" .dataframe tbody tr th:only-of-type {\n", | ||
" vertical-align: middle;\n", | ||
" }\n", | ||
"\n", | ||
" .dataframe tbody tr th {\n", | ||
" vertical-align: top;\n", | ||
" }\n", | ||
"\n", | ||
" .dataframe thead th {\n", | ||
" text-align: right;\n", | ||
" }\n", | ||
"</style>\n", | ||
"<table border=\"1\" class=\"dataframe\">\n", | ||
" <thead>\n", | ||
" <tr style=\"text-align: right;\">\n", | ||
" <th></th>\n", | ||
" <th>target</th>\n", | ||
" <th>xc</th>\n", | ||
" <th>yc</th>\n", | ||
" </tr>\n", | ||
" </thead>\n", | ||
" <tbody>\n", | ||
" <tr>\n", | ||
" <th>3028</th>\n", | ||
" <td>LHFPL3</td>\n", | ||
" <td>869.844974</td>\n", | ||
" <td>4243.094682</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>4913</th>\n", | ||
" <td>CALM2</td>\n", | ||
" <td>909.339057</td>\n", | ||
" <td>4241.631939</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>4914</th>\n", | ||
" <td>SLC1A2</td>\n", | ||
" <td>901.862810</td>\n", | ||
" <td>4241.631939</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>5076</th>\n", | ||
" <td>FTH1</td>\n", | ||
" <td>822.874646</td>\n", | ||
" <td>4241.469412</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>5077</th>\n", | ||
" <td>KCNC2</td>\n", | ||
" <td>808.734789</td>\n", | ||
" <td>4241.469412</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>...</th>\n", | ||
" <td>...</td>\n", | ||
" <td>...</td>\n", | ||
" <td>...</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>304824</th>\n", | ||
" <td>SPARCL1</td>\n", | ||
" <td>870.170028</td>\n", | ||
" <td>3912.514586</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>304833</th>\n", | ||
" <td>NCAM2</td>\n", | ||
" <td>818.973996</td>\n", | ||
" <td>3912.514586</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>304835</th>\n", | ||
" <td>CADM2</td>\n", | ||
" <td>806.459410</td>\n", | ||
" <td>3912.514586</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>304836</th>\n", | ||
" <td>FTH1</td>\n", | ||
" <td>804.671612</td>\n", | ||
" <td>3912.514586</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>306566</th>\n", | ||
" <td>LHFPL3</td>\n", | ||
" <td>913.402234</td>\n", | ||
" <td>3911.051842</td>\n", | ||
" </tr>\n", | ||
" </tbody>\n", | ||
"</table>\n", | ||
"<p>47136 rows × 3 columns</p>\n", | ||
"</div>" | ||
], | ||
"text/plain": [ | ||
" target xc yc\n", | ||
"3028 LHFPL3 869.844974 4243.094682\n", | ||
"4913 CALM2 909.339057 4241.631939\n", | ||
"4914 SLC1A2 901.862810 4241.631939\n", | ||
"5076 FTH1 822.874646 4241.469412\n", | ||
"5077 KCNC2 808.734789 4241.469412\n", | ||
"... ... ... ...\n", | ||
"304824 SPARCL1 870.170028 3912.514586\n", | ||
"304833 NCAM2 818.973996 3912.514586\n", | ||
"304835 CADM2 806.459410 3912.514586\n", | ||
"304836 FTH1 804.671612 3912.514586\n", | ||
"306566 LHFPL3 913.402234 3911.051842\n", | ||
"\n", | ||
"[47136 rows x 3 columns]" | ||
] | ||
}, | ||
"execution_count": 39, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"res = pciSeq.fit(spots_df, label_image, scRNA_df)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"res = pciSeq.fit(spots_df, label_image, scRNA_df)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.7.4" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |