Skip to content

Instantly share code, notes, and snippets.

@satta
Created September 5, 2014 19:55
Show Gist options
  • Save satta/e6a6c179dac88fcbd51f to your computer and use it in GitHub Desktop.
Save satta/e6a6c179dac88fcbd51f to your computer and use it in GitHub Desktop.
simple gene extractor for access time testing
rm = gt.region_mapping_new_seqfile_matchdescstart(arg[2])
cv = gt.custom_visitor_new()
function cv:visit_feature(fn)
if fn:get_type() == "gene" then
print(fn:extract_sequence("gene", false, rm):len())
end
end
gs = gt.gff3_in_stream_new_sorted(arg[1])
cs = gt.custom_stream_new_sorted()
cs.instream = gs
function cs:next_tree()
n = self.instream:next_tree()
if n then
n:accept(cv)
end
return n
end
local gn = cs:next_tree()
while (gn) do
gn = cs:next_tree()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment