text: user10364: I am trying to write a code for importing sra files as fastq files in Rstudio (for obtaining and aligning RNA-seq reads from public repositories). I keep getting "Error in if (is.na(sra_acc$run[i])) { : argument is of length zero" right after I run this code. Any suggestions on what might be going wrong? My code is as follows:
  library(SRAdb)
  sqlfile <-'SRAmetadb.sqlite'
  if(!file.exists('SRAmetadb.sqlite')) sqlfile <<- getSRAdbFile()
  sra_con <- dbConnect(SQLite(),sqlfile)
  sraInf <- getSRAinfo("SRP045534",sra_con, sraType="sra")
  
  Error in if (is.na(sra_acc$run[i])) { : argument is of length zero
  
  
  user1140: After checking with file.exists(), I would suggest you try the same command with another SRA run. It may happen that some runs are not accessible for reasons I do not know. I always have problems in accessing sra formatted files and use a workaround to download fastq.
  Here is my not official workaround:
  runlist<-sraConvert("SRP045534",sra_con=sra_con)
  runlist[1:2,]
  
  study submission    sample experiment        run
  1 SRP045534  SRA179382 SRS685546  SRX681992 SRR1552451
  2 SRP045534  SRA179382 SRS685544  SRX681990 SRR1552449
  
  for (dloadrun in runlist$run) 
  {
      getSRAfile(dloadrun,sra_con=sra_con,fileType="fastq")
  }
  
  This should iteratively download all the runs associated to the project you are studying.
  It is possible that you can do the same with sra type file, but I have never been able to use them with sraDB, and never investigated the issue.
  
original_text: 10364: <p>I am trying to write a code for importing sra files as fastq files in Rstudio (for obtaining and aligning RNA-seq reads from public repositories). I keep getting &quot;Error in if (is.na(sra_acc$run[i])) { : argument is of length zero&quot; right after I run this code. Any suggestions on what might be going wrong? My code is as follows:</p>
  <pre><code>library(SRAdb)
  sqlfile &lt;-'SRAmetadb.sqlite'
  if(!file.exists('SRAmetadb.sqlite')) sqlfile &lt;&lt;- getSRAdbFile()
  sra_con &lt;- dbConnect(SQLite(),sqlfile)
  sraInf &lt;- getSRAinfo(&quot;SRP045534&quot;,sra_con, sraType=&quot;sra&quot;)
  
  Error in if (is.na(sra_acc$run[i])) { : argument is of length zero
  </code></pre>
   1140: <p>After checking with <code>file.exists()</code>, I would suggest you try the same command with another SRA run. It may happen that some runs are not accessible for reasons I do not know. I always have problems in accessing sra formatted files and use a workaround to download fastq.</p>
  <p>Here is my not official workaround:</p>
  <pre><code>runlist&lt;-sraConvert(&quot;SRP045534&quot;,sra_con=sra_con)
  runlist[1:2,]
  
  study submission    sample experiment        run
  1 SRP045534  SRA179382 SRS685546  SRX681992 SRR1552451
  2 SRP045534  SRA179382 SRS685544  SRX681990 SRR1552449
  
  for (dloadrun in runlist$run) 
  {
      getSRAfile(dloadrun,sra_con=sra_con,fileType=&quot;fastq&quot;)
  }
  </code></pre>
  <p>This should iteratively download all the runs associated to the project you are studying.
  It is possible that you can do the same with sra type file, but I have never been able to use them with sraDB, and never investigated the issue.</p>
  