annotate mature_mir_gff_translation.py @ 15:ffcd42f85b61 draft default tip

planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 5eb8570dce4e22fb2759cc16c8e1ce9d304508fe
author artbio
date Sat, 10 Feb 2024 17:15:04 +0000
parents b045c30fb768
children
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(
10
de227b7307cf planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit af0f70b8156c078cc0d832c54ebb678af10c42a0
artbio
parents: 9
diff changeset
8 '--gff_path', action="store", type=str,
de227b7307cf planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit af0f70b8156c078cc0d832c54ebb678af10c42a0
artbio
parents: 9
diff changeset
9 help="path to miRBase GFF3 file")
0
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
10 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
11 '--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
12 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
13 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
14 return args
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
15
3
6b8adacd4750 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit fa65a844f9041a83767f5305ab360abfdf68f59f
artbio
parents: 0
diff changeset
16
9
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
17 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
18
9
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
19 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
20 string_list = []
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
21 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
22 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
23 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
24 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
25 %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
26 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
27
0
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
28 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
29 # 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
30 # 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
31 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
32 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
33 continue
3
6b8adacd4750 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit fa65a844f9041a83767f5305ab360abfdf68f59f
artbio
parents: 0
diff changeset
34 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
35 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
36 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
37 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
38 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
39 "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
40 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
41 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
42 elif gff_fields[2] == "miRNA":
13
b045c30fb768 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit af48e9f6df2717ffd3731a974be1ec36e4eff779"
artbio
parents: 10
diff changeset
43 if "_" in ID:
b045c30fb768 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit af48e9f6df2717ffd3731a974be1ec36e4eff779"
artbio
parents: 10
diff changeset
44 continue
9
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
45 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
46 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
47 # 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
48 gff_list = []
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
49 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
50 # 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
51 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
52 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
53 else:
9
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
54 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
55 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
56 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
57 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
58 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
59 newstart = "1"
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
60 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
61 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
62 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
63 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
64 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
65 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
66 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
67 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
68 phase, attributes))
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
69 # 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
70 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
71 gff_dict[ID]["miRNAs"] = gff_dict[ID]["miRNAs"][:2]
13
b045c30fb768 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit af48e9f6df2717ffd3731a974be1ec36e4eff779"
artbio
parents: 10
diff changeset
72 # sort child miRNAs 5p first 3p second,
b045c30fb768 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit af48e9f6df2717ffd3731a974be1ec36e4eff779"
artbio
parents: 10
diff changeset
73 # if there are two miR mature at least !
b045c30fb768 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit af48e9f6df2717ffd3731a974be1ec36e4eff779"
artbio
parents: 10
diff changeset
74 if len(gff_dict[ID]["miRNAs"]) > 1 and \
b045c30fb768 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit af48e9f6df2717ffd3731a974be1ec36e4eff779"
artbio
parents: 10
diff changeset
75 gff_dict[ID]["miRNAs"][0].find('5p') == -1:
9
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
76 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
77 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
78 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
79 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
80 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
81 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
82 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
83 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
84 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
85 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
86 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
87 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
88 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
89 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
90 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
91 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
92 '%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
93 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
94 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
95 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
96 mir_sfx))
0
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
97 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
98 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
99 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
100 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
101
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
102
10
de227b7307cf planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit af0f70b8156c078cc0d832c54ebb678af10c42a0
artbio
parents: 9
diff changeset
103 def main(gff_path, outfile):
de227b7307cf planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit af0f70b8156c078cc0d832c54ebb678af10c42a0
artbio
parents: 9
diff changeset
104 convert_and_print_gff(gff_path, outfile)
0
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
105
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
106
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
107 if __name__ == "__main__":
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
108 args = Parser()
10
de227b7307cf planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit af0f70b8156c078cc0d832c54ebb678af10c42a0
artbio
parents: 9
diff changeset
109 main(args.gff_path, args.output)