Skip to content

Instantly share code, notes, and snippets.

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 johnstantongeddes/6113112 to your computer and use it in GitHub Desktop.
Save johnstantongeddes/6113112 to your computer and use it in GitHub Desktop.
Python script to add Illumina 1.3 format fastq paired read tags '\1' and '\2' for forward and reverse reads, respectively, to an interleaved Illumina 1.8 format fastq file. Modified from [/khmer/sandbox/interleave.py](https://github.com/ged-lab/khmer/blob/master/sandbox/interleave.py)
#! /usr/bin/env python
import screed, sys, itertools
s1_file = sys.argv[1]
s2_file = sys.argv[2]
for r1, r2 in itertools.izip(screed.open(s1_file), screed.open(s2_file)):
name1 = r1.name
if not name1.endswith('/1'):
name1 += '/1'
name2 = r2.name
if not name2.endswith('/2'):
name2 += '/2'
print '@%s\n%s\n+\n%s\n@%s\n%s\n+\n%s' % (name1,
r1.sequence,
r1.accuracy,
name2,
r2.sequence,
r2.accuracy)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment