Skip to content

Commit

Permalink
Merge pull request #3 from i-pletenev/add_feature_analysis
Browse files Browse the repository at this point in the history
Add feature analysis
  • Loading branch information
i-pletenev authored Mar 27, 2024
2 parents e65aa67 + a74e2c6 commit 6124b11
Show file tree
Hide file tree
Showing 5 changed files with 164 additions and 194 deletions.
4 changes: 2 additions & 2 deletions code/07_Fig2_tad_borders_properties_part1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
"boundaries_plus[\"border_num1\"]= range(1,boundaries_plus.shape[0] + 1)\n",
"boundaries_minus[\"border_num2\"]= range(1,boundaries_minus.shape[0] + 1)\n",
"\n",
"boundaries_minus_sploped = pbt.from_dataframe(boundaries_minus).slop(b=22_500, g=\"../data/chrom.sizes\")\n",
"boundaries_plus_sploped = pbt.from_dataframe(boundaries_plus).slop(b=22_500, g=\"../data/chrom.sizes\")"
"boundaries_minus_sploped = pbt.from_dataframe(boundaries_minus).slop(b=22_500, g=\"../data/hg38.chrom.sizes\")\n",
"boundaries_plus_sploped = pbt.from_dataframe(boundaries_plus).slop(b=22_500, g=\"../data/hg38.chrom.sizes\")"
]
},
{
Expand Down
8 changes: 4 additions & 4 deletions code/08_Fig2_tad_and_thier_borders_properties_part2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -762,8 +762,8 @@
}
],
"source": [
"boundaries_minus_sploped = pbt.from_dataframe(boundaries_minus.iloc[:, [0,1,2, 5]]).slop(b=15000, g=\"../data/chrom.sizes\")\n",
"boundaries_plus_sploped = pbt.from_dataframe(boundaries_plus.iloc[:, [0,1,2, 5]]).slop(b=15000,g=\"../data/chrom.sizes\")"
"boundaries_minus_sploped = pbt.from_dataframe(boundaries_minus.iloc[:, [0,1,2, 5]]).slop(b=15000, g=\"../data/hg38.chrom.sizes\")\n",
"boundaries_plus_sploped = pbt.from_dataframe(boundaries_plus.iloc[:, [0,1,2, 5]]).slop(b=15000,g=\"../data/hg38.chrom.sizes\")"
]
},
{
Expand All @@ -774,7 +774,7 @@
"outputs": [],
"source": [
"def make_tss(pc_DE_genes_minus):\n",
" chrom_sizes_path = \"../data/chrom.sizes\"\n",
" chrom_sizes_path = \"../data/hg38.chrom.sizes\"\n",
" tss = pbt.from_dataframe(pc_DE_genes_minus).flank(g=chrom_sizes_path, s=True, l=1, r=0)\n",
" tss = pd.read_table(tss.fn, header = None, names=pc_DE_genes_minus.columns.tolist())\n",
" return tss\n",
Expand Down Expand Up @@ -904,7 +904,7 @@
"outputs": [],
"source": [
"def make_a_b(expressed_not_de, border_file_init): \n",
" border_file_slopped = pbt.from_dataframe(border_file_init.iloc[:, [0,1,2, 5]]).slop(b=15000, g=\"../data/chrom.sizes\")\n",
" border_file_slopped = pbt.from_dataframe(border_file_init.iloc[:, [0,1,2, 5]]).slop(b=15000, g=\"../data/hg38.chrom.sizes\")\n",
"\n",
" b_noDE = border_file_slopped\\\n",
" .intersect(pbt.from_dataframe(expressed_not_de), wa=True, wb=True)\n",
Expand Down
6 changes: 3 additions & 3 deletions code/09_Fig3_chromtain_loops_properties.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@
"source": [
"columns = [\"chrom\",\"start\",\"end\",\"gene.name\", \"gene.id\",\"strand\"]\n",
"columns2 = ['chrom', 'start', 'end', 'gene.name', 'log2FC', 'strand']\n",
"chrom_sizes_path = '../data/chrom.sizes' #set path to chrom.sizes\n",
"chrom_sizes_path = '../data/hg38.chrom.sizes' \n",
"tss_plus = pbt.from_dataframe(de_neurons).flank(g=chrom_sizes_path, s=True, l=2000, r=0)\n",
"tss_plus = pd.read_table(tss_plus.fn, header = None, names=columns2)\n",
"\n",
Expand Down Expand Up @@ -756,7 +756,7 @@
" df = pd.concat([df_sel[[\"chrom1\",\"start1\", \"end1\"]],\n",
" df_sel[[\"chrom2\",\"start2\", \"end2\"]].rename(columns = {\"chrom2\":\"chrom1\",\"start2\":\"start1\",\"end2\":\"end1\"})])\n",
" df = df.drop_duplicates().reset_index(drop=True) \n",
" df =pbt.from_dataframe(df).slop(b=slop, g=\"../data/chrom.sizes\")\n",
" df =pbt.from_dataframe(df).slop(b=slop, g=\"../data/hg38.chrom.sizes\")\n",
" \n",
" colnames = de_neurons.columns.tolist() \n",
" df_intersect = pbt.from_dataframe(de_neurons)\\\n",
Expand Down Expand Up @@ -890,7 +890,7 @@
" df_processed = df[columns].reset_index(drop=True)\n",
" df_processed[\"anchor\"] = anchor \n",
" if slopvalue and slopvalue > 0:\n",
" df_slopped = pbt.from_dataframe(df_processed).slop(b=slopvalue, g='../data/chrom.sizes')\n",
" df_slopped = pbt.from_dataframe(df_processed).slop(b=slopvalue, g='../data/hg38.chrom.sizes')\n",
" df_processed = pd.read_table(df_slopped.fn, header=None, names=df_processed.columns.tolist())\n",
" assert df_processed.shape[0] > 1, \"Dataframe after slopping has less than 2 rows.\"\n",
" \n",
Expand Down
25 changes: 0 additions & 25 deletions data/chrom.sizes

This file was deleted.

Loading

0 comments on commit 6124b11

Please sign in to comment.