Skip to content

Instantly share code, notes, and snippets.

Created November 3, 2010 15:00
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 anonymous/661178 to your computer and use it in GitHub Desktop.
Save anonymous/661178 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
#
i = 0
fq_entries = 0
STDIN.each_line do |l|
id = l.match(/^([_\w]+)\s/)
cs_seq = l.match(/\sCS:Z:([ACGT0123.]+)\s/)
qual = l.match(/\sCQ:Z:(.+)\s+CM/)
if id && cs_seq && qual
printf("@%s\n%s\n+\n%s\n", id[1], cs_seq[1], qual[1])
fq_entries = fq_entries + 1
end
i = i + 1
STDERR.printf("\r%d:%d", i, fq_entries) if i % 10000 == 0
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment