Skip to content

Commit

Permalink
script to reindex header names
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Palmer authored and Jon Palmer committed Nov 17, 2016
1 parent d15ad11 commit 7b551ac
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions util/ufits-fastq_reindex.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env python
import sys

#script to reindex reads containing a ';' such as ';barcodelabel=;'

def fastqreindex(input):
from Bio.SeqIO.QualityIO import FastqGeneralIterator
count = 1
with open(input, 'rU') as fastq:
for title, sequence, qual in FastqGeneralIterator(fastq):
cols = title.split(';')
header = 'R_'+str(count)+';'+cols[1]+';'
count += 1
sys.stdout.write("@%s\n%s\n+\n%s\n" % (header, sequence, qual))

fastqreindex(sys.argv[1])

0 comments on commit 7b551ac

Please sign in to comment.