<jupyter_start><jupyter_text>Load gene count matrices and get some statistics<jupyter_code>dropseq = pd.read_table('../dropseq_mccarroll_out/out_gene_exon_tagged.dge.txt.gz', index_col=0)
kallisto = pd.read_table("../kallisto_mccarroll_out/v2/gene_matrix.txt", index_col=0)
salmon_in = pd.read_table("../salmon_mccarroll_out/mccarroll_symbol.csv", index_col=0, sep=',')
salmon = salmon_in.T
print("Genes detected in Drop-seq_tools-1.13:", len(dropseq))
print("Genes detected in kallisto bus:", len(kallisto))
print("Genes detected in salmon alevin:", len(salmon))
print("Barcodes detected in Drop-seq_tools-1.13:",len(dropseq.iloc[0,:]))
print("Barcodes detected in kallisto bus:", len(kallisto.iloc[0,:]))
print("Barcodes detected in salmon alevin:", len(salmon.iloc[0,:]))<jupyter_output>Genes detected in Drop-seq_tools-1.13: 26124
Genes detected in kallisto bus: 20295
Genes detected in salmon alevin: 35126
Barcodes detected in Drop-seq_tools-1.13: 1000
Barcodes detected in kallisto bus: 1034
Barcodes detected in salmon alevin: 825<jupyter_text>Extract common barcodes and gene lists for correlation analysis<jupyter_code>combine = pd.concat([dropseq, kallisto, salmon], axis=0, join='inner')
len(combine)
dropseq2 = combine.iloc[0:len(dropseq),]
kallisto2 = combine.iloc[len(dropseq):(len(dropseq)+len(kallisto)),]
salmon2 = combine.iloc[(len(dropseq)+len(kallisto)):len(combine),]
dropseq_uniq = dropseq2[~dropseq2.index.duplicated(keep=False)]
kallisto_uniq = kallisto2[~kallisto2.index.duplicated(keep=False)]
salmon_uniq = salmon2[~salmon2.index.duplicated(keep=False)]
#dropseq_uniq = dropseq2[~dropseq2.index.duplicated(keep='first')]
#kallisto_uniq = kallisto2[~kallisto2.index.duplicated(keep='first')]
#salmon_uniq = salmon2[~salmon2.index.duplicated(keep='first')]
print(len(dropseq2),len(dropseq_uniq))
print(len(kallisto2),len(kallisto_uniq))
print(len(salmon2),len(salmon_uniq))
genes_intersect = list(set(dropseq_uniq.index) & set(kallisto_uniq.index) & set(salmon_uniq.index))
dropseq_intersect = dropseq_uniq.loc[genes_intersect,:]
kallisto_intersect = kallisto_uniq.loc[genes_intersect,:]
salmon_intersect = salmon_uniq.loc[genes_intersect,:]
print("Detected overlapping genes among Drop-seq_tools-1.13, kallisto bus & salmon alevin:", len(dropseq_intersect), len(kallisto_intersect), len(salmon_intersect))
print("Detected overlapping barcodes among Drop-seq_tools-1.13, kallisto bus & salmon alevin:", len(dropseq_intersect.iloc[0,:]), len(kallisto_intersect.iloc[0,:]), len(salmon_intersect.iloc[0,:]))<jupyter_output>Detected overlapping genes among Drop-seq_tools-1.13, kallisto bus & salmon alevin: 17611 17611 17611
Detected overlapping barcodes among Drop-seq_tools-1.13, kallisto bus & salmon alevin: 695 695 695<jupyter_text>For each barcode, calculate total numbers of gene counts determined by Drop-seq, kallisto and salmon pipelines, and Pearson's correlation coefficient between Drop-seq gene counts, kallisto gene counts and salmon gene counts.<jupyter_code>corr = pd.DataFrame(columns=['Pearson r1','Pearson r2','Pearson r3','Counts Dropseq', 'Counts Kallisto', 'Counts Salmon'])
for i in list(kallisto_intersect):
    corr.loc[i] = [dropseq_intersect[[i]].corrwith(kallisto_intersect[[i]])[0], 
                   dropseq_intersect[[i]].corrwith(salmon_intersect[[i]])[0], 
                   kallisto_intersect[[i]].corrwith(salmon_intersect[[i]])[0], 
                   dropseq_intersect[[i]].sum()[0], kallisto_intersect[[i]].sum()[0], salmon_intersect[[i]].sum()[0]]
corr[0:10]
xy1 = np.vstack([corr.iloc[:,3], corr.iloc[:,4]])
z1 = gaussian_kde(xy1)(xy1)
plt.scatter(corr.iloc[:,3], corr.iloc[:,4], c=z1, s=10, edgecolor='')
plt.title('Total counts, colored by density')
plt.xlabel('Dropseq')
plt.ylabel('kallisto')
plt.colorbar()
plt.xlim(0,20000)
plt.ylim(0,20000)
xy1 = np.vstack([corr.iloc[:,3], corr.iloc[:,5]])
z1 = gaussian_kde(xy1)(xy1)
plt.scatter(corr.iloc[:,3], corr.iloc[:,5], c=z1, s=10, edgecolor='')
plt.title('Total counts, colored by density')
plt.xlabel('Dropseq')
plt.ylabel('Salmon')
plt.colorbar()
plt.xlim(0,20000)
plt.ylim(0,20000)
xy1 = np.vstack([corr.iloc[:,4], corr.iloc[:,5]])
z1 = gaussian_kde(xy1)(xy1)
plt.scatter(corr.iloc[:,4], corr.iloc[:,5], c=z1, s=10, edgecolor='')
plt.title('Total counts, colored by density')
plt.xlabel('Kallisto')
plt.ylabel('Salmon')
plt.colorbar()
plt.xlim(0,20000)
plt.ylim(0,20000)
cm = matplotlib.cm.get_cmap('viridis')
colorlist=corr.iloc[:,0]
plt.scatter(corr.iloc[:,3], corr.iloc[:,4], c=colorlist, vmin=0, vmax=1, s=10, cmap=cm, edgecolor='')
plt.title('Total counts, colored by Pearsons r')
plt.xlabel('Dropseq')
plt.ylabel('kallisto')
plt.colorbar()
plt.xlim(0,20000)
plt.ylim(0,20000)
cm = matplotlib.cm.get_cmap('viridis')
colorlist=corr.iloc[:,1]
plt.scatter(corr.iloc[:,3], corr.iloc[:,5], c=colorlist, vmin=0, vmax=1, s=10, cmap=cm, edgecolor='')
plt.title('Total counts, colored by Pearsons r')
plt.xlabel('Dropseq')
plt.ylabel('salmon')
plt.colorbar()
plt.xlim(0,20000)
plt.ylim(0,20000)
cm = matplotlib.cm.get_cmap('viridis')
colorlist=corr.iloc[:,0]
plt.scatter(corr.iloc[:,4], corr.iloc[:,5], c=colorlist, vmin=0, vmax=1, s=10, cmap=cm, edgecolor='')
plt.title('Total counts, colored by Pearsons r')
plt.xlabel('Kallisto')
plt.ylabel('Salmon')
plt.colorbar()
plt.xlim(0,20000)
plt.ylim(0,20000)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17174359932722855, 'fraction_numerical': 0.04522519155298075, 'mean_word_length': 7.773770491803279, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '378742', 'license': 'BSD-2-Clause', 'n_tokens_mistral': 2289, 'n_tokens_neox': 2130, 'n_words': 354, 'path': 'notebooks/mccarroll/comparison_mccarroll_v2.ipynb', 'repo_name': 'pachterlab/PM_2018', 'size': '5351'}