text: user9129: I have around 300 paired-end files from 150 samples (1 forward and 1 reverse read for each sample). I want to merge (by sequence overlap) respective forward and reverse reads for each of the samples. The samples are named e.g. SRR2155174_1.fastq SRR2155174_2.fastq SRR2155319_1.fastq SRR2155319_2.fastq. Can anyone please help me write a bash script to do this?
  
  user77: Your original question mentioned concatenating things, which is not what you want (that would result in all of the reads from the _2 files being after all of those in _1). What you want is to merge overlapping paired end reads. There are a variety of tools available for that, from flash to bbmerge. The general structure then is:
  for R1 in *_1.fastq ; do
      sampleName=${R1%%_1.fastq}
      some command with ${sampleName}_1.fastq and ${sampleName}_2.fastq producing ${sampleName}.fastq
  done
  
  You can figure out the some command ... portion yourself.
  
original_text: 9129: <p>I have around 300 paired-end files from 150 samples (1 forward and 1 reverse read for each sample). I want to merge (by sequence overlap) respective forward and reverse reads for each of the samples. The samples are named e.g. <strong>SRR2155174_1.fastq SRR2155174_2.fastq SRR2155319_1.fastq SRR2155319_2.fastq.</strong> Can anyone please help me write a bash script to do this?</p>
   77: <p>Your original question mentioned concatenating things, which is not what you want (that would result in all of the reads from the _2 files being after all of those in _1). What you want is to merge overlapping paired end reads. There are a variety of tools available for that, from <a href="https://ccb.jhu.edu/software/FLASH/" rel="nofollow noreferrer">flash</a> to <a href="https://jgi.doe.gov/data-and-tools/bbtools/bb-tools-user-guide/bbmerge-guide/" rel="nofollow noreferrer">bbmerge</a>. The general structure then is:</p>
  <pre><code>for R1 in *_1.fastq ; do
      sampleName=${R1%%_1.fastq}
      some command with ${sampleName}_1.fastq and ${sampleName}_2.fastq producing ${sampleName}.fastq
  done
  </code></pre>
  <p>You can figure out the <code>some command ...</code> portion yourself.</p>
  