annotate pafcount.py @ 27:4ff1ed2065cc draft

planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit d733fb18a02929c9e9959ad30bd0f1368118e924-dirty
author fubar
date Wed, 07 Feb 2024 22:37:10 +0000
parents 39b717d934a8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22
2ddd41a0c2d5 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff changeset
1 import sys
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 22
diff changeset
2
22
2ddd41a0c2d5 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff changeset
3 """
2ddd41a0c2d5 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff changeset
4
2ddd41a0c2d5 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff changeset
5 Col Type Description
2ddd41a0c2d5 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff changeset
6 1 string Query sequence name
2ddd41a0c2d5 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff changeset
7 2 int Query sequence length
2ddd41a0c2d5 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff changeset
8 3 int Query start (0-based; BED-like; closed)
2ddd41a0c2d5 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff changeset
9 4 int Query end (0-based; BED-like; open)
2ddd41a0c2d5 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff changeset
10 5 char Relative strand: "+" or "-"
2ddd41a0c2d5 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff changeset
11 6 string Target sequence name
2ddd41a0c2d5 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff changeset
12 7 int Target sequence length
2ddd41a0c2d5 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff changeset
13 8 int Target start on original strand (0-based)
2ddd41a0c2d5 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff changeset
14 9 int Target end on original strand (0-based)
2ddd41a0c2d5 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff changeset
15 10 int Number of residue matches
2ddd41a0c2d5 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff changeset
16 11 int Alignment block length
2ddd41a0c2d5 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff changeset
17 12 int Mapping quality (0-255; 255 for missing)
2ddd41a0c2d5 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff changeset
18 """
2ddd41a0c2d5 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff changeset
19
2ddd41a0c2d5 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff changeset
20 qcis = {}
2ddd41a0c2d5 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff changeset
21 tcis = {}
2ddd41a0c2d5 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff changeset
22 qtrans = {}
2ddd41a0c2d5 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff changeset
23 ttrans = {}
2ddd41a0c2d5 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff changeset
24 pafname = sys.argv[1]
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 22
diff changeset
25 pf = open(pafname, "r").readlines()
22
2ddd41a0c2d5 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff changeset
26 for row in pf:
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 22
diff changeset
27 qn, ql, qs, qe, qrs, tn, tl, ts, te, nm, abl, mq = row.strip().split("\t")[:12]
22
2ddd41a0c2d5 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff changeset
28
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 22
diff changeset
29 if qn == tn: # cis
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 22
diff changeset
30 print("cis", qn, tn)
22
2ddd41a0c2d5 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff changeset
31 tcis.setdefault(tn, 0)
2ddd41a0c2d5 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff changeset
32 tcis[tn] = tcis[tn] + 1
2ddd41a0c2d5 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff changeset
33 qcis.setdefault(qn, 0)
2ddd41a0c2d5 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff changeset
34 qcis[qn] = qcis[qn] + 1
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 22
diff changeset
35 else: # trans
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 22
diff changeset
36 print("trans", qn, tn)
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 22
diff changeset
37 k = "%s_%s" % (qn, tn)
22
2ddd41a0c2d5 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff changeset
38 ttrans.setdefault(k, 0)
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 22
diff changeset
39 ttrans[k] = ttrans[k] + 1
22
2ddd41a0c2d5 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff changeset
40 qtrans.setdefault(k, 0)
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 22
diff changeset
41 qtrans[k] = qtrans[k] + 1
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 22
diff changeset
42 # print('qcis', qcis,'\nqtrans', qtrans,'\ntcis', tcis,'\ntt', ttrans)
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 22
diff changeset
43 # print('\nqtrans', qtrans,'\nttrans', ttrans)
22
2ddd41a0c2d5 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff changeset
44 chroms = list(qtrans.keys())
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 22
diff changeset
45 print("chroms=", chroms)
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 22
diff changeset
46 # print('chrom\tqcis\ttcis\tqtrans\tttrans')
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 22
diff changeset
47 print("chrom\tqtrans\tttrans")
22
2ddd41a0c2d5 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff changeset
48 for cr in chroms:
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 22
diff changeset
49 # print('%s\t%d\t%d\t%d\t%d' % (cr, qcis[cr], tcis[cr], qtrans[cr], ttrans[cr]))
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 22
diff changeset
50 print("%s\t%d\t%d" % (cr, qtrans[cr], ttrans[cr]))