Ubuntu16固定IP的修复

lshw -C network #查看网卡的信息   
#ifconfig enp15s0 固定ip netmask 255.255.255.0 #临时固定ipi地址
/etc/init.d/networking stop
cp /etc/network/interfaces /etc/network/interfaces.bak
### enp15s0和enp14s0是一个网卡的两个接口
vim /etc/network/interfaces
#添加如下    
auto enp15s0
auto enp14s0
iface enp14s0 inet dhcp   #动态ip
iface enp15s0 inet static #固定ip
address 固定ip地址
netmask 255.255.255.0

vim /etc/hosts
固定ip地址    bioinf.njnu.edu.cn

vim /etc/resolv.conf #设置DNS解析---个人觉得可以不用 
nameserver 固定ip地址

ifconfig enp14s0 up
dhclient enp14s0     
ifconfig enp15s0 up
/etc/init.d/networking start


注意:因为这里的enp14s0是可以链接外网的接口,所以需要先将电脑链接到外网,然后启动enp15s0是将网卡的另一个接口绑定固定ip,由于并未设定链接规则,所以外网可以直接访问此固定ip,若需要制定访问规则可以自己根据规则定义
发表在 Linux | 留下评论

GROMACS-2018.3安装(Intel编译器+GPU)

#The GROMACS team recommends OpenMPI version 1.6 (or higher), MPICH version 1.4.1 (or higher), or your hardware vendor's MPI installation.
#说明gromacs支持intel cpu 的mpi加速,因此先确定是否安装 intel_Parallel_Studio_XE
tar -zxf gromacs-2018.3.tar.gz -C /opt/biosoft/
cd /opt/biosoft/gromacs-2018.3/
#Check that you have CMake version 3.4.3 or later
cmake --version
#cmake version 3.4.3
mkdir build
cd build/
source /opt/intel/compilers_and_libraries_2017.7.259/linux/bin/compilervars.sh intel64
export PATH=/opt/sysoft/gcc-4.9.3/bin/:$PATH
export LD_LIBRARY_PATH=/opt/sysoft/gcc-4.9.3/lib/:$LD_LIBRARY_PATH  
export LD_LIBRARY_PATH=/opt/sysoft/gcc-4.9.3/lib64/:$LD_LIBRARY_PATH 
export C_INCLUDE_PATH=/opt/sysoft/gcc-4.9.3/include/:$C_INCLUDE_PATH 
export CPLUS_INCLUDE_PATH=/opt/sysoft/gcc-4.9.3/include/:$CPLUS_INCLUDE_PATH 
cmake .. -DGMX_FFT_LIBRARY=mkl -DCMAKE_C_COMPILER=/opt/intel/bin/icc -DCMAKE_CXX_COMPILER=/opt/intel/bin/icc -DGMX_GPU=ON -DGMX_MPI=ON -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-9.2/ -DCUDA_HOST_COMPILER=/opt/intel/bin/icc -DGMX_SIMD=AVX_256 -DREGRESSIONTEST_PATH=/home/train/data/software/Gromacs5.07/regressiontests-5.0.7/  -DCMAKE_INSTALL_PREFIX=/opt/biosoft/gromacs2018_3/ 
make 
make check
#若出现如下:
#Failing SIMD math function ulp comparison between std::exp and expSingleAccuracy<MathOptimization::Unsafe>
#Requested ulp tolerance: 16
#Requested abs tolerance: 0
#Denormals can be 0: false
#Largest Ulp difference occurs for x=-86.983924865722656
#Ref  values: 1.6724818069065022e-38
#SIMD values: 2.350988701644575e-38
#Ulp diff.:   4841987
#仅仅是用intel编译器算出来的值和gcc编译器算出来的值略有不同,不放心可以重新编译intel 编译器,再进行重新编译gromacs
make install

