~ubuntu-branches/ubuntu/quantal/genometools/quantal-backports

« back to all changes in this revision

Viewing changes to testdata/gtscripts/cds_stream.lua

  • Committer: Package Import Robot
  • Author(s): Sascha Steinbiss
  • Date: 2012-07-09 14:10:23 UTC
  • Revision ID: package-import@ubuntu.com-20120709141023-juuu4spm6chqsf9o
Tags: upstream-1.4.1
ImportĀ upstreamĀ versionĀ 1.4.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--[[
 
2
  Copyright (c) 2008 Gordon Gremme <gremme@zbh.uni-hamburg.de>
 
3
  Copyright (c) 2008 Center for Bioinformatics, University of Hamburg
 
4
 
 
5
  Permission to use, copy, modify, and distribute this software for any
 
6
  purpose with or without fee is hereby granted, provided that the above
 
7
  copyright notice and this permission notice appear in all copies.
 
8
 
 
9
  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 
10
  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 
11
  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 
12
  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 
13
  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 
14
  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 
15
  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
16
]]
 
17
 
 
18
-- testing the Lua bindings for the CSAStream binding
 
19
 
 
20
function usage()
 
21
  io.stderr:write(string.format("Usage: %s Fasta_file GFF3_file\n", arg[0]))
 
22
  io.stderr:write("Add CDS features to exon features given in GFF3_file.\n")
 
23
  os.exit(1)
 
24
end
 
25
 
 
26
if #arg == 2 then
 
27
  fasta_file = arg[1]
 
28
  gff3file = arg[2]
 
29
else
 
30
  usage()
 
31
end
 
32
 
 
33
in_stream = gt.gff3_in_stream_new_sorted(gff3file)
 
34
region_mapping = gt.region_mapping_new_seqfile(fasta_file)
 
35
cds_stream = gt.cds_stream_new(in_stream, region_mapping)
 
36
out_stream = gt.gff3_out_stream_new(cds_stream)
 
37
in_stream = nil;
 
38
cds_stream = nil;
 
39
collectgarbage() -- being nasty
 
40
 
 
41
gn = out_stream:next_tree()
 
42
while (gn) do
 
43
  gn = out_stream:next_tree()
 
44
end