Skip to content

Commit

Permalink
Printing all markers and asking how many to create
Browse files Browse the repository at this point in the history
  • Loading branch information
edjuaro committed Jan 23, 2020
1 parent a7d819a commit ba3a005
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
20 changes: 17 additions & 3 deletions manifest
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#Tue, 17 Dec 2019 14:15:10 -0800
JVMLevel=
LSID=urn\:lsid\:broad.mit.edu\:cancer.software.genepattern.module.analysis\:00408\:0.2
LSID=urn\:lsid\:broad.mit.edu\:cancer.software.genepattern.module.analysis\:00408\:0.3
author=Satija Lab New York Genome Canter, Wrapped as a module by Ted Liefeld, UCSD School of Medicine.
categories=SingleCell;Clustering
commandLine=/opt/R3.6/bin/Rscript --no-save --quiet --slave --no-restore /seurat/run_seurat_clustering.R --input.file\=<input.seurat.rds.file> --output.file\=<output.filename>.rds --max_dim\=<maximum_dimension> --resolution\=<resolution> --reduction\=<reduction>
commandLine=/opt/R3.6/bin/Rscript --no-save --quiet --slave --no-restore /seurat/run_seurat_clustering.R --input.file\=<input.seurat.rds.file> --output.file\=<output.filename>.rds --max_dim\=<maximum_dimension> --resolution\=<resolution> --reduction\=<reduction> --nmarkers\=<nmarkers>

cpuType=any
description=Companion module for the <a href="">Seurat notebook</a>. Performs clustering and marker identification on single cell data.
Expand Down Expand Up @@ -85,11 +85,25 @@ p5_prefix_when_specified=
p5_type=java.lang.String
p5_value=umap;tsne

p6_MODE=
p6_TYPE=Integer
p6_default_value=50
p6_description=How many cluster markers to output (a CSV file with this number of top markers per cluster will be created in addition to a CSV file with all of the cluster markers found)
p6_fileFormat=
p6_flag=--nmarkers
p6_name=nmarkers
p6_numValues=0..1
p6_optional=
p6_prefix=
p6_prefix_when_specified=
p6_type=java.lang.Integer
p6_value=

privacy=public
publicationDate=2020-01-14
quality=${quality.level}
requiredPatchLSIDs=
requiredPatchURLs=
taskDoc=doc.html
taskType=SingleCell
version=Updating module description.
version=Adding number of cluster markers as option.
10 changes: 6 additions & 4 deletions run_seurat_clustering.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ option_list <- list(
make_option("--output.file", dest="output.file"),
make_option("--max_dim", dest="max_dim", type="integer"),
make_option("--resolution", dest="resolution", type="double"),
make_option("--reduction", dest="reduction")
make_option("--reduction", dest="reduction"),
make_option("--nmarkers", dest="nmarkers",type="integer")
)

# Parse the command line arguments with the option list, printing the result
Expand Down Expand Up @@ -76,9 +77,10 @@ DimPlot(pbmc, reduction = opts$reduction)
# find markers for every cluster compared to all remaining cells, report only the positive ones
print('Finding markers for all clusters.')
pbmc.markers <- FindAllMarkers(pbmc, only.pos = TRUE, min.pct = 0.25, logfc.threshold = 0.25)
print('Here are the top to markers for each cluster')
pbmc.markers %>% group_by(cluster) %>% top_n(n = 2, wt = avg_logFC)
write.csv(pbmc.markers %>% group_by(cluster) %>% top_n(n = 2, wt = avg_logFC),paste(opts$output.file, ".csv", sep=""), row.names = FALSE)
print('Here are the top markers for each cluster')
pbmc.markers %>% group_by(cluster) %>% top_n(n = opts$nmarkers, wt = avg_logFC)
write.csv(pbmc.markers %>% group_by(cluster) %>% top_n(n = opts$nmarkers, wt = avg_logFC),paste(opts$output.file, ".csv", sep=""), row.names = FALSE)
write.csv(pbmc.markers %>% group_by(cluster) %>% top_n(n = n(), wt = avg_logFC),paste(opts$output.file, "_all_markers.csv", sep=""), row.names = FALSE)

# This is too specific to PBMC, so it won't be implemented
# new.cluster.ids <- c("Naive CD4 T", "Memory CD4 T", "CD14+ Mono", "B", "CD8 T", "FCGR3A+ Mono",
Expand Down
2 changes: 1 addition & 1 deletion testLocal.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
rm -rf Job_1/*

docker run -v $PWD:$PWD -w $PWD/Job_1 -t genepattern/seurat-clustering:1.0 /opt/R3.6/bin/Rscript --no-save --quiet --slave --no-restore $PWD/run_seurat_clustering.R --input.file=$PWD/test/data/pbmc_preprocessed.rds --output.file=postmarker --max_dim=10 --resolution=0.5 --reduction=umap
docker run -v $PWD:$PWD -w $PWD/Job_1 -t genepattern/seurat-clustering:1.0 /opt/R3.6/bin/Rscript --no-save --quiet --slave --no-restore $PWD/run_seurat_clustering.R --input.file=$PWD/test/data/pbmc_preprocessed.rds --output.file=postmarker --max_dim=10 --resolution=0.5 --reduction=umap --nmarkers=4

0 comments on commit ba3a005

Please sign in to comment.