我使用R中的以下代码获得了fasta输出,我需要读取我的fasta文件(homo_ref.faa),我通过终端将这些代码作为"makeblastdb -in homo_ref.faa -dbtype prot
“使用。但我得到了"BLAST options error: File homo_ref.faa does not exist
“。您将如何建议我对代码进行更改?
library(seqinr)
library(Biostrings)
library(data.table)
library(tidyverse)
#read homo_tabular format
homo_tab = read.csv("proteins_homo.csv", header = TRUE, sep = ",")
homo_tab_1 = homo_tab[,c(7,9:11)]
colnames(homo_tab_1)[2]="ID"
#select longest locus
son <- homo_tab_1 %>%
group_by(Locus) %>%
slice_max(Length, n = 1) %>%
slice_head(n = 1)
#read homo protein fasta ile and convert list to df/dt
human_prot <- read.fasta(file= "homo_s.faa", seqtype="AA", as.string =TRUE, set.attributes =TRUE)
human_prot = unlist(human_prot)
human_prot = as.data.frame(human_prot)
human_prot = setDT(human_prot, keep.rownames = "ID")
#rename column
colnames(human_prot)[1] ="ID"
colnames(human_prot)[2] ="seq"
#merge csv and fasta file
merged = merge(human_prot , son , by="ID", all.x=TRUE)
#remove na rows
library(dplyr)
merged_1 <- na.omit(merged)
#delete column
merged_2 = subset(merged_1, select = -c(3,4,5) )
write.fasta(sequences = merged_2, names = names(merged_3), file.out = "homo_ref.faa")
发布于 2022-10-01 21:29:07
您试过键入fasta文件的路径吗?例如,makeblastdb -in /Usr/Desktop/homo_ref.faa -dbtype prot
发布于 2022-10-03 19:32:22
我用以下代码解决了我的问题:"chmod a+r homo_ref.faa
“。感谢孟苏尔·达拉克类似的问题的答案。
https://stackoverflow.com/questions/73921820
复制相似问题