{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import pdb,sys,os\n", "import scvelo as scv\n", "from junlib.File import *\n", "from matplotlib.colors import ListedColormap" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "scv.set_figure_params()" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "Variable names are not unique. To make them unique, call `.var_names_make_unique`.\n" ] } ], "source": [ "adata = scv.read(\"onefilepercell_SRR1930899_sort_and_others_2ITJU.loom\", cache=True)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "AnnData object with n_obs × n_vars = 252 × 55416\n", " var: 'Accession', 'Chromosome', 'End', 'Start', 'Strand'\n", " layers: 'ambiguous', 'matrix', 'spliced', 'unspliced'" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "adata" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "Variable names are not unique. To make them unique, call `.var_names_make_unique`.\n", "Variable names are not unique. To make them unique, call `.var_names_make_unique`.\n", "Variable names are not unique. To make them unique, call `.var_names_make_unique`.\n", "Variable names are not unique. To make them unique, call `.var_names_make_unique`.\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Normalized count data: X, spliced, unspliced.\n", "Logarithmized X.\n", "computing neighbors\n", " finished (0:00:04) --> added \n", " 'distances' and 'connectivities', weighted adjacency matrices (adata.obsp)\n", "computing moments based on connectivities\n", " finished (0:00:00) --> added \n", " 'Ms' and 'Mu', moments of un/spliced abundances (adata.layers)\n" ] } ], "source": [ "scv.pp.filter_and_normalize(adata)\n", "scv.pp.moments(adata)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "computing velocities\n", " finished (0:00:01) --> added \n", " 'velocity', velocity vectors for each individual cell (adata.layers)\n" ] } ], "source": [ "scv.tl.velocity(adata, mode='stochastic')" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "computing velocity graph (using 1/20 cores)\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "9acb1e151d0f40208fcd0a517e27bb43", "version_major": 2, "version_minor": 0 }, "text/plain": [ " 0%| | 0/252 [00:00, ?cells/s]" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ " finished (0:00:01) --> added \n", " 'velocity_graph', sparse matrix with cosine correlations (adata.uns)\n" ] } ], "source": [ "scv.tl.velocity_graph(adata)" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | initial_size_spliced | \n", "initial_size_unspliced | \n", "initial_size | \n", "n_counts | \n", "velocity_self_transition | \n", "
---|---|---|---|---|---|
CellID | \n", "\n", " | \n", " | \n", " | \n", " | \n", " |
onefilepercell_SRR1930899_sort_and_others_2ITJU:SRR1930899_sort.bam | \n", "56005 | \n", "361717 | \n", "56005.0 | \n", "50013.496094 | \n", "0.054800 | \n", "
onefilepercell_SRR1930899_sort_and_others_2ITJU:SRR1930900_sort.bam | \n", "39658 | \n", "277568 | \n", "39658.0 | \n", "50013.500000 | \n", "0.077808 | \n", "
onefilepercell_SRR1930899_sort_and_others_2ITJU:SRR1930901_sort.bam | \n", "54922 | \n", "399061 | \n", "54922.0 | \n", "50013.503906 | \n", "0.049032 | \n", "
onefilepercell_SRR1930899_sort_and_others_2ITJU:SRR1930902_sort.bam | \n", "48893 | \n", "315096 | \n", "48893.0 | \n", "50013.500000 | \n", "0.081672 | \n", "
onefilepercell_SRR1930899_sort_and_others_2ITJU:SRR1930903_sort.bam | \n", "25221 | \n", "165064 | \n", "25221.0 | \n", "50013.503906 | \n", "0.031735 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
onefilepercell_SRR1930899_sort_and_others_2ITJU:SRR1931148_sort.bam | \n", "40435 | \n", "257848 | \n", "40435.0 | \n", "50013.500000 | \n", "0.071260 | \n", "
onefilepercell_SRR1930899_sort_and_others_2ITJU:SRR1931149_sort.bam | \n", "52866 | \n", "423014 | \n", "52866.0 | \n", "50013.500000 | \n", "0.074533 | \n", "
onefilepercell_SRR1930899_sort_and_others_2ITJU:SRR1931150_sort.bam | \n", "57981 | \n", "426368 | \n", "57981.0 | \n", "50013.500000 | \n", "0.086959 | \n", "
onefilepercell_SRR1930899_sort_and_others_2ITJU:SRR1931151_sort.bam | \n", "42282 | \n", "359211 | \n", "42282.0 | \n", "50013.503906 | \n", "0.018178 | \n", "
onefilepercell_SRR1930899_sort_and_others_2ITJU:SRR1931153_sort.bam | \n", "32331 | \n", "256635 | \n", "32331.0 | \n", "50013.500000 | \n", "0.050687 | \n", "
252 rows × 5 columns
\n", "\n", " | initial_size_spliced | \n", "initial_size_unspliced | \n", "initial_size | \n", "n_counts | \n", "velocity_self_transition | \n", "type | \n", "
---|---|---|---|---|---|---|
CellID | \n", "\n", " | \n", " | \n", " | \n", " | \n", " | \n", " |
onefilepercell_SRR1930899_sort_and_others_2ITJU:SRR1930899_sort.bam | \n", "56005 | \n", "361717 | \n", "56005.0 | \n", "50013.496094 | \n", "0.054800 | \n", "MEF | \n", "
onefilepercell_SRR1930899_sort_and_others_2ITJU:SRR1930900_sort.bam | \n", "39658 | \n", "277568 | \n", "39658.0 | \n", "50013.500000 | \n", "0.077808 | \n", "MEF | \n", "
onefilepercell_SRR1930899_sort_and_others_2ITJU:SRR1930901_sort.bam | \n", "54922 | \n", "399061 | \n", "54922.0 | \n", "50013.503906 | \n", "0.049032 | \n", "MEF | \n", "
onefilepercell_SRR1930899_sort_and_others_2ITJU:SRR1930902_sort.bam | \n", "48893 | \n", "315096 | \n", "48893.0 | \n", "50013.500000 | \n", "0.081672 | \n", "MEF | \n", "
onefilepercell_SRR1930899_sort_and_others_2ITJU:SRR1930903_sort.bam | \n", "25221 | \n", "165064 | \n", "25221.0 | \n", "50013.503906 | \n", "0.031735 | \n", "MEF | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
onefilepercell_SRR1930899_sort_and_others_2ITJU:SRR1931148_sort.bam | \n", "40435 | \n", "257848 | \n", "40435.0 | \n", "50013.500000 | \n", "0.071260 | \n", "Neuron | \n", "
onefilepercell_SRR1930899_sort_and_others_2ITJU:SRR1931149_sort.bam | \n", "52866 | \n", "423014 | \n", "52866.0 | \n", "50013.500000 | \n", "0.074533 | \n", "Fibroblast | \n", "
onefilepercell_SRR1930899_sort_and_others_2ITJU:SRR1931150_sort.bam | \n", "57981 | \n", "426368 | \n", "57981.0 | \n", "50013.500000 | \n", "0.086959 | \n", "Fibroblast | \n", "
onefilepercell_SRR1930899_sort_and_others_2ITJU:SRR1931151_sort.bam | \n", "42282 | \n", "359211 | \n", "42282.0 | \n", "50013.503906 | \n", "0.018178 | \n", "Myocyte | \n", "
onefilepercell_SRR1930899_sort_and_others_2ITJU:SRR1931153_sort.bam | \n", "32331 | \n", "256635 | \n", "32331.0 | \n", "50013.500000 | \n", "0.050687 | \n", "Fibroblast | \n", "
252 rows × 6 columns
\n", "