question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

scv.utils.merge show less number of Cell barcode and change obs_names

See original GitHub issue

Hi,

I have two samples data sets and ran velocyto each. I am trying to use scv.utils.merge(1st_adata, 2nd_adata) to merge two data sets. After scv.utils.merge, less number of cells and changed obs_names as well. It seems n_vars are kept while n_obs is changed. Is there any way to merge two sets without loss? (e.g. 1st set = (n_obs × n_vars = 9206 × 55421), 2nd set = (n_obs × n_vars = 8941 × 55421), merged set = (n_obs × n_vars = 18147 × 55421))

1st data

adata AnnData object with n_obs × n_vars = 9206 × 55421 var: ‘Accession’, ‘Chromosome’, ‘End’, ‘Start’, ‘Strand’ layers: ‘ambiguous’, ‘matrix’, ‘spliced’, ‘unspliced’

adata.obs_names Index([‘possorted_genome_bam_T851Q:AAACCCAAGGCTCTAT’, ‘possorted_genome_bam_T851Q:AAACCCAAGTGACACG’, … ‘possorted_genome_bam_T851Q:TTTGTTGTCGAACGCC’], dtype=‘object’, length=9206)`

2nd data

adata_2 AnnData object with n_obs × n_vars = 8941 × 55421 var: ‘Accession’, ‘Chromosome’, ‘End’, ‘Start’, ‘Strand’ layers: ‘ambiguous’, ‘matrix’, ‘spliced’, ‘unspliced’

adata_2.obs_names Index([‘possorted_genome_bam_OB274:AAACCCAGTAGTCTGT’, ‘possorted_genome_bam_OB274:AAACCCAGTCGGCACT’, … ‘possorted_genome_bam_OB274:TTTGTTGTCTCGCTCA’], dtype=‘object’, length=8941)’

merge two AnnData

merged_adata = scv.utils.merge(adata, adata_2) merged_adata AnnData object with n_obs × n_vars = 31 × 55421 obs: ‘initial_size_unspliced’, ‘initial_size_spliced’, ‘initial_size’ var: ‘Accession’, ‘Chromosome’, ‘End’, ‘Start’, ‘Strand’ layers: ‘ambiguous’, ‘matrix’, ‘spliced’, ‘unspliced’’

check 2nd data obs names again

adata_2.obs_names Index([‘AAACCCAGTAGTCTGT’, ‘AAACCCAGTCGGCACT’, ‘AAACCCAGTTAGGCTT’, … ‘TTTGTTGTCTCGCTCA’], dtype=‘object’, length=8941)’

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
VolkerBergencommented, May 26, 2020

In that case, you wouldn’t want to merge but to concatenate the two datasets, which can be done with adata = adata1.concatenate(adata2).

0reactions
VolkerBergencommented, Jun 11, 2020

Great to hear, that it got resolved. Will need to add some informative warning in anndata.concatenate.

Read more comments on GitHub >

github_iconTop Results From Across the Web

new-10kPBMC-Scanpy
This notebook should introduce you to some typical tasks, using Scanpy eco-system. Scanpy notebooks and tutorials are available here.
Read more >
Spatial mapping of cell types across the mouse brain (2/3)
This notebook demonstrates how to use the cell2location model for mapping a single cell reference cell types onto a spatial transcriptomic dataset.
Read more >
Untitled
Tolmuimejad, Show me the way styx meaning, Park tool stand price, ... Urologe wuppertal alter markt, Music scroller obs, Names of states on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found