#mdrun_only_intel编译器重新编译
source /opt/intel/compilers_and_libraries_2017.7.259/linux/bin/compilervars.sh intel64
mkdir /opt/biosoft/gromacs_mdrunonly_2018_3
cd /opt/biosoft/gromacs-2018.3
mkdir build-normal
cd build-normal/
export PATH=/opt/sysoft/Python-2.7.11/bin/:$PATH
cmake .. -DGMX_FFT_LIBRARY=mkl -DCMAKE_C_COMPILER=/opt/intel/bin/icc -DCMAKE_CXX_COMPILER=/opt/intel/bin/icc -DGMX_GPU=ON -DGMX_MPI=ON -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-9.2/ -DCUDA_HOST_COMPILER=/opt/intel/bin/icc -DGMX_SIMD=AVX_256 -DCMAKE_INSTALL_PREFIX=/opt/biosoft/gromacs_mdrunonly_2018_3/ 
make 
make install
cd ..
mkdir build-mdrun-only
cd build-mdrun-only/
cmake .. -DGMX_FFT_LIBRARY=mkl -DCMAKE_C_COMPILER=/opt/intel/bin/icc -DCMAKE_CXX_COMPILER=/opt/intel/bin/icc -DMKL_LIBRARIES=/opt/intel/compilers_and_libraries_2017.7.259/linux/mkl/lib/ -DMKL_INCLUDE_DIR=/opt/intel/compilers_and_libraries_2017.7.259/linux/mkl/include/ -DGMX_GPU=ON -DGMX_MPI=ON -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-9.2/ -DCUDA_HOST_COMPILER=/opt/intel/bin/icc -DGMX_SIMD=AVX_256 -DGMX_BUILD_MDRUN_ONLY=ON -DCMAKE_INSTALL_PREFIX=/opt/biosoft/gromacs_mdrunonly_2018_3/ 
make
make install
cd /home/train/data/software/Gromacs5.07/regressiontests-5.0.7
source /opt/biosoft/gromacs_mdrunonly_2018_3/bin/GMXRC
./gmxtest.pl all -np 2#若显示
#Index  Reference   This test       Error  Description
#   5    -2521.58    -2400.27   0.0246464  1aml.pdb with oplsaa using vsite=none and water=tip3p
#   6    -2521.58    -2400.27   0.0246464  1aml.pdb with oplsaa using vsite=none and water=tip4p
#   7    -2521.58    -2400.27   0.0246464  1aml.pdb with oplsaa using vsite=none and water=tip5p
#   8    -2265.25    -2126.91   0.0314959  1aml.pdb with oplsaa using vsite=h and water=tip3p
#   9    -2265.25    -2126.91   0.0314959  1aml.pdb with oplsaa using vsite=h and water=tip4p
#  10    -2265.25    -2126.91   0.0314959  1aml.pdb with oplsaa using vsite=h and water=tip5p
#   There were 6/42 differences in final energy with the reference file
#   pdb2gmx tests FAILED
#提示计算误差,不必担心是由于计算机本身的硬件决定
echo 'PATH=$PATH:/opt/biosoft/gromacs_mdrunonly_2018_3/bin/' >> ~/.bashrc
source ~/.bashrc
发表在 Molecular Dynamics | 留下评论

Amber的CPU并行(intel优化)和GPU加速安装

帮购买的朋友安装,系统centos6.8,显卡750ti,cpu:intel

