annotate mature_mir_gff_translation.py @ 11:7d50d8d0c8c4 draft

planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 23d2d39d751ee5924f829147b9d9e52e4aa858bc
author artbio
date Fri, 11 May 2018 10:52:45 -0400
parents de227b7307cf
children b045c30fb768
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")
10
de227b7307cf planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit af0f70b8156c078cc0d832c54ebb678af10c42a0
artbio
parents: 9
diff changeset
13 the_parser.add_argument(
de227b7307cf planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit af0f70b8156c078cc0d832c54ebb678af10c42a0
artbio
parents: 9
diff changeset
14 '--basename', 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
15 help="basename of the parsed gff file returned")
0
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
16 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
17 return args
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
18
3
6b8adacd4750 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit fa65a844f9041a83767f5305ab360abfdf68f59f
artbio
parents: 0
diff changeset
19
9
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
20 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
21
9
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
22 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
23 string_list = []
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
24 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
25 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
26 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
27 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
28 %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
29 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
30
0
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
31 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
32 # 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
33 # 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
34 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
35 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
36 continue
3
6b8adacd4750 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit fa65a844f9041a83767f5305ab360abfdf68f59f
artbio
parents: 0
diff changeset
37 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
38 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
39 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
40 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
41 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
42 "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
43 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
44 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
45 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
46 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
47 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
48 # 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
49 gff_list = []
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
50 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
51 # 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
52 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
53 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
54 else:
9
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
55 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
56 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
57 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
58 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
59 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
60 newstart = "1"
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
61 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
62 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
63 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
64 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
65 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
66 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
67 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
68 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
69 phase, attributes))
2a08a6eb471c planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 6013aaf29ff7aa2d1aab434f2355da327c7ef102
artbio
parents: 8
diff changeset
70 # 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
71 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
72 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
73 # 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
74 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
75 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
76 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
77 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
78 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
79 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
80 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
81 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
82 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
83 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
84 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
85 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
86 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
87 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
88 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
89 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
90 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
91 '%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
92 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
93 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
94 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
95 mir_sfx))
0
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
96 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
97 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
98 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
99 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
100
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
101
10
de227b7307cf planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit af0f70b8156c078cc0d832c54ebb678af10c42a0
artbio
parents: 9
diff changeset
102 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
103 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
104
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 if __name__ == "__main__":
da29af78a960 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
artbio
parents:
diff changeset
107 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
108 main(args.gff_path, args.output)