annotate tbl2gff3.py @ 1:4a7f4b0cc0a3 draft default tip

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit db75a8489a1f61ea30abe9b91f6febac8b34204f"
author iuc
date Thu, 03 Dec 2020 16:59:23 +0000
parents 965674d88d34
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
1 #!/usr/bin/env python
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
2 import argparse
1
4a7f4b0cc0a3 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit db75a8489a1f61ea30abe9b91f6febac8b34204f"
iuc
parents: 0
diff changeset
3 import collections
0
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
4 import csv
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
5 import sys
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
6
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
7 from BCBio import GFF
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
8 from Bio.Seq import Seq
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
9 from Bio.SeqFeature import FeatureLocation, SeqFeature
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
10 from Bio.SeqRecord import SeqRecord
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
11
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
12
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
13 def c(row, v, default=None):
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
14 if v is None:
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
15 return default
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
16
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
17 try:
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
18 _ = int(v)
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
19 return row[int(v) - 1]
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
20 except ValueError:
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
21 return v
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
22
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
23
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
24 def tbl2gff3(
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
25 table,
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
26 rid,
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
27 begin,
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
28 end,
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
29 source=None,
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
30 type=None,
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
31 score=None,
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
32 frame=None,
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
33 a=None,
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
34 strand_column=None,
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
35 strand_value=None,
1
4a7f4b0cc0a3 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit db75a8489a1f61ea30abe9b91f6febac8b34204f"
iuc
parents: 0
diff changeset
36 strand_infer=False,
0
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
37 ):
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
38
1
4a7f4b0cc0a3 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit db75a8489a1f61ea30abe9b91f6febac8b34204f"
iuc
parents: 0
diff changeset
39 records = collections.OrderedDict()
0
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
40
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
41 for row in csv.reader(table, delimiter="\t"):
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
42 # print(', '.join(row))
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
43
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
44 # if we haven't seen this record before, populate it.
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
45 recid = c(row, rid)
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
46 if recid not in records:
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
47 records[recid] = SeqRecord(Seq("ACTG"), id=recid)
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
48
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
49 r = records[recid]
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
50 q = {}
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
51 if c(row, score) is not None:
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
52 q["score"] = float(c(row, score))
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
53
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
54 q["source"] = c(row, source, "tbl2gff3")
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
55
1
4a7f4b0cc0a3 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit db75a8489a1f61ea30abe9b91f6febac8b34204f"
iuc
parents: 0
diff changeset
56 begin_i = int(c(row, begin))
4a7f4b0cc0a3 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit db75a8489a1f61ea30abe9b91f6febac8b34204f"
iuc
parents: 0
diff changeset
57 end_i = int(c(row, end))
4a7f4b0cc0a3 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit db75a8489a1f61ea30abe9b91f6febac8b34204f"
iuc
parents: 0
diff changeset
58
4a7f4b0cc0a3 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit db75a8489a1f61ea30abe9b91f6febac8b34204f"
iuc
parents: 0
diff changeset
59 begin_f = min(begin_i, end_i)
4a7f4b0cc0a3 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit db75a8489a1f61ea30abe9b91f6febac8b34204f"
iuc
parents: 0
diff changeset
60 end_f = max(begin_i, end_i)
4a7f4b0cc0a3 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit db75a8489a1f61ea30abe9b91f6febac8b34204f"
iuc
parents: 0
diff changeset
61
0
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
62 _str = None
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
63 if strand_column is not None:
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
64 _str = int(c(row, strand_column))
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
65 elif strand_value is not None:
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
66 _str = int(strand_value)
1
4a7f4b0cc0a3 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit db75a8489a1f61ea30abe9b91f6febac8b34204f"
iuc
parents: 0
diff changeset
67 if strand_infer:
4a7f4b0cc0a3 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit db75a8489a1f61ea30abe9b91f6febac8b34204f"
iuc
parents: 0
diff changeset
68 if begin_i > begin_f:
4a7f4b0cc0a3 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit db75a8489a1f61ea30abe9b91f6febac8b34204f"
iuc
parents: 0
diff changeset
69 _str = -1
4a7f4b0cc0a3 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit db75a8489a1f61ea30abe9b91f6febac8b34204f"
iuc
parents: 0
diff changeset
70 else:
4a7f4b0cc0a3 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit db75a8489a1f61ea30abe9b91f6febac8b34204f"
iuc
parents: 0
diff changeset
71 _str = 1
0
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
72
1
4a7f4b0cc0a3 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit db75a8489a1f61ea30abe9b91f6febac8b34204f"
iuc
parents: 0
diff changeset
73 if a is not None:
4a7f4b0cc0a3 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit db75a8489a1f61ea30abe9b91f6febac8b34204f"
iuc
parents: 0
diff changeset
74 for x in a:
4a7f4b0cc0a3 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit db75a8489a1f61ea30abe9b91f6febac8b34204f"
iuc
parents: 0
diff changeset
75 k, v = x.split(":", 1)
4a7f4b0cc0a3 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit db75a8489a1f61ea30abe9b91f6febac8b34204f"
iuc
parents: 0
diff changeset
76 _v = c(row, v)
4a7f4b0cc0a3 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit db75a8489a1f61ea30abe9b91f6febac8b34204f"
iuc
parents: 0
diff changeset
77 if k in q:
4a7f4b0cc0a3 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit db75a8489a1f61ea30abe9b91f6febac8b34204f"
iuc
parents: 0
diff changeset
78 q[k].append(_v)
4a7f4b0cc0a3 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit db75a8489a1f61ea30abe9b91f6febac8b34204f"
iuc
parents: 0
diff changeset
79 else:
4a7f4b0cc0a3 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit db75a8489a1f61ea30abe9b91f6febac8b34204f"
iuc
parents: 0
diff changeset
80 q[k] = [_v]
0
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
81
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
82 f = SeqFeature(
1
4a7f4b0cc0a3 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit db75a8489a1f61ea30abe9b91f6febac8b34204f"
iuc
parents: 0
diff changeset
83 FeatureLocation(begin_f, end_f),
0
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
84 type=c(row, type),
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
85 strand=_str,
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
86 qualifiers=q,
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
87 )
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
88 r.features.append(f)
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
89
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
90 return records
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
91
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
92
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
93 if __name__ == "__main__":
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
94 parser = argparse.ArgumentParser(description="Convert tables to gff3", epilog="")
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
95 parser.add_argument("table", type=argparse.FileType("r"), help="Tabular Input")
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
96 parser.add_argument("rid", help="id column")
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
97 parser.add_argument("begin", help="begin column")
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
98 parser.add_argument("end", help="end column")
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
99 parser.add_argument("--type", help="feature type column")
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
100 parser.add_argument("--score", help="score column")
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
101 parser.add_argument("--source", help="source column")
1
4a7f4b0cc0a3 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit db75a8489a1f61ea30abe9b91f6febac8b34204f"
iuc
parents: 0
diff changeset
102 parser.add_argument("--strand_infer", action='store_true', help="infer strand")
0
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
103 parser.add_argument("--strand_column", help="strand column")
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
104 parser.add_argument("--strand_value", help="strand value")
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
105 # parser.add_argument('--frame', help='frame column')
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
106 parser.add_argument("-a", action="append", help="attribute column (-a k:v)")
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
107 args = parser.parse_args()
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
108
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
109 for rid, rec in tbl2gff3(**vars(args)).items():
965674d88d34 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tbl2gff3 commit 725ff8b6a4f01bf532052ce46400f529551a317d"
iuc
parents:
diff changeset
110 GFF.write([rec], sys.stdout)