此内容受密码保护。如需查阅,请在下列字段中输入您的密码。

pip install jupyterlab
pip install jupyter_contrib_nbextensions
jupyter contrib nbextension install –user
pip install jupyter_nbextensions_configurator
jupyter nbextensions_configurator enable –user

pip install anndata
pip install scanpy
pip install scvelo
pip install episcanpy
conda install -c conda-forge r-base=4.0.3
conda install -c conda-forge libgit2     or brew install libgit2    on mac
conda install -c conda-forge r-cairo
conda install -c conda-forge r-hdf5r
install.packages(c(“devtools”,”tidyverse”))

devtools::install_git(“https://gitee.com/chansigit/seurat.git”)
devtools::install_git(“https://gitee.com/chansigit/uwot.git”)
devtools::install_git(“https://gitee.com/chansigit/liger.git”)
devtools::install_git(“https://gitee.com/chansigit/seurat-wrappers.git”)

if (!requireNamespace(“BiocManager”, quietly = TRUE))
install.packages(“BiocManager”)
BiocManager::install(version = “3.12”)
BiocManager::install(c(
‘BiocGenerics’, ‘DelayedArray’, ‘DelayedMatrixStats’,
‘limma’, ‘S4Vectors’, ‘SingleCellExperiment’,’multtest’,
“SingleCellExperiment”,”GenomicRanges”,”scRNAseq”,
“Rhdf5lib”,”pcaMethods”,”DropletUtils”,”scater”,
“SingleR”,”geneplotter”,”AUCell”,”GSVA”,”ComplexHeatmap”,
“AnnotationHub”,’SummarizedExperiment’, ‘batchelor’, ‘Matrix.utils’,
“clusterProfiler”,”ChIPseeker”,”ChIPpeakAnno”))

拒绝内卷,出关开拓

我们往往会在内网上建立jupyter notebook、rstudio server等web服务,当我们希望将这些web服务放在公网上时,会遇到一些问题:比如内网机器虽然可以访问外部互联网,但是却没有公网IP地址,以至于无法在公网上连接到内网机器上去。

要解决这个问题,我们可以借助ssh端口转发技术,把内网机器上的web服务(比如运行在8888端口上的jupyter)转发到一台有公网IP的另一台机器上去,具体操作如下,我们再内网机器上运行:

ssh -C -N -R 0.0.0.0:12345:localhost:8888  chensijie@公网服务器IP -p22 \
-o TCPKeepAlive=yes -o ServerAliveInterval=30 -o StrictHostKeyChecking=no

运行完后,我们在另一台有公网IP的机器上就可以用localhost:12345来访问内网机器的8888 web服务端口了。

但这仍然不够,我们虽然能这台有公网IP的机器上访问内网机器的web服务了,但也仅限于在公网机器自己上可以用localhost:12345来访问,并没有把它发布出去,大众仍然不能用“公网服务器IP:端口号”的方式访问该web服务。这里我们就需要一个反向代理服务。这里我们使用mitmproxy建立该服务(安装方法参见[2])

mitmproxy -p 8080 --mode reverse:https://localhost:12345 --set block_global=false

运行完这些后,大众就可以用“公网服务器IP:端口号”的方式访问该web服务了。

 

参考资料:
[1]The simplest possible reverse proxy [closed] https://stackoverflow.com/questions/17107431/the-simplest-possible-reverse-proxy
This page introduced the mitmproxy based way of building a reverse proxy

[2]This page tells you how to install mitmproxy. Use hoembrew on mac, use pip or pipx on others. https://docs.mitmproxy.org/stable/overview-installation/

[3]If you hope to build a reverse proxy by yourself, find information at https://segmentfault.com/q/1010000000175242 or https://github.com/MollardMichael/python-reverse-proxy/blob/master/proxy.py

[4]Other ways achieving the same goals may be found at https://taigezhang.com/blog/2019/04/21/%E4%BD%BF%E7%94%A8frp%E5%86%85%E7%BD%91%E7%A9%BF%E9%80%8F%E5%B9%B6%E8%BF%9C%E7%A8%8B%E8%BF%9E%E6%8E%A5Jupyter%20Notebook/

 

后记:

如果在使用mitmproxy的过程中出现 Cannot establish TLS with 192.168.88.128:8080 (sni: 192.168.88.128): TlsException(“SSL handshake error: Error([(‘SSL routines’, ‘ssl3_get_record’, ‘wrong version number’)],)”,)错误,将https换成http应该就可以解决问题。

如果报错HttpReadDisconnect(‘Server disconnected’), 那么请检查一下内网的web服务是否成功打开。

如果jupyter运行时,后台报错Blocking Cross Origin API request for /api/XXX,请在位于~/. jupyter/jupyter_notebook_config.py.配置文件中修改

c.NotebookApp.allow_origin = '*'

https://academic.oup.com/bioinformatics/article/26/22/2897/227791

给定一群统计量的观测值,我们描述一下用FastPval为每个观测值赋予P值得算法。FastPval的P值计算分为两个步骤,并且利用了这些统计量的分布右尾来计算统计量(?)。

在第一个步骤,我们随机地从原始数据集O中采样出N个样本构成一个子集(为提升效率,N通常是O的百分之一的规模)。我们对N排序,并找到一个阈值s_c,使得大于s_c是N的top P portion(N和P都是用户设定的,N默认设置为100,000而P默认设置为0.001)。

得到这个阈值后,我们再扫描数据集O,把大于阈值 s_c的值放到集合M中去,也对M排序,得到M里的最大值s_m。我们把排了序的N和M保存好,作为M1和M2两个model。

那么在第二个步骤,新来一个统计量s时,为计算它的P值,我们先把它和s_c比较:如果s\leq s_c,我们就在M1中计算它的P值,否则就在M2中计算它的P值。如果s\geq s_M,这就意味着s超过了我们的采样范围,我们将使用理论分布来计算它的P值或者简单地将它的值设置为0(取决于用户偏好;如果采用normal distribution或者extreme value distribution的理论分布,其分布参数由N数据集估计)。

 

For simplicity, here we illustrate our method in a two-stage approach and use the right tail of the distribution to calculate the statistics. In the first stage, we randomly sample a subset N from the original large dataset O. N is usually less than one-hundredth of the size of O, thus saving processing time. We sort N and obtain a cutoff score Sc representing the top P portion of N. Both N and P are parameters specified by the users, and are set to N = 100 000 and P = 0.001 by the default. We then scan the original set and put scores greater than Sc into our second subset M, and we obtain the maximum score Sm in M. The two subsets N and M are sorted, saved, and serve as our two models (M1 and M2). To calculate the P-value for a new score S, we compare S with Sc. If S ≤ Sc, we will find its P-value in M1. Otherwise we use M2. If S > Sm, indicating S is out of our resampling score range, we use theoretical distribution to calculate its P-value or simply set the P-value to 0, at the user’s preference. The parameters of two theoretical distributions, normal and extreme value distributions, were obtained from dataset N.

Here we described a protocol establishing single-cell analysis platform on win10

 

conda create -n r403py38 python=3.8 numpy matplotlib pandas seaborn
conda activate r403py38 
conda install anaconda-clean 
anaconda-clean --yes conda 
config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/ 

# install compilers 
conda install -c conda-forge llvmlite=0.35 
conda install -c msys2 m2w64-gcc
conda install -c msys2 m2w64-gcc-fortran

# install R 
conda install -c conda-forge r-base=4.0.3

 

# install jupyter notebook R kernel
install.packages('IRkernel')
IRkernel::installspec(user = T)

# install important r packages
install.packages(c("devtools","Rcpp"))

# install Seurat 4 beta
remotes::install_github("satijalab/seurat", ref = "release/4.0.0")
devtools::install_github('satijalab/seurat-data')
remotes::install_github('satijalab/seurat-wrappers')

# install bioconductor
if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")
BiocManager::install(version = "3.12")
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/

BiocManager::install(c('multtest',"SingleCellExperiment","GenomicRanges",
"scRNAseq","Rhdf5lib","pcaMethods","DropletUtils",
"scater","SingleR","geneplotter","AUCell","GSVA",
"M3Drop","ComplexHeatmap","AnnotationHub",
"clusterProfiler","ChIPseeker","ChIPpeakAnno"))

# install monocle
BiocManager::install(c('BiocGenerics', 'DelayedArray', 'DelayedMatrixStats',
'limma', 'S4Vectors', 'SingleCellExperiment',
'SummarizedExperiment', 'batchelor', 'Matrix.utils'))
devtools::install_github('cole-trapnell-lab/leidenbase')
devtools::install_github('cole-trapnell-lab/monocle3')

 

# install jupyter notebook 
pip install jupyterlab

# install loompy
pip install loompy

pip install scanpy
pip install -i https://mirrors.aliyun.com/pypi/simple python-igraph
pip install -i https://mirrors.aliyun.com/pypi/simple louvain
pip install -i https://mirrors.aliyun.com/pypi/simple leidenalg
pip install -i https://mirrors.aliyun.com/pypi/simple anndata
pip install -i https://mirrors.aliyun.com/pypi/simple scanpy
pip install -i https://mirrors.aliyun.com/pypi/simple -U scvelo

 

15727379209.iego.vip.    :22519

mac.sjchen.top

« Older entries § Newer entries »