<p>You could add something like <code>A1.obs[&quot;Classification_obj&quot;] = [c+&quot;_A1&quot; for c in adata.obs[&quot;Classification&quot;]]</code> but the classification should also be clear in the merged adata object from the &quot;Classification&quot; and &quot;batch&quot; labels together</p>
<p>More importantly, after running hashsolo, you must delete your hashtag feature_types from adata.var, something like <code>A1 = A1[:, [g for g in A1.var.index if g not in list_of_Ab_hashtags]]</code> . Once you have the cell type classifications and are happy with them (can be worth doing further QC first), you can throw away that Ab count data for the downstream standard GEX analysis</p>

CC BY-SA 4.0
2023-04-26T17:17:32.820Z
Thank you so much! That really helped. Should I also delete the cells that were classified as doublets and negative?
pythonbeginner
CC BY-SA 4.0
2023-04-25T21:01:03.937Z
2023-04-25T21:01:03.937Z
Chris_Rands
<p>I used hashsolo to demultiplex my data and I am a bit confused as to how to continue the analysis.
Following hashsolo my samples look like below:</p>
<pre><code>A1
AnnData object with n_obs × n_vars = 8684 × 18197
    obs: 'most_likely_hypothesis', 'Classification', 'n_genes'
    var: 'gene_ids', 'feature_types', 'genome', 'n_counts', 'n_cells'
    layers: 'counts'

A2
AnnData object with n_obs × n_vars = 9901 × 20862
    obs: 'most_likely_hypothesis', 'Classification'
    var: 'gene_ids', 'feature_types', 'genome', 'n_counts'
    layers: 'counts'
</code></pre>
<p>I have a few questions regarding the analysis. My initial plan was to merge the 2 samples. However, when I do that and I print the Classification the merged object seems to add the classification counts because the same hashtag names were used.</p>
<p>For example hashtag 1 has 949 in sample A1 and 1286 in sample A2.
When I do print<code>(adata.obs['Classification'].value_counts())</code> hashtag1 has 2235 counts. Will that be a problem with the analysis?
I merged the object like this:</p>
<pre><code># add some metadata
A1.obs['type']=&quot;C&quot;
A2.obs['type']=&quot;T&quot;

# merge into one object.
adata = A1.concatenate(A2)

adata
AnnData object with n_obs × n_vars = 18585 × 18064
    obs: 'most_likely_hypothesis', 'Classification', 'n_genes', 'type', 'batch'
    var: 'gene_ids', 'feature_types', 'genome', 'n_counts-0', 'n_cells-0', 'n_counts-1'
    layers: 'counts'

print(adata.obs['Classification'].value_counts())
Hashtag_2_Antibody    5134
Hashtag_3_Antibody    3150
Hashtag_4_Antibody    2000
Hashtag_1_Antibody    2235
Doublet                                         1598
Negative                                           9
Name: Classification, dtype: int64
</code></pre>
<p>My hashtags also show up wen I do <code>sc.pl.highest_expr_genes(adata, n_top=20, )</code>. Is that a problem?</p>
<p><a href="https://i.sstatic.net/D4C0p.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/D4C0p.png" alt="enter image description here" /></a>
I would also like to plot a UMAP following leiden for each hashtagged sample but I am a bit confused on how to do that. Normally, I would add information such as sample or type on metadata and color by sample for example. But if I try to color by classification it will merge the hashtags from both samples.</p>
<p>Thank you</p>

<rna><umap><hashing>
How to analyze hashtagged data with scanpy?
# How to analyze hashtagged data with scanpy?

(Asked by: username_0 on 2023-04-25)

I used hashsolo to demultiplex my data and I am a bit confused as to how to continue the analysis.
Following hashsolo my samples look like below:
A1
AnnData object with n_obs × n_vars = 8684 × 18197
    obs: 'most_likely_hypothesis', 'Classification', 'n_genes'
    var: 'gene_ids', 'feature_types', 'genome', 'n_counts', 'n_cells'
    layers: 'counts'

A2
AnnData object with n_obs × n_vars = 9901 × 20862
    obs: 'most_likely_hypothesis', 'Classification'
    var: 'gene_ids', 'feature_types', 'genome', 'n_counts'
    layers: 'counts'

I have a few questions regarding the analysis. My initial plan was to merge the 2 samples. However, when I do that and I print the Classification the merged object seems to add the classification counts because the same hashtag names were used.
For example hashtag 1 has 949 in sample A1 and 1286 in sample A2.
When I do print(adata.obs['Classification'].value_counts()) hashtag1 has 2235 counts. Will that be a problem with the analysis?
I merged the object like this:
# add some metadata
A1.obs['type']="C"
A2.obs['type']="T"

# merge into one object.
adata = A1.concatenate(A2)

adata
AnnData object with n_obs × n_vars = 18585 × 18064
    obs: 'most_likely_hypothesis', 'Classification', 'n_genes', 'type', 'batch'
    var: 'gene_ids', 'feature_types', 'genome', 'n_counts-0', 'n_cells-0', 'n_counts-1'
    layers: 'counts'

print(adata.obs['Classification'].value_counts())
Hashtag_2_Antibody    5134
Hashtag_3_Antibody    3150
Hashtag_4_Antibody    2000
Hashtag_1_Antibody    2235
Doublet                                         1598
Negative                                           9
Name: Classification, dtype: int64

My hashtags also show up wen I do sc.pl.highest_expr_genes(adata, n_top=20, ). Is that a problem?

I would also like to plot a UMAP following leiden for each hashtagged sample but I am a bit confused on how to do that. Normally, I would add information such as sample or type on metadata and color by sample for example. But if I try to color by classification it will merge the hashtags from both samples.
Thank you

**Tags:** rna, umap, hashing

---

## 1 answers

### Answer by username_1 on 2023-04-25. Score: 0 | Accepted answer

You could add something like `A1.obs["Classification_obj"] = [c+"_A1" for c in adata.obs["Classification"]]` but the classification should also be clear in the merged adata object from the "Classification" and "batch" labels together

More importantly, after running hashsolo, you must delete your hashtag feature\_types from adata.var, something like `A1 = A1[:, [g for g in A1.var.index if g not in list_of_Ab_hashtags]]` . Once you have the cell type classifications and are happy with them (can be worth doing further QC first), you can throw away that Ab count data for the downstream standard GEX analysis

> **Comments:**
> **username_0**: Thank you so much! That really helped. Should I also delete the cells that were classified as doublets and negative?  

---

