Mercurial > repos > fubar > jbrowse2
diff pafcount.py @ 23:39b717d934a8 draft
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
author | fubar |
---|---|
date | Sat, 03 Feb 2024 10:17:27 +0000 |
parents | 2ddd41a0c2d5 |
children |
line wrap: on
line diff
--- a/pafcount.py Thu Feb 01 01:58:58 2024 +0000 +++ b/pafcount.py Sat Feb 03 10:17:27 2024 +0000 @@ -1,4 +1,5 @@ import sys + """ Col Type Description @@ -21,29 +22,29 @@ qtrans = {} ttrans = {} pafname = sys.argv[1] -pf = open(pafname, 'r').readlines() +pf = open(pafname, "r").readlines() for row in pf: - qn,ql,qs,qe,qrs,tn,tl,ts,te,nm,abl,mq = row.strip().split("\t")[:12] + qn, ql, qs, qe, qrs, tn, tl, ts, te, nm, abl, mq = row.strip().split("\t")[:12] - if (qn == tn): # cis - print('cis', qn,tn) + if qn == tn: # cis + print("cis", qn, tn) tcis.setdefault(tn, 0) tcis[tn] = tcis[tn] + 1 qcis.setdefault(qn, 0) qcis[qn] = qcis[qn] + 1 - else: # trans - print('trans', qn,tn) - k = '%s_%s' % (qn,tn) + else: # trans + print("trans", qn, tn) + k = "%s_%s" % (qn, tn) ttrans.setdefault(k, 0) - ttrans[k] = ttrans[k]+ 1 + ttrans[k] = ttrans[k] + 1 qtrans.setdefault(k, 0) - qtrans[k] = qtrans[k] + 1 -#print('qcis', qcis,'\nqtrans', qtrans,'\ntcis', tcis,'\ntt', ttrans) -#print('\nqtrans', qtrans,'\nttrans', ttrans) + qtrans[k] = qtrans[k] + 1 +# print('qcis', qcis,'\nqtrans', qtrans,'\ntcis', tcis,'\ntt', ttrans) +# print('\nqtrans', qtrans,'\nttrans', ttrans) chroms = list(qtrans.keys()) -print('chroms=', chroms) -#print('chrom\tqcis\ttcis\tqtrans\tttrans') -print('chrom\tqtrans\tttrans') +print("chroms=", chroms) +# print('chrom\tqcis\ttcis\tqtrans\tttrans') +print("chrom\tqtrans\tttrans") for cr in chroms: - #print('%s\t%d\t%d\t%d\t%d' % (cr, qcis[cr], tcis[cr], qtrans[cr], ttrans[cr])) - print('%s\t%d\t%d' % (cr, qtrans[cr], ttrans[cr])) + # print('%s\t%d\t%d\t%d\t%d' % (cr, qcis[cr], tcis[cr], qtrans[cr], ttrans[cr])) + print("%s\t%d\t%d" % (cr, qtrans[cr], ttrans[cr]))