From aefddec969335affd43935869a543cc297ed8444 Mon Sep 17 00:00:00 2001 From: Anna Schaar Date: Thu, 5 Oct 2023 15:15:58 +0200 Subject: [PATCH] run pre-commit --- jupyter-book/surface_protein/annotation.ipynb | 2 +- .../surface_protein/batch_correction.ipynb | 10 +++-- .../dimensionality_reduction.ipynb | 16 ++++--- .../surface_protein/doublet_detection.ipynb | 10 +++-- .../surface_protein/normalization.ipynb | 15 ++++--- .../surface_protein/quality_control.ipynb | 42 ++++++++++--------- 6 files changed, 52 insertions(+), 43 deletions(-) diff --git a/jupyter-book/surface_protein/annotation.ipynb b/jupyter-book/surface_protein/annotation.ipynb index 1823f0ff..52bc05e0 100644 --- a/jupyter-book/surface_protein/annotation.ipynb +++ b/jupyter-book/surface_protein/annotation.ipynb @@ -74,7 +74,7 @@ "source": [ "adata = sc.read(\n", " \"cite_preprocessed.h5ad\",\n", - " backup_url='https://figshare.com/ndownloader/files/42569866'\n", + " backup_url=\"https://figshare.com/ndownloader/files/42569866\",\n", ")" ] }, diff --git a/jupyter-book/surface_protein/batch_correction.ipynb b/jupyter-book/surface_protein/batch_correction.ipynb index 55d6ff3c..dde4a293 100644 --- a/jupyter-book/surface_protein/batch_correction.ipynb +++ b/jupyter-book/surface_protein/batch_correction.ipynb @@ -76,8 +76,10 @@ "source": [ "cite_xdbt = pooch.retrieve(\n", " url=\"https://figshare.com/ndownloader/files/41452434\",\n", - " fname='cite_doublet_removal_xdbt.h5mu', path='.',\n", - " known_hash=None, progressbar=True, \n", + " fname=\"cite_doublet_removal_xdbt.h5mu\",\n", + " path=\".\",\n", + " known_hash=None,\n", + " progressbar=True,\n", ")" ] }, @@ -88,7 +90,7 @@ "metadata": {}, "outputs": [], "source": [ - "mdata = mu.read('cite_doublet_removal_xdbt.h5mu')" + "mdata = mu.read(\"cite_doublet_removal_xdbt.h5mu\")" ] }, { @@ -390,7 +392,7 @@ "metadata": {}, "outputs": [], "source": [ - "mdata.write('cite_batch_correction.h5mu')" + "mdata.write(\"cite_batch_correction.h5mu\")" ] }, { diff --git a/jupyter-book/surface_protein/dimensionality_reduction.ipynb b/jupyter-book/surface_protein/dimensionality_reduction.ipynb index 156d20e3..63330087 100644 --- a/jupyter-book/surface_protein/dimensionality_reduction.ipynb +++ b/jupyter-book/surface_protein/dimensionality_reduction.ipynb @@ -80,8 +80,10 @@ "source": [ "cite_xdbt = pooch.retrieve(\n", " url=\"https://figshare.com/ndownloader/files/41452434\",\n", - " fname='cite_doublet_removal_xdbt.h5mu', path='.',\n", - " known_hash=None, progressbar=True, \n", + " fname=\"cite_doublet_removal_xdbt.h5mu\",\n", + " path=\".\",\n", + " known_hash=None,\n", + " progressbar=True,\n", ")" ] }, @@ -102,7 +104,7 @@ }, "outputs": [], "source": [ - "mdata = mu.read('cite_doublet_removal_xdbt.h5mu')" + "mdata = mu.read(\"cite_doublet_removal_xdbt.h5mu\")" ] }, { @@ -178,11 +180,7 @@ } ], "source": [ - "temp = (\n", - " mdata[\"prot\"]\n", - " .var.loc[~mdata[\"prot\"].var.index.isin(isotype_controls), :]\n", - " .index\n", - ")\n", + "temp = mdata[\"prot\"].var.loc[~mdata[\"prot\"].var.index.isin(isotype_controls), :].index\n", "temp" ] }, @@ -467,7 +465,7 @@ "metadata": {}, "outputs": [], "source": [ - "mdata.write('cite_dimensionality_reduction.h5mu')" + "mdata.write(\"cite_dimensionality_reduction.h5mu\")" ] }, { diff --git a/jupyter-book/surface_protein/doublet_detection.ipynb b/jupyter-book/surface_protein/doublet_detection.ipynb index 0aa3ca66..fbc489ea 100644 --- a/jupyter-book/surface_protein/doublet_detection.ipynb +++ b/jupyter-book/surface_protein/doublet_detection.ipynb @@ -70,8 +70,10 @@ "source": [ "cite_filtered = pooch.retrieve(\n", " url=\"https://figshare.com/ndownloader/files/41452443\",\n", - " fname='cite_normalization.h5mu', path='.',\n", - " known_hash=None, progressbar=True, \n", + " fname=\"cite_normalization.h5mu\",\n", + " path=\".\",\n", + " known_hash=None,\n", + " progressbar=True,\n", ")" ] }, @@ -82,7 +84,7 @@ "metadata": {}, "outputs": [], "source": [ - "mdata = mu.read('cite_normalization.h5mu')" + "mdata = mu.read(\"cite_normalization.h5mu\")" ] }, { @@ -378,7 +380,7 @@ "metadata": {}, "outputs": [], "source": [ - "mdata.write('cite_doublet_removal_xdbt.h5mu')" + "mdata.write(\"cite_doublet_removal_xdbt.h5mu\")" ] }, { diff --git a/jupyter-book/surface_protein/normalization.ipynb b/jupyter-book/surface_protein/normalization.ipynb index 463d2d0e..0908245e 100644 --- a/jupyter-book/surface_protein/normalization.ipynb +++ b/jupyter-book/surface_protein/normalization.ipynb @@ -52,7 +52,8 @@ "import scanpy as sc\n", "\n", "import warnings\n", - "warnings.filterwarnings('ignore')\n", + "\n", + "warnings.filterwarnings(\"ignore\")\n", "\n", "sc.settings.verbosity = 0\n", "sc.settings.set_figure_params(\n", @@ -79,8 +80,10 @@ "source": [ "cite_quality_control = pooch.retrieve(\n", " url=\"https://figshare.com/ndownloader/files/41452449\",\n", - " fname='cite_quality_control.h5mu', path='.',\n", - " known_hash=None, progressbar=True, \n", + " fname=\"cite_quality_control.h5mu\",\n", + " path=\".\",\n", + " known_hash=None,\n", + " progressbar=True,\n", ")" ] }, @@ -131,7 +134,7 @@ } ], "source": [ - "mdata = mu.read('cite_quality_control.h5mu')\n", + "mdata = mu.read(\"cite_quality_control.h5mu\")\n", "mdata" ] }, @@ -172,7 +175,7 @@ } ], "source": [ - "mdata_raw = mu.read('cite_raw.h5mu')\n", + "mdata_raw = mu.read(\"cite_raw.h5mu\")\n", "mdata_raw" ] }, @@ -394,7 +397,7 @@ "metadata": {}, "outputs": [], "source": [ - "mdata.write('cite_normalization.h5mu')" + "mdata.write(\"cite_normalization.h5mu\")" ] }, { diff --git a/jupyter-book/surface_protein/quality_control.ipynb b/jupyter-book/surface_protein/quality_control.ipynb index 009c6990..bc0a2919 100644 --- a/jupyter-book/surface_protein/quality_control.ipynb +++ b/jupyter-book/surface_protein/quality_control.ipynb @@ -103,12 +103,12 @@ "source": [ "# ToDo adjust this\n", "rna = sc.read_10x_h5(\n", - " filename=\"rna_filtered_feature_bc_matrix.h5\", \n", - " backup_url='https://figshare.com/ndownloader/files/39546196'\n", + " filename=\"rna_filtered_feature_bc_matrix.h5\",\n", + " backup_url=\"https://figshare.com/ndownloader/files/39546196\",\n", ")\n", "prot = sc.read_10x_h5(\n", - " filename=\"prot_filtered_feature_bc_matrix.h5\", \n", - " backup_url='https://figshare.com/ndownloader/files/42569008'\n", + " filename=\"prot_filtered_feature_bc_matrix.h5\",\n", + " backup_url=\"https://figshare.com/ndownloader/files/42569008\",\n", ")" ] }, @@ -198,12 +198,12 @@ "source": [ "# ToDo adjust this\n", "rna_raw = sc.read_10x_h5(\n", - " filename=\"rna_raw_feature_bc_matrix.h5\", \n", - " backup_url='https://figshare.com/ndownloader/files/39546217'\n", + " filename=\"rna_raw_feature_bc_matrix.h5\",\n", + " backup_url=\"https://figshare.com/ndownloader/files/39546217\",\n", ")\n", "prot_raw = sc.read_10x_h5(\n", - " filename=\"prot_raw_feature_bc_matrix.h5\", \n", - " backup_url='https://figshare.com/ndownloader/files/42569026'\n", + " filename=\"prot_raw_feature_bc_matrix.h5\",\n", + " backup_url=\"https://figshare.com/ndownloader/files/42569026\",\n", ")\n", "mdata_raw = mu.MuData({\"rna\": rna_raw, \"prot\": prot_raw})\n", "mdata_raw" @@ -228,8 +228,10 @@ "source": [ "cite_filtered = pooch.retrieve(\n", " url=\"https://figshare.com/ndownloader/files/41452287\",\n", - " fname='cite_filtered.h5mu', path='.',\n", - " known_hash=None, progressbar=True, \n", + " fname=\"cite_filtered.h5mu\",\n", + " path=\".\",\n", + " known_hash=None,\n", + " progressbar=True,\n", ")" ] }, @@ -242,8 +244,10 @@ "source": [ "cite_raw = pooch.retrieve(\n", " url=\"https://figshare.com/ndownloader/files/41452308\",\n", - " fname='cite_raw.h5mu', path='.',\n", - " known_hash=None, progressbar=True, \n", + " fname=\"cite_raw.h5mu\",\n", + " path=\".\",\n", + " known_hash=None,\n", + " progressbar=True,\n", ")" ] }, @@ -284,7 +288,7 @@ } ], "source": [ - "mdata = md.read_h5mu('cite_filtered.h5mu')\n", + "mdata = md.read_h5mu(\"cite_filtered.h5mu\")\n", "mdata" ] }, @@ -325,7 +329,7 @@ } ], "source": [ - "mdata_raw = md.read_h5mu('cite_raw.h5mu')\n", + "mdata_raw = md.read_h5mu(\"cite_raw.h5mu\")\n", "mdata_raw" ] }, @@ -570,9 +574,7 @@ ], "source": [ "sns.displot(\n", - " mdata[\"prot\"]\n", - " .obs.query(\"total_counts>20000 and total_counts<100000\")\n", - " .total_counts\n", + " mdata[\"prot\"].obs.query(\"total_counts>20000 and total_counts<100000\").total_counts\n", ")" ] }, @@ -620,7 +622,9 @@ ], "source": [ "sns.displot(\n", - " mdata_raw[\"rna\"].obs.sample(frac=0.01).query(\"total_counts<100000 and total_counts>10\"),\n", + " mdata_raw[\"rna\"]\n", + " .obs.sample(frac=0.01)\n", + " .query(\"total_counts<100000 and total_counts>10\"),\n", " x=\"total_counts\",\n", " log_scale=True,\n", " hue=\"donor\",\n", @@ -1139,7 +1143,7 @@ "metadata": {}, "outputs": [], "source": [ - "mdata.write('cite_quality_control.h5mu')" + "mdata.write(\"cite_quality_control.h5mu\")" ] }, {