Mercurial > repos > fubar > jbrowse2
annotate pafcount.py @ 22:2ddd41a0c2d5 draft
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
author | fubar |
---|---|
date | Thu, 01 Feb 2024 01:58:58 +0000 |
parents | |
children | 39b717d934a8 |
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 |
2ddd41a0c2d5
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff
changeset
|
2 """ |
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 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
|
5 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
|
6 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
|
7 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
|
8 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
|
9 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
|
10 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
|
11 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
|
12 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
|
13 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
|
14 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
|
15 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
|
16 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
|
17 """ |
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 qcis = {} |
2ddd41a0c2d5
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff
changeset
|
20 tcis = {} |
2ddd41a0c2d5
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff
changeset
|
21 qtrans = {} |
2ddd41a0c2d5
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff
changeset
|
22 ttrans = {} |
2ddd41a0c2d5
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff
changeset
|
23 pafname = sys.argv[1] |
2ddd41a0c2d5
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff
changeset
|
24 pf = open(pafname, 'r').readlines() |
2ddd41a0c2d5
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff
changeset
|
25 for row in pf: |
2ddd41a0c2d5
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff
changeset
|
26 qn,ql,qs,qe,qrs,tn,tl,ts,te,nm,abl,mq = row.strip().split("\t")[:12] |
2ddd41a0c2d5
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff
changeset
|
27 |
2ddd41a0c2d5
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff
changeset
|
28 if (qn == tn): # cis |
2ddd41a0c2d5
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff
changeset
|
29 print('cis', qn,tn) |
2ddd41a0c2d5
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff
changeset
|
30 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
|
31 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
|
32 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
|
33 qcis[qn] = qcis[qn] + 1 |
2ddd41a0c2d5
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff
changeset
|
34 else: # trans |
2ddd41a0c2d5
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff
changeset
|
35 print('trans', qn,tn) |
2ddd41a0c2d5
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff
changeset
|
36 k = '%s_%s' % (qn,tn) |
2ddd41a0c2d5
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff
changeset
|
37 ttrans.setdefault(k, 0) |
2ddd41a0c2d5
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff
changeset
|
38 ttrans[k] = ttrans[k]+ 1 |
2ddd41a0c2d5
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff
changeset
|
39 qtrans.setdefault(k, 0) |
2ddd41a0c2d5
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff
changeset
|
40 qtrans[k] = qtrans[k] + 1 |
2ddd41a0c2d5
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff
changeset
|
41 #print('qcis', qcis,'\nqtrans', qtrans,'\ntcis', tcis,'\ntt', ttrans) |
2ddd41a0c2d5
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff
changeset
|
42 #print('\nqtrans', qtrans,'\nttrans', ttrans) |
2ddd41a0c2d5
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff
changeset
|
43 chroms = list(qtrans.keys()) |
2ddd41a0c2d5
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff
changeset
|
44 print('chroms=', chroms) |
2ddd41a0c2d5
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff
changeset
|
45 #print('chrom\tqcis\ttcis\tqtrans\tttrans') |
2ddd41a0c2d5
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff
changeset
|
46 print('chrom\tqtrans\tttrans') |
2ddd41a0c2d5
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff
changeset
|
47 for cr in chroms: |
2ddd41a0c2d5
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff
changeset
|
48 #print('%s\t%d\t%d\t%d\t%d' % (cr, qcis[cr], tcis[cr], qtrans[cr], ttrans[cr])) |
2ddd41a0c2d5
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be4f98b07024b59ff5e1ae0d8b467eecb15c7521-dirty
fubar
parents:
diff
changeset
|
49 print('%s\t%d\t%d' % (cr, qtrans[cr], ttrans[cr])) |