annotate mature_mir_gff_translation.py @ 9:2a08a6eb471c draft

planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
author artbio
date Wed, 25 Apr 2018 12:48:27 -0400
parents 3f62272192f9
children de227b7307cf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5
9ea96a02c416 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 04980585c257ab5f8eb5d10de007316c47c5d1ce
artbio
parents: 3
diff changeset
1 import argparse
9ea96a02c416 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 04980585c257ab5f8eb5d10de007316c47c5d1ce
artbio
parents: 3
diff changeset
2 from datetime import datetime
0
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
3
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
4
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
5 def Parser():
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
6 the_parser = argparse.ArgumentParser()
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
7 the_parser.add_argument(
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
8 '--input', action="store", type=str, help="input miRBase GFF3 file")
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
9 the_parser.add_argument(
3
6b8adacd4750 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit fa65a844f9041a83767f5305ab360abfdf68f59f
artbio
parents: 0
diff changeset
10 '--output', action="store", type=str,
6b8adacd4750 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit fa65a844f9041a83767f5305ab360abfdf68f59f
artbio
parents: 0
diff changeset
11 help="output GFF3 file with converted mature mir coordinates")
0
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
12 args = the_parser.parse_args()
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
13 return args
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
14
3
6b8adacd4750 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit fa65a844f9041a83767f5305ab360abfdf68f59f
artbio
parents: 0
diff changeset
15
9
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
16 def convert_and_print_gff(gff_input_file, output):
0
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
17
9
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
18 def get_gff_header(gff_input_file):
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
19 string_list = []
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
20 for line in open(gff_input_file, "r"):
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
21 if line[0] == '#':
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
22 string_list.append(line)
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
23 string_list.append('# generated by mature_mir_gff_translation.py \
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
24 %s\n#\n' % str(datetime.now()))
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
25 return ''.join(string_list)
3
6b8adacd4750 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit fa65a844f9041a83767f5305ab360abfdf68f59f
artbio
parents: 0
diff changeset
26
0
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
27 gff_dict = {}
9
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
28 # see https://github.com/ARTbio/tools-artbio/issues/246
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
29 # currently fixed by perl pretreatment or the gff3 file
0
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
30 for line in open(gff_input_file, "r"):
3
6b8adacd4750 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit fa65a844f9041a83767f5305ab360abfdf68f59f
artbio
parents: 0
diff changeset
31 if line[0] == "#":
0
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
32 continue
3
6b8adacd4750 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit fa65a844f9041a83767f5305ab360abfdf68f59f
artbio
parents: 0
diff changeset
33 gff_fields = line[:-1].split("\t")
6b8adacd4750 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit fa65a844f9041a83767f5305ab360abfdf68f59f
artbio
parents: 0
diff changeset
34 ID = gff_fields[8].split("ID=")[1].split(";")[0]
9
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
35 if gff_fields[2] == "miRNA_primary_transcript":
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
36 gff_dict[ID] = {}
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
37 gff_dict[ID]["premir_name"] = gff_fields[8].split(
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
38 "Name=")[1].split(";")[0]
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
39 gff_dict[ID]["primary"] = line[:-1]
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
40 gff_dict[ID]["miRNAs"] = []
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
41 elif gff_fields[2] == "miRNA":
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
42 parent_ID = gff_fields[8].split("erives_from=")[1]
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
43 gff_dict[parent_ID]["miRNAs"].append(line[:-1])
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
44 # Now reorganise features and recalculate coordinates of premirs and mirs
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
45 gff_list = []
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
46 for ID in sorted(gff_dict, key=lambda x: (gff_dict[x]['premir_name'])):
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
47 # delete premir and their mir with ID containing "_"
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
48 if "_" in ID:
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
49 del gff_dict[ID]
0
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
50 else:
9
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
51 primary_fields = gff_dict[ID]["primary"].split('\t')
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
52 seqid = primary_fields[8].split("Name=")[1].split(";")[0]
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
53 source = primary_fields[1]
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
54 type = primary_fields[2]
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
55 start = primary_fields[3]
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
56 newstart = "1"
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
57 end = primary_fields[4]
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
58 newend = str(int(end)-int(start)+1)
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
59 score = primary_fields[5]
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
60 strand = primary_fields[6]
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
61 phase = primary_fields[7]
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
62 attributes = primary_fields[8]
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
63 gff_list.append('%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s' % (seqid,
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
64 source, type, newstart, newend, score, strand,
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
65 phase, attributes))
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
66 # ensure their is only 2 child miRNAs at best
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
67 if len(gff_dict[ID]["miRNAs"]) > 2:
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
68 gff_dict[ID]["miRNAs"] = gff_dict[ID]["miRNAs"][:2]
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
69 # sort child miRNAs 5p first 3p second
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
70 if gff_dict[ID]["miRNAs"][0].find('5p') == -1:
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
71 gff_dict[ID]["miRNAs"] = gff_dict[ID]["miRNAs"][::-1]
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
72 for mir in gff_dict[ID]["miRNAs"]:
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
73 mir_fields = mir.split('\t')
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
74 mir_seqid = mir_fields[8].split("Name=")[1].split(";")[0]
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
75 mir_source = mir_fields[1]
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
76 mir_type = mir_fields[2]
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
77 mir_start = mir_fields[3]
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
78 mir_end = mir_fields[4]
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
79 new_mir_start = str(int(mir_start)-int(start)+1)
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
80 new_mir_end = str(int(mir_end)-int(start)+1)
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
81 mir_score = mir_fields[5]
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
82 mir_strand = mir_fields[6]
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
83 mir_phase = mir_fields[7]
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
84 mir_attributes = mir_fields[8]
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
85 mir_sfx = ";Parent_mir_Name=%s" % gff_dict[ID]["premir_name"]
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
86 gff_list.append(
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
87 '%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s%s' % (
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
88 mir_seqid, mir_source, mir_type,
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
89 new_mir_start, new_mir_end, mir_score,
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
90 mir_strand, mir_phase, mir_attributes,
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
91 mir_sfx))
0
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
92 with open(output, "w") as output:
9
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
93 output.write('%s' % get_gff_header(gff_input_file))
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
94 output.write('\n'.join(gff_list))
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
95 output.write('\n')
0
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
96
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
97
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
98 def main(infile, outfile):
9
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
99 convert_and_print_gff(infile, outfile)
0
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
100
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
101
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
102 if __name__ == "__main__":
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
103 args = Parser()
3
6b8adacd4750 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit fa65a844f9041a83767f5305ab360abfdf68f59f
artbio
parents: 0
diff changeset
104 main(args.input, args.output)