#cpu
cd /opt/biosoft/amber18
export MKL_HOME=/opt/intel 
export PATH=/opt/intel/bin/:$PATH
source /opt/intel/impi/2017.4.259/bin64/mpivars.sh
export PATH=/opt/intel/impi/2017.4.259/intel64/bin/:$PATH
export PATH=/opt/intel/:$PATH
sudo cp compilers_and_libraries_2017.7.259/linux/mkl/include/fftw include/ -R 
./configure -intelmpi intel
test -f /opt/biosoft/amber18/amber.sh && source /opt/biosoft/amber18/amber.sh
#sudo ln -s /opt/intel/compilers_and_libraries_2017.7.259/linux/mkl/lib/intel64_lin/ /opt/intel/lib/intel64/ 
sudo ln -s /opt/intel/compilers_and_libraries_2017.7.259/linux/mkl/lib/intel64_lin/* /opt/intel/lib/intel64/ 
make install
source /opt/intel/compilers_and_libraries_2017.7.259/linux/bin/ifortvars.sh intel64
make clean
./configure -openmp -intelmpi intel #amber16之后,由于amber18不建议用18版本的intel编译器,建议是用17或者16的编译器,所以需要安装老版本的intel编译器
test -f /opt/biosoft/amber18/amber.sh && source /opt/biosoft/amber18/amber.sh
make install
#gpu 事先安装好nvidia驱动和cuda
export CUDA_HOME=/usr/local/cuda-9.2
export LD_LIBRARY_PATH="/usr/local/cuda-9.2/lib:${LD_LIBRARY_PATH}"
source ~/.bashrc
#boost安装为了解决如下的库链接不合适问题
#Testing the g++ compiler with boost:
#     g++ -fPIC  testp.cpp -lboost_thread -lboost_system -o testp
#./testp: error while loading shared libraries: libboost_thread.so.1.57.0: canno
#
#Warning: Could not link to boost. Ensure boost-thread, boost-system and boost h
#Warning: Failed command:
#     g++ -fPIC  -lboost_thread -lboost_system -o testp testp.cpp
#Warning: Check boost.compile.err for error details.
#Warning: Memembed functionality in packmol_memgen not available.

wget http://sourceforge.net/projects/boost/files/boost/1.57.0/boost_1_57_0.tar.gz
tar -zxf boost_1_57_0.tar.gz
./bootstrap.sh --prefix=/opt/sysoft/boost-1.57
./b2 install

tar -xf AmberTools18.tar.bz2 -C /opt/biosoft/
tar -xf Amber18.tar.bz2 -C /opt/biosoft/
cd /opt/biosoft/amber18/
#./configure -cuda gnu
#./configure -cuda --prefix /opt/biosoft/amber18/amber_software_bin/ gnu
./configure -cuda gnu
test -f /opt/biosoft/amber18/amber.sh && source /opt/biosoft/amber18/amber.sh
make install
#由于nvcc调用c++编译时不支持老版本gcc-4.4.7,于是使用高版本gcc-4.9.3,需要先安装一个高版本的gcc
#configure报错libquadmath.so.0: cannot open
export LD_LIBRARY_PATH=/opt/sysoft/gcc-4.9.3/lib/:$LD_LIBRARY_PATH  
export LD_LIBRARY_PATH=/opt/sysoft/gcc-4.9.3/lib64/:$LD_LIBRARY_PATH 
export C_INCLUDE_PATH=/opt/sysoft/gcc-4.9.3/include/:$C_INCLUDE_PATH 
export CPLUS_INCLUDE_PATH=/opt/sysoft/gcc-4.9.3/include/:$CPLUS_INCLUDE_PATH 

make test
#error while loading shared libraries: libcurand.so.9.2: cannot open shared object file: No such file or directory
ldd pmemd.cuda
export LD_LIBRARY_PATH=/usr/local/cuda-9.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export LD_LIBRARY_PATH="/usr/local/cuda-9.2/lib64:${LD_LIBRARY_PATH}"

nvidia-smi

软件购买:http://ambermd.org/

发表在 Molecular Dynamics | 留下评论

Gaussian和Gaussian_view安装

安装过程是帮已购买的朋友安装,系统Centos6.5,cpu指令集:AVX2

tar -xf Gaussian16/G16-A03-AVX2.tbz -C /opt/biosoft/
cd /opt/biosoft/g16/
export g16root=/opt/biosoft
mkdir /opt/biosoft/g16/scratch
export GAUSS_SCRDIR=/opt/biosoft/g16/scratch/
source /opt/biosoft/g16/bsd/g16.profile
vim /opt/biosoft/g16/Default.Route
#写入如下指令
-M- 30GB
-P- 16
./bsd/install #必须在g16路径下如:/opt/biosoft/g16
chmod 750 -R *
#事先需要先安装Gaussian16
tar -xf gv6.tar.bz2 -C /opt/biosoft/g16/gv
./gview.sh
export PATH=/opt/biosoft/g16/gv/:$PATH

软件官方链接:http://gaussian.com/products/

发表在 Quantum Chemical Calculation | 留下评论

R语言survminer包安装报错解决

#报错信息如下:
*** arch - i386
Error : .onLoad failed in loadNamespace() for 'broom', details:
  call: NULL
  error: 'import' is not an exported object from 'namespace:backports'
Error: loading failed
Execution halted
*** arch - x64
Error : .onLoad failed in loadNamespace() for 'broom', details:
  call: NULL
  error: 'import' is not an exported object from 'namespace:backports'
Error: loading failed
Execution halted
ERROR: loading failed for 'i386', 'x64'

#说明import的函数不兼容此包的安装
install.packages("backports")
install.packages("survminer")
library(survminer)
#便可成功安装此包
发表在 R | 留下评论

TCGA甲基化数据分析

cd /home/train/Liuping/raw_data 
mkdir ProstateCancer_methylation 
cd ProstateCancer_methylation/

#合并下载好的数据
nohup ./Merge.pl metadata.cart.2018-08-01.json > /home/train/Liuping/raw_data/TCGA_Methylation_ProstateCancer/methylayion_rawdata/out_methylation 2>&1 &
#注意记录下normal‘和 tumor的个数
# normal count: 50
# tumor count: 503

mkdir ../result
cp geneMethy.txt ../result/
cd ../result/

#差异甲基化
source("http://bioconductor.org/biocLite.R")
biocLite("limma")
library(limma)
setwd("D:/TCGA_methylation")
inputFile <- "geneMethy.txt"
normalNum=50
tumorNum=503
fdrFilter=0.05
logFCfilter=1

outTab <- data.frame()
grade <- c(rep(1,normalNum),rep(2,tumorNum))
Type <- c(rep("Normal",normalNum),rep("Tumor",tumorNum))
rt <- read.table(inputFile,sep="\t",header=T,check.names=F)
rt <- as.matrix(rt)
rownames(rt) <- rt[,1]
exp <- rt[,2:ncol(rt)] #行名可被直接移植
dimnames <- list(rownames(exp),colnames(exp))
data <- matrix(as.numeric(as.matrix(exp)),nrow=nrow(exp),dimnames=dimnames)
data <- avereps(data)
data <- data[rowMeans(data)>0,]

data <- normalizeBetweenArrays(data)
normalData <- cbind(id=row.names(data),data) #为了让id号写入文件
write.table(normalData,file="normalizeMethy.txt",sep="\t",row.names=F,quote=F)

for (i in row.names(data)){
 rt <- rbind(expression=data[i,],grade=grade)
 rt <- as.matrix(t(rt))
 wilcoxTest <- wilcox.test(expression ~ grade, data=rt)

 normalGeneMeans <- mean(data[i,1:normalNum])
 tumorGeneMeans <- mean(data[i,(normalNum+1):ncol(data)])
 logFC <- log2(tumorGeneMeans) - log2(normalGeneMeans)
 pvalue <- wilcoxTest$p.value
 normalMed <- median(data[i,1:normalNum])
 tumorMed <- median(data[i,(normalNum+1):ncol(data)])
 diffMed <- tumorMed - normalMed
 if((( logFC>0) & ( diffMed >0)) | (( logFC < 0 ) & ( diffMed <0 ))){
 outTab <- rbind(outTab,cbind(gene=i,normalMean=normalGeneMeans,TumorMean=tumorGeneMeans,logFC=logFC,pValue=pvalue))
 }}
pValue <- outTab[,"pValue"]
fdr <- p.adjust(as.numeric(as.vector(pValue)),method="fdr")
outTab <- cbind(outTab,fdr=fdr)
write.table(outTab,file="allGene.xls",sep="\t",row.names=F,quote=F)
outDiff <- outTab[(abs(as.numeric(as.vector(outTab$logFC))) > logFCfilter & as.numeric(as.vector(outTab$fdr)) < fdrFilter),]
write.table(outDiff,file="diff.xls",sep="\t",row.names=F,quote=F)
heatmap <- data[as.vector(outDiff[,1]),]
heatmap <- cbind(id=row.names(heatmap),heatmap)
write.table(heatmap,file="heatmap.txt",sep="\t",row.names=F,quote=F)

#pheatmap图
install.packages("pheatmap")
setwd("D:/TCGA_methylation/pheatmap")
library(pheatmap)

rt <- read.table("heatmap.txt",sep="\t",header=T,row.names=1,check.names=F)
Type <- c(rep("normal",50),rep("tumor",503))
names(Type) <- colnames(rt)
Type <- as.data.frame(Type)

tiff(file="heatmap.tiff",width=45,height=70,units="cm",compression="lzw",bg="white",res=300)
pheatmap(rt,annotation=Type,color=colorRampPalette(c("green","black","red"))(50),cluster_cols=F,fontsize_row=5,fontsize_col=4)
dev.off()

#甲基化与转录组数据融合
setwd("D:/TCGA_methylation/MethyGeneMerge")
methy <- read.table(file="normalizeMethy.txt",row.names=1,header=T,sep="\t",check.names=F)
rna <- read.table(file="normalizeExp.txt",row.name=1,header=T,sep="\t",check.names=F)

colnames(methy) <- gsub("(.*?)-(.*?)-(.*?)-(.*?)-.*","\\1-\\2-\\3-\\4",colnames(methy))
colnames(rna) <- gsub("(.*?)-(.*?)-(.*?)-(.*?)-.*","\\1-\\2-\\3-\\4",colnames(rna))
sameSample <- intersect(colnames(methy),colnames(rna))
rownames(methy) <- paste(rownames(methy),"methy",sep="|")
rownames(rna) <- paste(rownames(rna),"exp",sep="|")
merge <- rbind(id=sameSample,methy[,sameSample],rna[,sameSample])
write.table(merge,file="merge.txt",sep="\t",quote=F,col.names=F)

#基因甲基化与转录组数据相关关系
setwd("D:/TCGA_methylation/methycor")
inputFile <- "merge.txt"
methyGene <- "NCAPD3|methy"
expGene <- "NCAPD3|exp"
rt <- read.table(inputFile,sep="\t",header=T,check.names=F,row.names=1)
i <- rt[methyGene,]
j <- rt[expGene,]
x <- as.numeric(i)
y <- log2(as.numeric(j)+1)
corT <- cor.test(x,y)
methyGeneName <- unlist(strsplit(methyGene,"\\|"))[[1]]
expGeneName <- unlist(strsplit(expGene,"\\|"))[[1]]
z <- lm(y~x)
estimate <- corT$estimate
cor <- round(estimate,3)
pvalue <- corT$p.value   #以小数的方式保留位数
pval <- signif(pvalue,4) #以科学计数法的方式保留位数
pval <- format(pval,scientific=T)

outTiff <- "cor.tiff"
tiff(file=outTiff,width=15,height=15,units="cm",compression="lzw",bg="white",res=300)
plot(x,y,type="p",pch=16,main=paste("Cor=",cor,"(p-value=",pval,")",sep=""),xlab=paste(methyGeneName,"methylation"),ylab=paste(expGeneName,"expression"))
lines(x,fitted(z),col=2)
dev.off()

#甲基化位点提取
nohup ./posget.pl metadata.cart.2018-08-01.json NCAPD3 > /home/train/Liuping/raw_data/TCGA_Methylation_ProstateCancer/NCAPD3_Methy_location.log 2>&1 &
#[1] 40635

#甲基化位点与gene表达合并
setwd("D:/TCGA_methylation/posmethygene")
methyFile="posMethy.txt"
expFile="normalizeExp.txt"
methy <- read.table(methyFile,row.names=1,header=T,sep="\t",check.names=F)
rna <- read.table(expFile,row.names=1,header=T,sep="\t",check.names=F)
colnames(methy) <- gsub("(.*?)-(.*?)-(.*?)-(.*?)-.*","\\1-\\2-\\3-\\4",colnames(methy))
colnames(rna) <- gsub("(.*?)-(.*?)-(.*?)-(.*?)-.*","\\1-\\2-\\3-\\4",colnames(rna))
sameSample <- intersect(colnames(methy),colnames(rna))
rownames(methy) <- paste(rownames(methy),"methy",sep="|")
rownames(rna) <- paste(rownames(rna),"exp",sep="|")
merge <- rbind(id=sameSample,methy[,sameSample],rna[,sameSample])

#甲基化位点与gene表达相关
setwd("D:/TCGA_methylation/cor_posmethygene")
inputFile <- "merge.txt"
posmethy <- "cg14934141|methy"
expGene <- "NCAPD3|exp"
rt <- read.table(inputFile,sep="\t",header=T,check.names=F,row.names=1)
i <- rt[posmethy,]
j <- rt[expGene,]
x <- as.numeric(i)
y <- log2(as.numeric(j)+1)
corT <- cor.test(x,y)
posmethyid <- unlist(strsplit(posmethy,"\\|"))[[1]]
expgenename <- unlist(strsplit(expGene,"\\|"))[[1]]
z <- lm(y~x)
cor <- corT$estimate
cor <- round(cor,3)
pvalue <- corT$p.value
pval <- signif(pvalue,4)
pval <- format(pval,scientific=T)
outTiff <- "posCor.tiff"
tiff(file=outTiff,width=15,height=15,units="cm",compression="lzw",bg="white",res=300)
plot(x,y,type="p",pch=16,main=paste("Cor=",cor,"(p-value=",pval,")",sep=""),xlab=paste(posmethyid,"methylation"),ylab=paste(expgenename,"expression"))
lines(x,fitted(z),col=2)
dev.off()

合并的脚本,类似转录本的合并脚本,需要自己根据需要自行修改
欢迎添加下面这个群提问:

发表在 TCGA | 108条评论