Skip to content

Instantly share code, notes, and snippets.

@drio
Created August 20, 2011 14:52
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save drio/1159195 to your computer and use it in GitHub Desktop.
#!/usr/bin/env luajit
--
-- http://biostar.stackexchange.com/questions/10376/how-to-efficiently-parse-a-huge-fastq-file
--
local fp, h, ln, f, l = io.open(arg[1]), {}, 0, f, nil;
for l in fp:lines() do h["@" .. l] = 1 end
for l in io.lines() do
if ln % 4 == 0 then
if h[l]~=nil then f=1 else f=0 end
end
if f == 1 then print(l) end
ln = ln + 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment