#BiocManager::install("Biostrings",force = TRUE)
library(Biostrings)
library(plyr)
fastaFile <- readBStringSet("D:/DATA/Homo_sapiens/Homo_sapiens.fasta",
format="fasta")
#nrec=-1L,
#skip=0L,
#seek.first.rec=FALSE,
#use.names=FALSE)
test<-name[1,1]
#获取名字id
name <- names(fastaFile) %>% as.data.frame()
#######################按"|"分割----
#############自定义函数
filler <- function(x){
a <- strsplit(x,split = "|",fixed = T) %>% as.data.frame()##按"|"分割
y <- a[5,]
return(y)
}
#####应用函数
results.list <- lapply(name$.,filler)
results.list <- unlist(results.list) %>% as.data.frame()
#######################按";"分割----
#############自定义函数
#results.list$.[1]
filler <- function(x){
#x <- results.list$.[3]
a <- strsplit(x,split = ";",fixed = T) %>% as.data.frame()##按";"分割
y <- a[1,]
return(y)
}
#####应用函数
results <- lapply(results.list$.,filler)
results <- unlist(results) %>% as.data.frame()
results <- unique(results$.)
write.csv(results,"iuuCD.human.list.RDS")