如何修复Rstudio中以下代码的错误

时间:2019-09-23 15:17:22

标签: r bioinformatics

我尝试运行此代码,但遇到错误:

  

getSequence(query2 $ req [[1]])错误:未找到对象'query2'

我不知道如何纠正它。有人可以帮我找出解决方法吗?

代码如下:

getncbiseq <- function(accession)
  {
     require("seqinr") # this function requires the SeqinR R package
     # first find which ACNUC database the accession is stored in:
     dbs <- c("genbank","refseq","refseqViruses","bacterial")
     numdbs <- length(dbs)
     for (i in 1:numdbs)
     {
        db <- dbs[i]
        choosebank(db)
        # check if the sequence is in ACNUC database 'db':
        resquery <- try(query(".tmpquery", paste("AC=", accession)), silent = TRUE)
        if (!(inherits(resquery, "try-error")))
        {
           queryname <- "query2"
           thequery <- paste("AC=",accession,sep="")
           query(`queryname`,`thequery`)
           # see if a sequence was retrieved:
           seq <- getSequence(query2$req[[1]])
           closebank()
           return(seq)
        }
        closebank()
     }
     print(paste("ERROR: accession",accession,"was not found"))
  }
dengueseq <- getncbiseq("NC_001477")

0 个答案:

没有答案