Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor fragments #20

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ jobs:
- name: Test with pytest
run: |
pip install pytest
pip install pysam
pytest
23 changes: 12 additions & 11 deletions docs/source/notebooks/quickstart_mudata.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,13 @@
],
"source": [
"import numpy as np\n",
"\n",
"np.random.seed(1)\n",
"\n",
"n, d, k = 1000, 100, 10\n",
"\n",
"z = np.random.normal(loc=np.arange(k), scale=np.arange(k)*2, size=(n,k))\n",
"w = np.random.normal(size=(d,k))\n",
"z = np.random.normal(loc=np.arange(k), scale=np.arange(k) * 2, size=(n, k))\n",
"w = np.random.normal(size=(d, k))\n",
"y = np.dot(z, w.T)\n",
"y.shape"
]
Expand Down Expand Up @@ -134,7 +135,7 @@
],
"source": [
"d2 = 50\n",
"w2 = np.random.normal(size=(d2,k))\n",
"w2 = np.random.normal(size=(d2, k))\n",
"y2 = np.dot(z, w2.T)\n",
"\n",
"adata2 = AnnData(y2)\n",
Expand Down Expand Up @@ -265,7 +266,7 @@
}
],
"source": [
"mdata.varm['A']"
"mdata.varm[\"A\"]"
]
},
{
Expand Down Expand Up @@ -301,7 +302,7 @@
"source": [
"# Only keep variables with value > 1 in obs_1\n",
"# with in-place filtering for the variables\n",
"mu.pp.filter_var(adata, adata[\"obs_1\",:].X.flatten() > 1)\n",
"mu.pp.filter_var(adata, adata[\"obs_1\", :].X.flatten() > 1)\n",
"adata"
]
},
Expand Down Expand Up @@ -375,7 +376,7 @@
"source": [
"# Throw away the last sample in the modality 'B'\n",
"# with in-place filtering for the observations\n",
"mu.pp.filter_obs(mdata.mod[\"B\"], [True for _ in range(n-1)] + [False])"
"mu.pp.filter_obs(mdata.mod[\"B\"], [True for _ in range(n - 1)] + [False])"
]
},
{
Expand Down Expand Up @@ -568,7 +569,7 @@
}
],
"source": [
"with mu.set_options(display_style = \"html\", display_html_expand = 0b000):\n",
"with mu.set_options(display_style=\"html\", display_html_expand=0b000):\n",
" display(mdata)"
]
},
Expand Down Expand Up @@ -771,7 +772,7 @@
}
],
"source": [
"with mu.set_options(display_style = \"html\", display_html_expand = 0b000):\n",
"with mu.set_options(display_style=\"html\", display_html_expand=0b000):\n",
" display(mdata_r)"
]
},
Expand Down Expand Up @@ -825,7 +826,7 @@
"source": [
"def simple_pca(mdata):\n",
" from sklearn import decomposition\n",
" \n",
"\n",
" x = np.hstack([m.X for m in mdata.mod.values()])\n",
"\n",
" pca = decomposition.PCA(n_components=2)\n",
Expand All @@ -834,8 +835,8 @@
" # By default, methods operate in-place\n",
" # and embeddings are stored in the .obsm slot\n",
" mdata.obsm[\"X_pca\"] = components\n",
" \n",
" return "
"\n",
" return"
]
},
{
Expand Down
1 change: 1 addition & 0 deletions muon/_atac/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from . import preproc as pp
from . import tools as tl
from . import plot as pl
from . import fragments as fr
from .io import *
Loading