annotate uclust2otutable.py @ 0:e85e7ba38aff draft

"planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
author qfabrepo
date Mon, 14 Sep 2020 04:52:36 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
1 import sys
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
2 import progress
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
3 import subprocess
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
4 import tempfile
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
5 import traceback
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
6 import argparse
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
7
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
8 parser = argparse.ArgumentParser(
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
9 description="This script converts uclust format from vsearch to tabular format"
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
10 )
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
11 parser.add_argument("-v","--version",action="version",version="%(prog)s 1.0")
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
12 parser.add_argument("-i","--input",dest="uclust",default=False,help="input filename in uclust format")
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
13 parser.add_argument("-o","--output",dest="otutable",default=False,help="output filename")
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
14
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
15
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
16 if(len(sys.argv) == 1):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
17 parser.print_help(sys.stderr)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
18 sys.exit()
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
19
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
20 args = parser.parse_args()
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
21
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
22 ucFileName = args.uclust
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
23 outFileName = args.otutable
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
24
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
25
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
26 # Tab-separated fields:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
27 # 1=Type, 2=ClusterNr, 3=SeqLength or ClusterSize, 4=PctId, 5=Strand, 6=QueryStart, 7=SeedStart, 8=Alignment, 9=Label
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
28 # Record types (field 1): L=LibSeed, S=NewSeed, H=Hit, R=Reject, D=LibCluster, C=NewCluster, N=NotMatched
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
29 # For C and D types, PctId is average id with seed.
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
30 # QueryStart and SeedStart are zero-based relative to start of sequence.
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
31 # If minus strand, SeedStart is relative to reverse-complemented seed.
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
32
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
33 MaxError = -1
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
34
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
35 Type = '?'
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
36 ClusterNr = -1
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
37 Size = -1
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
38 PctId = -1.0
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
39 LocalScore = -1.0
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
40 Evalue = -1.0
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
41 Strand = '.'
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
42 QueryStart = -1
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
43 SeedStart = -1
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
44 Alignment = ""
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
45 QueryLabel = ""
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
46 TargetLabel = ""
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
47 FileName = "?"
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
48 Line = ""
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
49
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
50 TRUNC_LABELS=0
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
51
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
52 def GetSampleId(Label):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
53 sep=";"
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
54 SampleID_temp = Label.split(sep,1)[0]
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
55 SampleID = SampleID_temp.split('_',1)[-1]
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
56 return SampleID
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
57
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
58 def OnRec():
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
59 global OTUs, Samples, OTUTable
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
60 if Type != 'H':
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
61 return
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
62
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
63 OTUId = TargetLabel
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
64 if OTUId not in OTUIds:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
65 OTUIds.append(OTUId)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
66 OTUTable[OTUId] = {}
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
67
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
68 SampleId = GetSampleId(QueryLabel)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
69 if SampleId not in SampleIds:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
70 SampleIds.append(SampleId)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
71
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
72 N = GetSizeFromLabel(QueryLabel, 1)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
73 try:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
74 OTUTable[OTUId][SampleId] += N
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
75 except:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
76 OTUTable[OTUId][SampleId] = N
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
77
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
78 def Die(Msg):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
79 print >> sys.stderr
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
80 print >> sys.stderr
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
81
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
82 traceback.print_stack()
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
83 s = ""
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
84 for i in range(0, len(sys.argv)):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
85 if i > 0:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
86 s += " "
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
87 s += sys.argv[i]
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
88 print >> sys.stderr, s
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
89 print >> sys.stderr, "**ERROR**", Msg
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
90 print >> sys.stderr
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
91 print >> sys.stderr
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
92 sys.exit(1)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
93 print("NOTHERE!!")
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
94
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
95 def Warning(Msg):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
96 print >> sys.stderr
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
97 print >> sys.stderr, sys.argv
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
98 print >> sys.stderr, "**WARNING**", Msg
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
99
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
100 def isgap(c):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
101 return c == '-' or c == '.'
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
102
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
103 def GetSeqCount(FileName):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
104 Tmp = tempfile.TemporaryFile()
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
105 try:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
106 TmpFile = Tmp.file
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
107 except:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
108 TmpFile = Tmp
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
109 s = subprocess.call([ "grep", "-c", "^>", FileName ], stdout=TmpFile)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
110 TmpFile.seek(0)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
111 s = TmpFile.read()
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
112 return int(s)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
113
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
114 def GetSeqsDict(FileName):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
115 return ReadSeqsFast(FileName, False)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
116
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
117 def ReadSeqsDict(FileName, Progress = False):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
118 return ReadSeqsFast(FileName, Progress)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
119
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
120 def ReadSeqsOnSeq(FileName, OnSeq, Progress = False):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
121 ReadSeqs3(FileName, OnSeq, Progress)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
122
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
123 def ReadSeqsFastFile(File, Progress = False):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
124 Seqs = {}
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
125 Id = ""
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
126 N = 0
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
127 while 1:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
128 if N%10000 == 0 and Progress:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
129 sys.stderr.write("%u seqs\r" % (N))
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
130 Line = File.readline()
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
131 if len(Line) == 0:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
132 if Progress:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
133 sys.stderr.write("%u seqs\n" % (N))
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
134 return Seqs
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
135 if len(Line) == 0:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
136 continue
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
137 Line = Line.strip()
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
138 if Line[0] == ">":
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
139 N += 1
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
140 Id = Line[1:]
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
141 if TRUNC_LABELS:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
142 Id = Id.split()[0]
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
143 Seqs[Id] = ""
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
144 else:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
145 if Id == "":
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
146 Die("FASTA file does not start with '>'")
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
147 Seqs[Id] = Seqs[Id] + Line
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
148
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
149 def ReadSeqsFast(FileName, Progress = True):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
150 File = open(FileName)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
151 return ReadSeqsFastFile(File, Progress)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
152
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
153 def ReadSeqs(FileName, toupper=False, stripgaps=False, Progress=False):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
154 if not toupper and not stripgaps:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
155 return ReadSeqsFast(FileName, False)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
156
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
157 Seqs = {}
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
158 Id = ""
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
159 File = open(FileName)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
160 while 1:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
161 Line = File.readline()
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
162 if len(Line) == 0:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
163 return Seqs
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
164 Line = Line.strip()
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
165 if len(Line) == 0:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
166 continue
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
167 if Line[0] == ">":
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
168 Id = Line[1:]
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
169 if TRUNC_LABELS:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
170 Id = Id.split()[0]
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
171 if Id in Seqs.keys():
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
172 Die("Duplicate id '%s' in '%s'" % (Id, FileName))
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
173 Seqs[Id] = ""
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
174 else:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
175 if Id == "":
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
176 Die("FASTA file '%s' does not start with '>'" % FileName)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
177 if toupper:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
178 Line = Line.upper()
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
179 if stripgaps:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
180 Line = Line.replace("-", "")
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
181 Line = Line.replace(".", "")
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
182 Seqs[Id] = Seqs[Id] + Line
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
183
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
184 def ReadSeqs2(FileName, ShowProgress = True):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
185 Seqs = []
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
186 Labels = []
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
187 File = open(FileName)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
188 if ShowProgress:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
189 progress.InitFile(File, FileName)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
190 while 1:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
191 progress.File()
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
192 Line = File.readline()
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
193 if len(Line) == 0:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
194 if ShowProgress:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
195 print >> sys.stderr, "\n"
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
196 return Labels, Seqs
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
197 Line = Line.strip()
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
198 if len(Line) == 0:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
199 continue
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
200 if Line[0] == ">":
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
201 Id = Line[1:]
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
202 if TRUNC_LABELS:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
203 Id = Id.split()[0]
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
204 Labels.append(Id)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
205 Seqs.append("")
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
206 else:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
207 i = len(Seqs)-1
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
208 Seqs[i] = Seqs[i] + Line
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
209
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
210 def ReadSeqs3(FileName, OnSeq, ShowProgress = True):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
211 File = open(FileName)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
212 if ShowProgress:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
213 progress.InitFile(File, FileName)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
214 Label = ""
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
215 Seq = ""
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
216 while 1:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
217 Line = File.readline()
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
218 if len(Line) == 0:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
219 if Seq != "":
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
220 OnSeq(Label, Seq)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
221 if ShowProgress:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
222 print >> sys.stderr, "\n"
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
223 return
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
224 Line = Line.strip()
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
225 if len(Line) == 0:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
226 continue
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
227 if Line[0] == ">":
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
228 if Seq != "":
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
229 if ShowProgress:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
230 progress.File()
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
231 if TRUNC_LABELS:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
232 Label = Label.split()[0]
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
233 OnSeq(Label, Seq)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
234 Label = Line[1:]
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
235 Seq = ""
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
236 else:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
237 Seq += Line
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
238
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
239 def WriteSeq(File, Seq, Label = ""):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
240 if Label != "":
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
241 print >> File, ">" + Label
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
242 BLOCKLENGTH = 80
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
243 SeqLength = len(Seq)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
244 BlockCount = int((SeqLength + (BLOCKLENGTH-1))/BLOCKLENGTH)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
245 for BlockIndex in range(0, BlockCount):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
246 Block = Seq[BlockIndex*BLOCKLENGTH:]
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
247 Block = Block[:BLOCKLENGTH]
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
248 print >> File, Block
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
249
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
250 def GetSizeFromLabel(Label, Default = -1):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
251 Fields = Label.split(";")
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
252 for Field in Fields:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
253 if Field.startswith("size="):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
254 return int(Field[5:])
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
255 if Default == -1:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
256 Die("Missing size >" + Label)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
257 return Default
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
258
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
259 def StripSizeFromLabel(Label):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
260 Fields = Label.split(";")
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
261 NewLabel = ""
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
262 for Field in Fields:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
263 if Field.startswith("size="):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
264 continue
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
265 if NewLabel != "":
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
266 NewLabel += ";"
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
267 NewLabel += Field
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
268 return NewLabel
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
269
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
270 def GetQualFromLabel(Label):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
271 n = Label.find("qual=")
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
272 assert n >= 0
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
273 return Label[n+5:-1]
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
274
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
275 def StripQualFromLabel(Label):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
276 n = Label.find("qual=")
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
277 assert n >= 0
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
278 return Label[:n]
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
279
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
280 def GetField(Label, Name, Default):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
281 Fields = Label.split(';')
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
282 for Field in Fields:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
283 if Field.startswith(Name + "="):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
284 n = len(Name) + 1
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
285 return Field[n:]
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
286 if Default == "":
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
287 Die("Field %s= not found in >%s" % (Name, Label))
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
288 return Default
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
289
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
290 def GetIntFieldFromLabel(Label, Name, Default):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
291 return int(GetField(Label, Name, Default))
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
292
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
293 def GetFieldFromLabel(Label, Name, Default):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
294 return GetField(Label, Name, Default)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
295
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
296 def DeleteFieldFromLabel(Label, Name):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
297 NewLabel = ""
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
298 Fields = Label.split(';')
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
299 for Field in Fields:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
300 if len(Field) > 0 and not Field.startswith(Name + "="):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
301 NewLabel += Field + ';'
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
302 return NewLabel
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
303
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
304 def ReplaceSize(Label, Size):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
305 Fields = Label.split(";")
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
306 NewLabel = ""
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
307 Done = False
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
308 for Field in Fields:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
309 if Field.startswith("size="):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
310 NewLabel += "size=%u;" % Size
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
311 Done = True
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
312 else:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
313 if Field != "":
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
314 NewLabel += Field + ";"
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
315 if not Done:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
316 die.Die("size= not found in >" + Label)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
317 return NewLabel
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
318
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
319 def Error(s):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
320 print >> sys.stderr, "*** ERROR ***", s, sys.argv
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
321 sys.exit(1)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
322
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
323 def ProgressFile(File, FileSize):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
324 # if not sys.stderr.isatty():
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
325 # return
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
326 Pos = File.tell()
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
327 Pct = (100.0*Pos)/FileSize
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
328 Str = "%s %5.1f%%\r" % (FileName, Pct)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
329 sys.stderr.write(Str)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
330
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
331 def Progress(i, N):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
332 # if not sys.stderr.isatty():
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
333 return
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
334 Pct = (100.0*i)/N
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
335 Str = "%5.1f%%\r" % Pct
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
336 sys.stderr.write(Str)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
337
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
338 def PrintLine():
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
339 print(Line)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
340
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
341 def ParseRec(Line):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
342 global Type
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
343 global ClusterNr
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
344 global Size
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
345 global PctId
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
346 global Strand
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
347 global QueryStart
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
348 global SeedStart
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
349 global Alignment
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
350 global QueryLabel
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
351 global TargetLabel
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
352 global LocalScore
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
353 global Evalue
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
354
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
355 Fields = Line.split("\t")
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
356 N = len(Fields)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
357 if N != 9 and N != 10:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
358 Error("Expected 9 or 10 fields in .uc record, got: " + Line)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
359 Type = Fields[0]
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
360
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
361 try:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
362 ClusterNr = int(Fields[1])
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
363 except:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
364 ClusterNr = -1
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
365
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
366 try:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
367 Size = int(Fields[2])
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
368 except:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
369 Size = -1
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
370
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
371 Fields2 = Fields[3].split('/')
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
372 LocalScore = -1.0
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
373 Evalue = -1.0
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
374 if len(Fields2) == 3:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
375 try:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
376 PctId = float(Fields2[0])
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
377 LocalScore = float(Fields2[1])
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
378 Evalue = float(Fields2[2])
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
379 except:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
380 PctId = -1.0
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
381 else:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
382 try:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
383 PctId = float(Fields[3])
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
384 except:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
385 PctId = -1.0
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
386
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
387 Strand = Fields[4]
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
388
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
389 try:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
390 QueryStart = int(Fields[5])
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
391 except:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
392 QueryStart = -1
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
393
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
394 try:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
395 SeedStart = int(Fields[6])
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
396 except:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
397 SeedStart = -1
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
398
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
399 Alignment = Fields[7]
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
400 QueryLabel = Fields[8]
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
401
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
402 if len(Fields) > 9:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
403 TargetLabel = Fields[9]
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
404
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
405 def GetRec(File, OnRecord):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
406 global Line
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
407 while 1:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
408 Line = File.readline()
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
409 if len(Line) == 0:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
410 return 0
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
411 if Line[0] == '#':
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
412 continue
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
413 Line = Line.strip()
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
414 if len(Line) == 0:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
415 return 1
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
416 ParseRec(Line)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
417 Ok = OnRecord()
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
418 if Ok != None and Ok == 0:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
419 return 0
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
420 return 1
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
421
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
422 def ReadRecs(argFileName, OnRecord, ShowProgress = False):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
423 return ReadFile(argFileName, OnRecord, ShowProgress)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
424
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
425 def ReadRecsOnRec(argFileName, OnRecord, ShowProgress = True):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
426 return ReadFile(argFileName, OnRecord, ShowProgress)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
427
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
428 def GetRecs(argFileName, OnRecord, ShowProgress = True):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
429 return ReadFile(argFileName, OnRecord, ShowProgress)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
430
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
431 def ReadFile(argFileName, OnRecord, ShowProgress = True):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
432 global FileName
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
433 FileName = argFileName
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
434 File = open(FileName)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
435
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
436 if ShowProgress:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
437 progress.InitFile(File, FileName)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
438 while GetRec(File, OnRecord):
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
439 if ShowProgress:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
440 progress.File()
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
441 if ShowProgress:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
442 progress.FileDone()
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
443
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
444 OTUIds = []
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
445 SampleIds = []
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
446 OTUTable = {}
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
447
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
448 ReadRecs(ucFileName, OnRec)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
449
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
450 fout=open(outFileName,'w')
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
451
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
452 s = "OTUId"
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
453 for SampleId in SampleIds:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
454 s += "\t" + SampleId
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
455
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
456 fout.write("%s\n" % s)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
457
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
458 for OTUId in OTUIds:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
459 s = OTUId
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
460 for SampleId in SampleIds:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
461 try:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
462 n = OTUTable[OTUId][SampleId]
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
463 except:
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
464 n = 0
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
465 s += "\t" + str(n)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
466 fout.write("%s\n" % s)
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
467
e85e7ba38aff "planemo upload for repository https://github.com/QFAB-Bioinformatics/metaDEGalaxy/tree/master/uc2otutable commit 0db3cb4e9a87400bb2f8402ffc23334e24ad4b4e-dirty"
qfabrepo
parents:
diff changeset
468 fout.close()