{"id":7128,"date":"2023-10-19T13:15:57","date_gmt":"2023-10-19T12:15:57","guid":{"rendered":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/?page_id=7128"},"modified":"2023-10-19T13:21:30","modified_gmt":"2023-10-19T12:21:30","slug":"cell2location","status":"publish","type":"page","link":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/software\/applications\/cell2location\/","title":{"rendered":"Cell2Location"},"content":{"rendered":"<h2>Overview<\/h2>\n<p><a href=\"https:\/\/github.com\/BayraktarLab\/cell2location\">Cell2Location<\/a> is a python application providing comprehensive mapping of tissue cell architecture via integrated single cell and spatial transcriptomics (cell2location model).<\/p>\n<p>We have not installed cell2location centrally but instead show below how to install it in a <em>conda environment<\/em> in your home directory.<\/p>\n<h2>Restrictions on use<\/h2>\n<p>Cell2location is made available under the <a href=\"https:\/\/github.com\/BayraktarLab\/cell2location\/blob\/master\/LICENSE\">Apache License v2.0<\/a>. All usage must adhere to this license.<\/p>\n<p>As per the instruction on the cell2location github page, if you use cell2location please cite their paper:<\/p>\n<p>Kleshchevnikov, V., Shmatko, A., Dann, E. et al. Cell2location maps fine-grained cell types in spatial transcriptomics. Nat Biotechnol (2022). <a href=\"https:\/\/doi.org\/10.1038\/s41587-021-01139-4 https:\/\/www.nature.com\/articles\/s41587-021-01139-4\">https:\/\/doi.org\/10.1038\/s41587-021-01139-4 https:\/\/www.nature.com\/articles\/s41587-021-01139-4<\/a>.<\/p>\n<h2>Installation Procedure<\/h2>\n<p>The following instructions have been confirmed to work by a user of cell2location on the CSF (who also runs it on the GPUs):<\/p>\n<pre>\r\n# From the CSF login node, start an interactive session so you have access to\r\n# the outside world - needed to download the software:\r\nqrsh -l short\r\n #\r\n # Wait to be logged in to a compute node, then:\r\n\r\nexport PYTHONNOUSERSITE=True\r\nexport ENAME=<strong>cell2loc_env<\/strong>                    # <strong>Make a note of what you name your conda env<\/strong>!\r\nmodule load apps\/binapps\/anaconda3\/2022.10   # Provides python 3.9. New versions of c2l may need newer.\r\npython --version\r\n\r\n# Prevent python installs escaping from your conda env\r\nrm ~\/.pydistutils.cfg\r\n\r\n# Create a new conda env (will be in your ~\/.conda directory)\r\nconda create -y -n $ENAME python=3.9\r\n\r\n# Activate the env. Note: we DO NOT use 'conda activate ...' because that\r\n# would force this version of python on you every time you log in (it adds\r\n# to your ~\/.bashrc file. By using 'source activate ...' we avoid that.) \r\nsource activate $ENAME\r\n\r\n# Now install cell2location\r\npip --no-python-version-warning --isolated install cell2location[tutorials]\r\n\r\n# If you wish to use it in a jupyter notebook, the following two installs will help\r\npip --no-python-version-warning --isolated install ipykernel \r\npip --no-python-version-warning --isolated install ipywidgets \r\n\r\n# Now install a cell2location notebook kernel (you'll see this is the menu in your notebook.)\r\npython -m ipykernel install --user --name=$ENAME --display-name='Environment ('${ENAME}')'\r\n\r\n# If you wish to install further python packages, do so now ...\r\n\r\n# We've finished with the conda env now that we've installed everything\r\nsource deactivate\r\n# Leave the interactive session and go back to the login node\r\nexit\r\n<\/pre>\n<h2>Running the application<\/h2>\n<p>Please do not run cell2location on the login node. Jobs should be submitted to the compute nodes via batch.<\/p>\n<h3>Serial batch job submission<\/h3>\n<p>Create a batch submission script (which will load the modulefile in the jobscript), for example:<\/p>\n<pre>\r\n#!\/bin\/bash --login\r\n#$ -cwd             # Job will run from the current directory\r\n                    # NO -V line - we load modulefiles in the jobscript\r\n\r\nmodule load apps\/binapps\/anaconda3\/2022.10\r\n\r\n# Activate your conda env. Use the name you used above when creating it.\r\nsource activate <strong>cell2loc_env<\/strong>\r\n\r\npython <em>myscript.py<\/em>\r\n<\/pre>\n<p>Submit the jobscript using: <\/p>\n<pre>qsub <em>scriptname<\/em><\/pre>\n<p>where <em>scriptname<\/em> is the name of your jobscript.<\/p>\n<p>Please see the <a href=\"\/csf3\/batch\/gpu-jobs\/\">GPU jobs<\/a> instructions for submitting to the GPU nodes.<\/p>\n<h3>Jupyter Notebook job<\/h3>\n<p>Here are the brief details on submitting a jupyter notebook job.<\/p>\n<pre>\r\n# On the CSF login node:\r\nmodule purge\r\nmodule load apps\/binapps\/anaconda3\/2022.10 apps\/binapps\/jupyter-notebook\/any\r\nexport PYTHONNOUSERSITE=True\r\n# Activate your conda env. Use the name you used above when creating it.\r\nsource activate <strong>cell2loc_env<\/strong>\r\njupyter-notebook-csf\r\n          #\r\n          # Add flags to this command to change the type of job (e.g., -g or -G for GPU jobs.)\r\n          # Run 'jupyter-notebook-csf -h' for further help\r\n\r\n# Follow the instructions displayed by that command. This will let you connect\r\n# a web-browser on your laptop\/desktop to the CFS job. \r\n#\r\n# In the notebook webpage, you'll be able to select the \"Environment (cell2loc_env)\" \r\n# kernel in which to run your notebook commands.\r\n<\/pre>\n<p>For further details, including how to submit GPU-enabled jupyter notebook jobs, and help with each step, please see our <a href=\"\/csf3\/software\/applications\/jupyter-notebook\/\">Jupyter Notebook instructions<\/a>.<\/p>\n<h2>Further info<\/h2>\n<ul>\n<li><a href=\"https:\/\/github.com\/BayraktarLab\/cell2location\">cell2location github<\/a><\/li>\n<\/ul>\n<h2>Updates<\/h2>\n<p>None.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Overview Cell2Location is a python application providing comprehensive mapping of tissue cell architecture via integrated single cell and spatial transcriptomics (cell2location model). We have not installed cell2location centrally but instead show below how to install it in a conda environment in your home directory. Restrictions on use Cell2location is made available under the Apache License v2.0. All usage must adhere to this license. As per the instruction on the cell2location github page, if you use.. <a href=\"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/software\/applications\/cell2location\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":86,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-7128","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages\/7128","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/comments?post=7128"}],"version-history":[{"count":7,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages\/7128\/revisions"}],"predecessor-version":[{"id":7136,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages\/7128\/revisions\/7136"}],"up":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages\/86"}],"wp:attachment":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/media?parent=7128"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}