Lapply和无效'描述'争论
我有一个包含 144 个文件的目录 (.bed)。
我想使用 R 包 (ChAseR) 中的函数来分析它们。为了避免 for 循环,我决定使用 lapply 函数。
# Define path
setwd("/home/works/Project/")
netpath="Table"
bedpath="Data/Naive_CD4_positive_T_Cells_BP/H3K27ac/bed_files"
# PCHiC contact network data loading and preprocessing
pchic=read.table(paste(netpath, "merged_samples_12Apr2015_full.txt", sep="/"), sep="\t", skip=4, header=T)
pchic[,1]=paste('chr', pchic[,1], sep='')
pchic[,6]=paste('chr', pchic[,6], sep='')
Tcellnaive <- pchic[which(pchic$Naive_CD4>=5),c(1,2,3,6,7,8)]
tnet=chaser::make_chromnet(Tcellnaive)
# Load histone modifications data from Chen et al. 2016 (doi: 10.1016/j.cell.2016.10.026)
files <- list.files(path=bedpath, pattern="*.bed", full.names=TRUE, recursive=FALSE)
tnet2 <- lapply(files, chaser::load_features(tnet, files, type="macs2", missingv=0, featnames="H3K27ac"))
我收到此消息:
reading from file Data/Naive_CD4_positive_T_Cells_BP/H3K27ac/bed_files/S01342H2.H3K27ac.ppqt_macs2_wp10.20150819.bed...
reading from file Data/Naive_CD4_positive_T_Cells_BP/H3K27ac/bed_files/S0137XH3.H3K27ac.ppqt_macs2_wp10.20150819.bed...
reading from file Data/Naive_CD4_positive_T_Cells_BP/H3K27ac/bed_files/S013CNH3.H3K27ac.ppqt_macs2_wp10.20150819.bed...
reading from file Data/Naive_CD4_positive_T_Cells_BP/H3K27ac/bed_files/S013DLH2.H3K27ac.ppqt_macs2_wp10.20150819.bed...
Error in file(file, "rt") : invalid 'description' argument
如何解决此错误?也许路径或功能有问题?
I have a directory with 144 files (.bed).
I would like to analyze them with a function from a R package (ChAseR). To avoid a for loop, I decided to use a lapply function.
# Define path
setwd("/home/works/Project/")
netpath="Table"
bedpath="Data/Naive_CD4_positive_T_Cells_BP/H3K27ac/bed_files"
# PCHiC contact network data loading and preprocessing
pchic=read.table(paste(netpath, "merged_samples_12Apr2015_full.txt", sep="/"), sep="\t", skip=4, header=T)
pchic[,1]=paste('chr', pchic[,1], sep='')
pchic[,6]=paste('chr', pchic[,6], sep='')
Tcellnaive <- pchic[which(pchic$Naive_CD4>=5),c(1,2,3,6,7,8)]
tnet=chaser::make_chromnet(Tcellnaive)
# Load histone modifications data from Chen et al. 2016 (doi: 10.1016/j.cell.2016.10.026)
files <- list.files(path=bedpath, pattern="*.bed", full.names=TRUE, recursive=FALSE)
tnet2 <- lapply(files, chaser::load_features(tnet, files, type="macs2", missingv=0, featnames="H3K27ac"))
I obtained this message:
reading from file Data/Naive_CD4_positive_T_Cells_BP/H3K27ac/bed_files/S01342H2.H3K27ac.ppqt_macs2_wp10.20150819.bed...
reading from file Data/Naive_CD4_positive_T_Cells_BP/H3K27ac/bed_files/S0137XH3.H3K27ac.ppqt_macs2_wp10.20150819.bed...
reading from file Data/Naive_CD4_positive_T_Cells_BP/H3K27ac/bed_files/S013CNH3.H3K27ac.ppqt_macs2_wp10.20150819.bed...
reading from file Data/Naive_CD4_positive_T_Cells_BP/H3K27ac/bed_files/S013DLH2.H3K27ac.ppqt_macs2_wp10.20150819.bed...
Error in file(file, "rt") : invalid 'description' argument
How to resolve this error? Maybe a problem with the path or the function?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论