Comments (2)
Hi @cartal !
You can take a look to cellranger-atac aggr to aggregate runs. Directly from cisTopic, you can create independent objects per run and then create a combined object:
# Create object for the first run
pathTo10X <- '/Run_1/'
fragments <- paste0(pathTo10X, 'fragments.tsv.gz')
regions <- paste0(pathTo10X, 'peaks.bed')
metrics <- paste0(pathTo10X, 'singlecell.csv')
cisTopicObject1 <- createcisTopicObjectFrom10X(fragments, regions, metrics, project.name='Run_1', min.cells=0)
# We set min.cells=0 to keep all rows (regions). When combined, regions that are not accessible in any cell in any
# of the runs will be taken out.
# Add _1 to cell names from run 1
cell.names <- cisTopicObject1@cell.names
new.cell.names <- paste0(cell.names, '_1')
cisTopicObject1 <- renameCells(cisTopicObject1, new.cell.names)
# Create object for the second run
pathTo10X <- '/Run_2/'
fragments <- paste0(pathTo10X, 'fragments.tsv.gz')
regions <- paste0(pathTo10X, 'peaks.bed')
metrics <- paste0(pathTo10X, 'singlecell.csv')
cisTopicObject2 <- createcisTopicObjectFrom10X(fragments, regions, metrics, project.name='Run_2', min.cells=0)
# Add _2 to cell names from run 2
cell.names <- cisTopicObject2@cell.names
new.cell.names <- paste0(cell.names, '_2')
cisTopicObject2 <- renameCells(cisTopicObject2, new.cell.names)
# Combine data
count.matrix <- cbind(cisTopicObject1@count.matrix, cisTopicObject2@count.matrix)
cell.data <- rbind(cisTopicObject1@cell.data, cisTopicObject2@cell.data)
region.data <- cbind(cisTopicObject1@region.data, cisTopicObject2@region.data)
# Create combined cisTopicObject
cisTopicObjectCombined <- createcisTopicObject(count.matrix, project.name='Combined')
cisTopicObjectCombined <- addCellMetadata(cisTopicObjectCombined, cell.data)
cisTopicObjectCombined <- addRegionMetadata(cisTopicObjectCombined, region.data)
I hope this is useful, let me know if you have further questions :)
Cheers,
C
from cistopic.
Here's that same code snippet, but generalised into a for loop for easy loading of multiple samples. Needs to have samples
set, and pathTo10X
depend on the within-loop sample
. Just leaving it here for posterity. Some sort of merging function would be nice eventually.
library(rlist)
count.matrix = list()
cell.data = list()
region.data = list()
samples =
for (sample in samples)
{
pathTo10X =
fragments = paste0(pathTo10X, 'fragments.tsv.gz')
regions = paste0(pathTo10X, 'peaks.bed')
metrics = paste0(pathTo10X, 'singlecell.csv')
cisTopicObject = createcisTopicObjectFrom10X(fragments, regions, metrics, project.name=sample, min.cells=0)
# Add sample name to cell names
cell.names = [email protected]
new.cell.names = paste0(sample, '_', cell.names)
cisTopicObject = renameCells(cisTopicObject, new.cell.names)
# Store parts of object for collapsing later
count.matrix[[sample]] = [email protected]
cell.data[[sample]] = [email protected]
region.data[[sample]] = [email protected]
}
# Combine data
count.matrix = list.cbind(count.matrix)
cell.data = list.rbind(cell.data)
region.data = list.cbind(region.data)
# Create combined cisTopicObject
cisTopicObjectCombined = createcisTopicObject(count.matrix, project.name='Combined')
cisTopicObjectCombined = addCellMetadata(cisTopicObjectCombined, cell.data)
cisTopicObjectCombined = addRegionMetadata(cisTopicObjectCombined, region.data)
from cistopic.
Related Issues (20)
- Question about createcisTopicObject HOT 1
- installation issue with ubuntu 20.04 HOT 3
- possibility to use BAM files from bulk ChIP HOT 1
- annotateRegions with own dataset HOT 1
- createcisTopicObject and genomic coordinates incompatibility error HOT 3
- input from fragments.tsv.gz? HOT 1
- Installation issue HOT 2
- Tutorial Dataset files HOT 1
- tSNE Clustering Thresholds HOT 1
- LDA run with Python and LogLikelihhod HOT 1
- How can I run cisTopic in R 4.0 HOT 2
- Ununsed Arguement error in cisTopic/TcisTarget HOT 1
- cisTopicObject <- selectModel(cisTopicObject) Error in .Call("rs_createGD") : C symbol name "rs_createGD" not in load table HOT 1
- Unused argument error while running topicsRcisTarget
- add cisTopic output to Seurat object? HOT 1
- Running Cistopic HOT 1
- Installation error "Failed to install 'unknown package' from Github: ..." HOT 1
- Loading Multiome data
- sha256sum download failed HOT 1
- Error in metadataFeather(path) : Invalid: Not a feather file HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cistopic.