File: fastq-interleave

package info (click to toggle)
last-align 830-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,240 kB
  • ctags: 3,201
  • sloc: cpp: 40,808; python: 1,910; ansic: 1,188; makefile: 385; sh: 232
file content (19 lines) | stat: -rwxr-xr-x 475 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#! /bin/bash

test $# = 2 || {
    cat <<EOF
Usage: $0 x.fastq y.fastq

Read 2 fastq files, and write them interleaved.
Assumes 1 fastq per 4 lines, i.e. no line wrapping.
EOF
    exit
}

paste <(cat "$1" | paste - - - -) <(cat "$2" | paste - - - -) | tr '\t' '\n'

# Is this better?
#paste <(zcat -f "$1"|paste - - - -) <(zcat -f "$2"|paste - - - -)|tr '\t' '\n'

# This does not interpret "-" as stdin:
#paste <(paste - - - - < "$1") <(paste - - - - < "$2") | tr '\t' '\n'