vlothec / TRASH

RepeatIdentifier
MIT License
50 stars 3 forks source link

bug in parameter parsing #15

Open kavonrtep opened 11 months ago

kavonrtep commented 11 months ago

Hi, the code of TRASH_run.R test for fasta file based on regular expression ".fa" and ".fna".

   if(grepl(".fa", arguments[i]) | grepl(".fna", arguments[i]))
      {
        if(file.exists(paste(execution.path, arguments[i], sep = "/")))
        {
          fasta.list = c(fasta.list, paste(execution.path, arguments[i], sep = "/"))
        } else if(file.exists(arguments[i]))
        {
          fasta.list = c(fasta.list, arguments[i])
        } else
        {
          stop(paste("Cannot find the", arguments[i], "fasta file specified", sep = ""), call. = FALSE)
        }
      }

this leads to error anytime when --seqt path contains anywhere either 'fa' or 'fna' substring because it is then wrongly handled as fasta.file. with following error:

  no line starting with a > character found

I would suggest to use standard R library optparse as the custom parsing is not very robust and prone to error. Petr