-
Notifications
You must be signed in to change notification settings - Fork 58
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
0 parents
commit 6281d00
Showing
198 changed files
with
30,874 additions
and
0 deletions.
There are no files selected for viewing
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,75 @@ | ||
#### -- Packrat Autoloader (version 0.5.0) -- #### | ||
source("packrat/init.R") | ||
#### -- End Packrat Autoloader -- #### | ||
|
||
options(bitmapType = "cairo") | ||
|
||
|
||
read_h5ad <- function(filename) { | ||
builtins <- reticulate::import_builtins() | ||
anndata <- reticulate::import("anndata", convert = FALSE) | ||
|
||
Mapping <- reticulate::import("typing")$Mapping | ||
DataFrame <- reticulate::import("pandas")$DataFrame | ||
isinstance <- builtins$isinstance | ||
|
||
adata <- anndata$read_h5ad(filename) | ||
|
||
.convert <- function(obj) { | ||
if (!isinstance(obj, Mapping) || isinstance(obj, DataFrame)) { | ||
return(reticulate::py_to_r(obj)) | ||
} | ||
ret <- list() | ||
for (item in builtins$list(obj$keys())) { | ||
ret[[item]] <- .convert(obj[[item]]) | ||
} | ||
return(ret) | ||
} | ||
|
||
X <- .convert(adata$X$tocsc()) | ||
layers <- .convert(adata$layers) | ||
obs <- .convert(adata$obs) | ||
var <- .convert(adata$var) | ||
obsm <- .convert(adata$obsm) | ||
varm <- .convert(adata$varm) | ||
obsp <- .convert(adata$obsp) | ||
varp <- .convert(adata$varp) | ||
uns <- .convert(adata$uns) | ||
rownames(X) <- rownames(obs) | ||
colnames(X) <- rownames(var) | ||
|
||
return(list( | ||
X = X, layers = layers, | ||
obs = obs, var = var, | ||
obsm = obsm, varm = varm, | ||
obsp = obsp, varp = varp, | ||
uns = uns | ||
)) | ||
} | ||
|
||
|
||
safe_sd <- function(x) { | ||
if (length(x) == 1) | ||
return(0.0) | ||
return(sd(x)) | ||
} | ||
|
||
|
||
ggplot_theme <- function(...) { | ||
return(ggplot2::theme( | ||
text = ggplot2::element_text(family = "ArialMT"), | ||
plot.background = ggplot2::element_blank(), | ||
panel.grid.major = ggplot2::element_line(color = "#EEEEEE", linetype = "longdash"), | ||
panel.grid.minor = ggplot2::element_blank(), | ||
panel.background = ggplot2::element_rect(fill = "#FFFFFF"), | ||
legend.background = ggplot2::element_blank(), | ||
legend.box.background = ggplot2::element_blank(), | ||
axis.line = ggplot2::element_line(color = "#000000"), | ||
... | ||
)) | ||
} | ||
|
||
|
||
ggplot_save <- function(filename, ...) { | ||
ggplot2::ggsave(filename, ..., dpi = 600, bg = "transparent") | ||
} |
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,64 @@ | ||
name: build | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: [3.8] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
sudo apt install -y libxml2-utils pandoc | ||
sudo wget -O /usr/bin/bedtools https://github.com/arq5x/bedtools2/releases/download/v2.30.0/bedtools.static.binary | ||
sudo chmod +x /usr/bin/bedtools | ||
pip install --upgrade pip flit | ||
flit install -s | ||
- name: Lint with flake8 | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 scglue --count --select=E9,F63,F7,F82 --show-source --statistics | ||
- name: Test with pytest | ||
run: | | ||
pytest --cov="scglue" --cov-report="xml:cov.xml" tests --cpu-only | ||
COVERAGE=$(xmllint --xpath "/coverage/@line-rate" cov.xml | awk -F\" '{cov = sprintf("%.0f%%", $2 * 100); print(cov);}') | ||
echo "COVERAGE=${COVERAGE}" >> $GITHUB_ENV | ||
- name: Create coverage badge | ||
uses: schneegans/[email protected] | ||
with: | ||
auth: ${{ secrets.GIST_SECRET }} | ||
gistID: ${{ secrets.GIST_ID }} | ||
filename: coverage.json | ||
label: coverage | ||
message: ${{ env.COVERAGE }} | ||
color: green | ||
- name: Build documentation | ||
run: | | ||
sphinx-build -b html docs docs/_build | ||
- name: Get version | ||
run: | | ||
VERSION=$(python -c "from scglue import __version__; print(__version__)") | ||
echo "VERSION=${VERSION}" >> $GITHUB_ENV | ||
- name: Create version badge | ||
uses: schneegans/[email protected] | ||
with: | ||
auth: ${{ secrets.GIST_SECRET }} | ||
gistID: ${{ secrets.GIST_ID }} | ||
filename: version.json | ||
label: version | ||
message: ${{ env.VERSION }} | ||
color: blue |
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,29 @@ | ||
name: release | ||
|
||
on: | ||
release: | ||
types: [released] | ||
|
||
jobs: | ||
deploy: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
- name: Install dependencies | ||
run: | ||
pip install --upgrade pip flit | ||
- name: Build package | ||
run: | | ||
flit build | ||
ls -lh dist | ||
- name: Publish package | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: caozj | ||
password: ${{ secrets.PYPI_API_TOKEN }} |
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,58 @@ | ||
__pycache__ | ||
.coverage* | ||
.ipynb_checkpoints | ||
.snakemake | ||
.snakemake_timestamp | ||
*.annotated_links | ||
*.bak | ||
*.bed* | ||
*.bigWig | ||
*.chain* | ||
*.cprof | ||
*.csv* | ||
*.dill | ||
*.docx | ||
*.egg-info | ||
*.err | ||
*.fa | ||
*.feather | ||
*.gaf* | ||
*.graphml* | ||
*.gtf* | ||
*.h5ad | ||
*.html | ||
*.ipynb | ||
*.jpg | ||
*.json | ||
*.links | ||
*.log | ||
*.loom | ||
*.meme | ||
*.mp4 | ||
*.mtx* | ||
*.obo | ||
*.old | ||
*.out | ||
*.owl | ||
*.pkl* | ||
*.png | ||
*.pt | ||
*.pyc | ||
*.tbl | ||
*.tfevents.* | ||
*.tsv* | ||
*@neomake* | ||
*Untitled* | ||
.deprecated | ||
reports | ||
conda | ||
cov.xml | ||
dask-worker-space | ||
objectdb | ||
packrat/lib | ||
packrat/lib*/ | ||
packrat/src/ | ||
tmp | ||
tools | ||
dist |
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,12 @@ | ||
version: 2 | ||
build: | ||
image: latest | ||
sphinx: | ||
configuration: docs/conf.py | ||
python: | ||
version: 3.8 | ||
install: | ||
- method: pip | ||
path: . | ||
extra_requirements: | ||
- doc |
Oops, something went wrong.