comparison cpt_trnascanse_to_gff/tRNAscan_to_gff_SE_format.py @ 0:b4134ad44443 draft

Uploaded
author cpt
date Fri, 13 May 2022 18:03:32 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:b4134ad44443
1 #!/usr/bin/env python
2 import fileinput
3
4 print ("##gff-version-3")
5 # process each trna in tsv file
6 metaLines = 0
7 for trna in fileinput.input():
8 if metaLines < 3:
9 metaLines += 1
10 continue
11 cols_tsv = trna.split("\t")
12 if int(cols_tsv[2]) < int(cols_tsv[3]):
13 cols_gff = [
14 cols_tsv[0].strip(),
15 "tRNAscan",
16 "tRNA",
17 cols_tsv[2].strip(),
18 cols_tsv[3].strip(),
19 cols_tsv[8],
20 "+",
21 ".",
22 'ID=trna.%s;Anticodon=%s;Codon=tRNA-%s'
23 % (cols_tsv[1], cols_tsv[5].lower(), cols_tsv[4]),
24 ]
25 else:
26 cols_gff = [
27 cols_tsv[0].strip(),
28 "tRNAscan",
29 "tRNA",
30 cols_tsv[3].strip(),
31 cols_tsv[2].strip(),
32 cols_tsv[8],
33 "-",
34 ".",
35 'ID=trna.%s;Anticodon=%s;Codon=tRNA-%s'
36 % (cols_tsv[1], cols_tsv[5].lower(), cols_tsv[4]),
37 ]
38 print ("\t".join(cols_gff))