Created
September 5, 2014 19:55
-
-
Save satta/e6a6c179dac88fcbd51f to your computer and use it in GitHub Desktop.
simple gene extractor for access time testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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