Skip to content

Instantly share code, notes, and snippets.

@slavailn
Created November 22, 2023 16:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slavailn/258ed33a0bca67b8b5296b0dde58b7a6 to your computer and use it in GitHub Desktop.
Save slavailn/258ed33a0bca67b8b5296b0dde58b7a6 to your computer and use it in GitHub Desktop.
Merge fastq files that belong to the same sample, but were generated from different lanes
#! /bin/bash
# Taken from https://github.com/stephenturner/mergelanes/issues/1
# Exercise caution, does not work accurately in every case:
# Not working accurately for sample IDs like "A11_Barcodexxx_S11_L001_R1_001".
# It cat together all L001 pertaining to sample ID A11 with different barcodes also
ls *R1* | cut -d _ -f 1 | sort | uniq \
| while read id; do \
cat $id*R1*.fastq.gz > $id.R1.fastq.gz;
cat $id*R2*.fastq.gz > $id.R2.fastq.gz;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment