Skip to content
Merged
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
45 changes: 45 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Lint

on:
pull_request:
push:
branches: [main]

jobs:
lint:
name: Lint
runs-on: ubuntu-latest

permissions:
contents: read
packages: read
statuses: write

steps:
- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 0
persist-credentials: false

- name: Lint Code Base
uses: super-linter/super-linter@v8.5.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_ALL_CODEBASE: true
DEFAULT_BRANCH: main

VALIDATE_SNAKEMAKE_SNAKEFMT: true
VALIDATE_PYTHON_BLACK: true
VALIDATE_YAML_PRETTIER: true

- name: Set up R
uses: r-lib/actions/setup-r@v2

- name: Set up R dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
packages: styler

- name: Check R style
run: Rscript -e 'changed <- styler::style_dir(".", dry = "on"); if (any(changed$changed)) quit(status = 1)'
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,7 @@ data
.test/report.html

snakejob_conductor.sh
settings.json
settings.json

!.github/
!.prettierrc.yml
2 changes: 2 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tabWidth: 2
useTabs: false
10 changes: 5 additions & 5 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@ type: software
authors:
- given-names: Stephan
family-names: Reichl
orcid: 'https://orcid.org/0000-0001-8555-7198'
orcid: "https://orcid.org/0000-0001-8555-7198"
affiliation: CeMM Research Center for Molecular Medicine
- given-names: Raphael
family-names: Bednarsky
orcid: 'https://orcid.org/0009-0005-0404-3424'
orcid: "https://orcid.org/0009-0005-0404-3424"
affiliation: CeMM Research Center for Molecular Medicine
- given-names: Christoph
family-names: Bock
orcid: 'https://orcid.org/0000-0001-6091-3088'
orcid: "https://orcid.org/0000-0001-6091-3088"
affiliation: CeMM Research Center for Molecular Medicine
identifiers:
- type: doi
value: 10.5281/zenodo.8405360.
description: >-
This DOI represents all versions, and will always
resolve to the latest one.
repository-code: 'https://github.com/epigen/unsupervised_analysis'
url: 'https://epigen.github.io/unsupervised_analysis/'
repository-code: "https://github.com/epigen/unsupervised_analysis"
url: "https://epigen.github.io/unsupervised_analysis/"
abstract: >-
A general purpose Snakemake workflow to perform
unsupervised analyses (dimensionality reduction & cluster
Expand Down
234 changes: 125 additions & 109 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
theme: jekyll-theme-cayman
theme: jekyll-theme-cayman
8 changes: 4 additions & 4 deletions config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ You need one configuration file to configure the analyses and one annotation fil

- project configuration (`config/config.yaml`): Different for every project and configures the analyses to be performed.
- sample annotation (annotation): CSV file consisting of four mandatory columns.
- name: A unique name for the dataset (tip: keep it short but descriptive).
- data: Path to the tabular data as a comma-separated table (CSV).
- metadata: Path to the metadata as a comma-separated table (CSV) with the first column being the index/identifier of each observation/sample and every other column metadata for the respective observation (either numeric or categorical, not mixed). **No NaN or empty values allowed, and no special characters (all except a-z, 0-9, `_`) in the index.**
- samples_by_features: Boolean indicator if the data matrix is observations/samples (rows) x features (columns): 0==no, 1==yes.
- name: A unique name for the dataset (tip: keep it short but descriptive).
- data: Path to the tabular data as a comma-separated table (CSV).
- metadata: Path to the metadata as a comma-separated table (CSV) with the first column being the index/identifier of each observation/sample and every other column metadata for the respective observation (either numeric or categorical, not mixed). **No NaN or empty values allowed, and no special characters (all except a-z, 0-9, `_`) in the index.**
- samples_by_features: Boolean indicator if the data matrix is observations/samples (rows) x features (columns): 0==no, 1==yes.

Set workflow-specific `resources` or command line arguments (CLI) in the workflow profile `workflow/profiles/default.config.yaml`, which supersedes global Snakemake profiles.
63 changes: 32 additions & 31 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

##### RESOURCES #####
# memory in MB
mem: '32000'
mem: 32000
threads: 2

##### GENERAL #####
Expand All @@ -14,8 +14,8 @@ project_name: digits
# https://scikit-learn.org/stable/modules/generated/sklearn.decomposition.PCA.html
# especially relevant for large data
pca:
n_components: 0.9 # variance as float (0-1], number of components as int e.g., 50, or 'mle'
svd_solver: 'auto' # options: ‘auto’, ‘full’, ‘covariance_eigh’, ‘arpack’, ‘randomized’
n_components: 0.9 # variance as float (0-1], number of components as int e.g., 50, or 'mle'
svd_solver: "auto" # options: ‘auto’, ‘full’, ‘covariance_eigh’, ‘arpack’, ‘randomized’

##### UMAP & densMAP #####
# https://umap-learn.readthedocs.io/en/latest/parameters.html
Expand All @@ -25,52 +25,53 @@ pca:
# densmap flag: perform densMAP (0==no, 1==yes) on top of UMAP with all parameter combinations (https://umap-learn.readthedocs.io/en/latest/densmap_demo.html)
# connectivity visualization flag (0==no, 1==yes), computational expensive (slow), recommendation 0 for exploration and 1 for validation
umap:
metrics: ['euclidean']
n_neighbors: [15]
min_dist: [0.1]
n_components: [2]
densmap: 1
connectivity: 1
diagnostics: 1
metrics: ["euclidean"]
n_neighbors: [15]
min_dist: [0.1]
n_components: [2]
densmap: 1
connectivity: 1
diagnostics: 1

##### HEATMAP #####
# information on the ComplexHeatmap parameters: https://jokergoo.github.io/ComplexHeatmap-reference/book/index.html
# distance metrics: for rows and columns. all metrics that are supported by scipy.spatial.distance.pdist (https://docs.scipy.org/doc/scipy-1.14.0/reference/generated/scipy.spatial.distance.pdist.html)
# clustering methods: methods for hierarchical clustering that are supported by fastcluster's R implementation (https://danifold.net/fastcluster.html)
# it is the most resource (memory) intensive method, leave empty [] if not required
heatmap:
metrics: ['correlation','cosine']
hclust_methods: ['complete']
n_observations: 1 # random sampled proportion float (0-1] or absolute number as integer
n_features: 0.5 # highly variable features proportion float (0-1] or absolute number as integer
metrics: ["correlation", "cosine"]
hclust_methods: ["complete"]
n_observations: 1 # random sampled proportion float (0-1] or absolute number as integer
n_features: 0.5 # highly variable features proportion float (0-1] or absolute number as integer

##### LEIDEN #####
# Leiden clustering applied on UMAP KNN graphs specified by the respective parameters (metric, n_neighbors).
# Leiden algorithm specific parameters (partition_types, resolutions, n_iterations) -> https://leidenalg.readthedocs.io/en/stable/index.html
# To skip Leiden clustering, leave the "metrics" parameter empty i.e., []
leiden:
metrics: [] # has to be a subset of above's UMAP parameters
n_neighbors: [15] # has to be a subset of above's UMAP parameters
partition_types: ["RBConfigurationVertexPartition", "ModularityVertexPartition"]
resolutions: [0.5,1,1.5,2,4] # only used for relevant partition_types
n_iterations: 2 # default: 2; -1 until convergence
metrics: [] # has to be a subset of above's UMAP parameters
n_neighbors: [15] # has to be a subset of above's UMAP parameters
partition_types:
["RBConfigurationVertexPartition", "ModularityVertexPartition"]
resolutions: [0.5, 1, 1.5, 2, 4] # only used for relevant partition_types
n_iterations: 2 # default: 2; -1 until convergence

##### clustification #####
# ML-based clustering approach that iteratively merges clusters based on misclassification.
# Doesn't support externally provided clusterings.
clustification:
method: "" # starting clustering result method, options: "Leiden"
method: "" # starting clustering result method, options: "Leiden"

##### clustree #####
# Cluster analysis and visualization using clustree: https://lazappi.github.io/clustree/index.html
# Clustree specific parameters (count_filter, prop_filter, layout): https://lazappi.github.io/clustree/reference/clustree.html
# Will be skipped if no clustering results are available
clustree:
count_filter: 0 # default: 0
prop_filter: 0.1 # default: 0.1
layout: "tree" # options: "tree" or "sugiyama"
categorical_label_option: "majority" # aggregation function for categorical metadata, options: "pure" or "majority"
numerical_aggregation_option: "mean" # aggregation function for numerical metadata, options: mean, median, max, min
count_filter: 0 # default: 0
prop_filter: 0.1 # default: 0.1
layout: "tree" # options: "tree" or "sugiyama"
categorical_label_option: "majority" # aggregation function for categorical metadata, options: "pure" or "majority"
numerical_aggregation_option: "mean" # aggregation function for numerical metadata, options: mean, median, max, min

##### cluster validation ####
# Cluster validation using internal cluster indices is computationally very expensive.
Expand All @@ -85,21 +86,21 @@ sample_proportion: 1 # float [0-1], >500 samples should be included.
# - internal cluster validation (categorical metadata interpreted as clusterings)
# Can be empty [], then the first column of the metadata dataframe will be taken.
metadata_of_interest: ["target"]

##### VISUALIZATION #####
# flag if coordinates should be fixed in 2D plots by +coord_fixed() (0==no, 1==yes)
# flag if coordinates should be fixed in 2D plots by +coord_fixed() (0==no, 1==yes)
# https://ggplot2.tidyverse.org/reference/coord_fixed.html
coord_fixed: 0

# 2D/3D visualization with ggplot2 and plotly
# for more than 200 datapoints it is recommended to reduce size to 0.1
scatterplot2d:
size: 1
alpha: 1
size: 1
alpha: 1

# specify features of interest. these features from the data, will be highlighted in the 2D/3D plots
# motivated by bioinformatics highlighting expression levels of marker genes (eg: ['PTPRC','STAT1','IRF8'])
# use keyword ['ALL'] to plot all features. WARNING: Only useful for relatively low dimensional data, a plot is generated for each feature and method.
# if not used leave empty []
features_to_plot: ['ALL'] #['pixel_0_0','pixel_0_1','pixel_0_2','pixel_0_3']
features_to_plot: ["ALL"] #['pixel_0_0','pixel_0_1','pixel_0_2','pixel_0_3']

Loading