text: user2141: Currently I have 4 fastq file for each patient as WES data. For WES pipeline, I want to combine those fastq files. I am using writeFastq from ShortRead package in Bioconductor.But I think this function is not working properly. 
  The reason of my doubt is the the size the next step is quality check using FastQC tool. This tool is working on individual file but not on combined file and shows the error that ID line doesn't start with "@" . So I want to know what are the other effective tool for combining multiple fastq files without any loss of information. 
  Let me know if I am doing something wrong. Thanks
  [EDIT-1] : The codes for combining multiple fastq files into one is as follows:
  reference_fastq = file.path(paste(getwd(),"refs",sep = "/", collapse = " "), fsep = ".fasta")
  fastqDir <- file.path(dataDir, fsep = ".fastq")
  outfile_temp <- paste(dirname(dataDir),basename(fastqDir),    paste(basename(fastqDir),"combined","fastq", sep = "."),sep = "/", collapse = " ")
  fls <- list.files(fastqDir, "fastq$", full=TRUE)
  for (fl in fls) {
    fq <- readFastq(fl)
    writeFastq(fq,outfile_temp, mode="a")
  }
  
  First four lines of my fastq file (one of 4 indivual file) are as follows :
  @D00239:185:C9KELANXX:2:2201:1088:2107 1:N:0:TCCTGAGC
  GTACAAGAAGCATAACATCAGCATGTGTTTTGGTGAGAACCTTAGGAAGTTTGCAATCATGACAGAAGGTGAAGG
  +
  /<BBBFFFBFFFFFFFFFFFBF<FFBF<B<FFFFFFFFFFB/B/<////<<<FF<B<FF<FFFFFFFFF/FFFFF
  
  First four lines of combines fastq file are as follows: 
  @D00239:185:C9KELANXX:2:2201:1088:2107 1:N:0:TCCTGAGC
  GTACAAGAAGCATAACATCAGCATGTGTTTTGGTGAGAACCTTAGGAAGTTTGCAATCATGACAGAAGGTGAAGG
  +
  /<BBBFFFBFFFFFFFFFFFBF<FFBF<B<FFFFFFFFFFB/B/<////<<<FF<B<FF<FFFFFFFFF/FFFFF
  
  It is pretty clear that combined fastq file is also starting wiht proper identifier but why FastQC tool is saying that identifier '@' is missing. Here is the screen shot of the error message:
  
  Thanks.
  
  user29: You can drastically simplify your effort because FASTQ files are simple text files; therefore, standard UNIX test file tools work:
  cat refs/*.fastq > combined.fastq
  
  And this even works with .fastq.gz files — no unzipping required.
  
  Apart from this, your R code contains several errors. For instance, your variable names change throughout, and you’re using the fsep parameter wrongly. In fact it’s unclear to me what the code is supposed to do. At an approximation (and untested), the following should work:
  fastq_dir = file.path(getwd(), "refs")
  fastq_files = dir(fastq_dir, pattern = "\\.fastq$", full.names = TRUE)
  outfile = file.path(dirname(fastq_dir), "combined.fastq")
  
  for (file in fastq_files) {
      fq = readFastq(file)
      writeFastq(fq, outfile, mode = "a")
  }
  
  This is equivalent to running the shell command shown above, just in a more convoluted way (parsing and re-generating the FASTQ files).
  
original_text: 2141: <p>Currently I have 4 fastq file for each patient as WES data. For WES pipeline, I want to combine those fastq files. I am using writeFastq from ShortRead package in Bioconductor.But I think this function is not working properly. </p>
  
  <p>The reason of my doubt is the the size the next step is quality check using FastQC tool. This tool is working on individual file but not on combined file and shows the error that ID line doesn't start with "@" . So I want to know what are the other effective tool for combining multiple fastq files without any loss of information. </p>
  
  <p>Let me know if I am doing something wrong. Thanks</p>
  
  <p><strong>[EDIT-1]</strong> : The codes for combining multiple fastq files into one is as follows:</p>
  
  <pre><code>reference_fastq = file.path(paste(getwd(),"refs",sep = "/", collapse = " "), fsep = ".fasta")
  fastqDir &lt;- file.path(dataDir, fsep = ".fastq")
  outfile_temp &lt;- paste(dirname(dataDir),basename(fastqDir),    paste(basename(fastqDir),"combined","fastq", sep = "."),sep = "/", collapse = " ")
  fls &lt;- list.files(fastqDir, "fastq$", full=TRUE)
  for (fl in fls) {
    fq &lt;- readFastq(fl)
    writeFastq(fq,outfile_temp, mode="a")
  }
  </code></pre>
  
  <p>First four lines of my fastq file (one of 4 indivual file) are as follows :</p>
  
  <pre><code>@D00239:185:C9KELANXX:2:2201:1088:2107 1:N:0:TCCTGAGC
  GTACAAGAAGCATAACATCAGCATGTGTTTTGGTGAGAACCTTAGGAAGTTTGCAATCATGACAGAAGGTGAAGG
  +
  /&lt;BBBFFFBFFFFFFFFFFFBF&lt;FFBF&lt;B&lt;FFFFFFFFFFB/B/&lt;////&lt;&lt;&lt;FF&lt;B&lt;FF&lt;FFFFFFFFF/FFFFF
  </code></pre>
  
  <p>First four lines of combines fastq file are as follows: </p>
  
  <pre><code>@D00239:185:C9KELANXX:2:2201:1088:2107 1:N:0:TCCTGAGC
  GTACAAGAAGCATAACATCAGCATGTGTTTTGGTGAGAACCTTAGGAAGTTTGCAATCATGACAGAAGGTGAAGG
  +
  /&lt;BBBFFFBFFFFFFFFFFFBF&lt;FFBF&lt;B&lt;FFFFFFFFFFB/B/&lt;////&lt;&lt;&lt;FF&lt;B&lt;FF&lt;FFFFFFFFF/FFFFF
  </code></pre>
  
  <p>It is pretty clear that combined fastq file is also starting wiht proper identifier but why FastQC tool is saying that identifier '@' is missing. Here is the screen shot of the error message:</p>
  
  <p><a href="https://i.stack.imgur.com/aZ3E2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aZ3E2.png" alt="Screen shot of error message"></a></p>
  
  <p>Thanks.</p>
   29: <p>You can drastically simplify your effort because FASTQ files are simple text files; therefore, standard UNIX test file tools work:</p>
  
  <pre class="lang-bash prettyprint-override"><code>cat refs/*.fastq &gt; combined.fastq
  </code></pre>
  
  <p>And this even works with <code>.fastq.gz</code> files — no unzipping required.</p>
  
  <hr>
  
  <p>Apart from this, your R code contains several errors. For instance, your variable names change throughout, and you’re using the <code>fsep</code> parameter wrongly. In fact it’s unclear to me what the code is supposed to do. At an approximation (and untested), the following should work:</p>
  
  <pre class="lang-r prettyprint-override"><code>fastq_dir = file.path(getwd(), "refs")
  fastq_files = dir(fastq_dir, pattern = "\\.fastq$", full.names = TRUE)
  outfile = file.path(dirname(fastq_dir), "combined.fastq")
  
  for (file in fastq_files) {
      fq = readFastq(file)
      writeFastq(fq, outfile, mode = "a")
  }
  </code></pre>
  
  <p>This is equivalent to running the shell command shown above, just in a more convoluted way (parsing and re-generating the FASTQ files).</p>
  