text: user3964: All,
  As the first step in my Snakemake pipeline, I generate small fastq files from all input fastq.gz files. This is to run a quick round of "infer_experiment.py" (from RSeQC, to get the kit strandedness). However, Snakemake says this step fails. I think I know why, it is because a command like this
  zcat fastq_raw/20190011-043_S43_R1_001.fastq.gz | head -n 400000 > infer_strandedness/20190011-043_S43_subset_R1.fastq
  
  Ends with an error: gzip: stdout: Broken pipe and Snakemake uses Bash strict mode. (Snakemake reports: (one of the commands exited with non-zero exit code; note that snakemake uses bash strict mode!)). So my question is:
  How to avoid this, or, are there other truncating methods that do finish cleanly? Preferebly they are also efficient (seqtk offers subsampling but this parses the entire fastq file!).
  
  user4282: Snakemake is using bash strict mode to ensure best practice error reporting in shell commands. Unfortunately some tools violate bash strict mode.
  More details of the error, here. Alternatively, you can use if you don't want disable the strict mode.
  zcat file.fastq.gz  | awk '(NR<=400000)' > subset.fastq
  
  
original_text: 3964: <p>All,</p>
  
  <p>As the first step in my Snakemake pipeline, I generate small fastq files from all input fastq.gz files. This is to run a quick round of "infer_experiment.py" (from RSeQC, to get the kit strandedness). However, Snakemake says this step fails. I think I know why, it is because a command like this</p>
  
  <pre><code>zcat fastq_raw/20190011-043_S43_R1_001.fastq.gz | head -n 400000 &gt; infer_strandedness/20190011-043_S43_subset_R1.fastq
  </code></pre>
  
  <p>Ends with an error: <code>gzip: stdout: Broken pipe</code> and Snakemake uses Bash strict mode. (Snakemake reports: <code>(one of the commands exited with non-zero exit code; note that snakemake uses bash strict mode!)</code>). So my question is:</p>
  
  <p>How to avoid this, or, are there other truncating methods that do finish cleanly? Preferebly they are also efficient (seqtk offers subsampling but this parses the entire fastq file!).</p>
   4282: <p>Snakemake is using bash strict mode to ensure best practice error reporting in shell commands. Unfortunately some tools violate bash strict mode.</p>
  
  <p>More details of the error, <a href="https://snakemake.readthedocs.io/en/stable/project_info/faq.html#my-shell-command-fails-with-exit-code-0-from-within-a-pipe-what-s-wrong" rel="nofollow noreferrer">here</a>. Alternatively, you can use if you don't want disable the strict mode.</p>
  
  <pre><code>zcat file.fastq.gz  | awk '(NR&lt;=400000)' &gt; subset.fastq
  </code></pre>
  