Skip to content

Commit 62575d6

Browse files
committed
Fix of merges
1 parent ccb42be commit 62575d6

File tree

3 files changed

+21
-16
lines changed

3 files changed

+21
-16
lines changed

lib/BtCore.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ def view(self, **kwargs):
5757
tax_lib_names = [taxLib for taxLib in sorted(self.hitLibs)]
5858
lineages = self.lineages
5959
# setup
60+
6061
for viewObj in viewObjs:
62+
#print("in view:", viewObj.name)
6163
if viewObj.name == 'table':
6264
viewObj.header = self.getTableHeader(taxrule, ranks, hits_flag, cov_lib_names)
6365
if viewObj.name == 'concoct_cov':
@@ -100,6 +102,7 @@ def view(self, **kwargs):
100102
viewObj.body.append(self.getCovLine(blob, cov_lib_names))
101103
pbar.update()
102104
for viewObj in viewObjs:
105+
#print(viewObj.name)
103106
viewObj.output()
104107

105108
def getCovHeader(self, cov_lib_names):
@@ -763,8 +766,8 @@ def get_meta(self):
763766
cov_names = filter(lambda name: name != "covsum",self.covs)
764767
for taxrule in self.tax:
765768
self.tax_scores[taxrule] = defaultdict(lambda: {'score':[],'c_index':[]})
766-
for id in self.blobDb.order_of_blobs:
767-
blob = self.blobDb.dict_of_blobs[id]
769+
for _id in self.blobDb.order_of_blobs:
770+
blob = self.blobDb.dict_of_blobs[_id]
768771
self.read_covs['covsum'].append(0)
769772
for cov_name in cov_names:
770773
self.read_covs[cov_name].append(blob['read_cov'][cov_name])
@@ -781,11 +784,11 @@ def get_meta(self):
781784
cov_libs = []
782785
for cov_name in self.covs:
783786
name = self._remove_cov_suffix(cov_name,self.blobDb.covLibs)
784-
id = "%s_%s" % (name,cov)
785-
cov_lib_meta = {"id":id, "name":name }
787+
_id = "%s_%s" % (name,cov)
788+
cov_lib_meta = {"id": _id, "name":name }
786789
if cov_name == "cov0" and cov == "cov":
787790
cov_lib_meta["preload"] = True
788-
meta['plot']['y'] = id
791+
meta['plot']['y'] = _id
789792
cov_libs.append(cov_lib_meta)
790793
cov_meta = {"id":"%s" % cov, "name":"Coverage", "type":"variable", "datatype":"float", "scale":"scaleLog", "range":self._format_float([0.02,max(self.covs["covsum"])])}
791794
if cov == 'read_cov':
@@ -799,14 +802,14 @@ def get_meta(self):
799802
for taxrule in self.tax:
800803
taxrule_meta = {"id":taxrule, "name":taxrule, "children":[] }
801804
for rank in self.tax[taxrule]:
802-
id = "%s_%s" % (taxrule,rank)
805+
_id = "%s_%s" % (taxrule,rank)
803806
tax_rank_data = []
804-
tax_rank_data.append({ "id":"%s_score" % id, "name":"%s score" % id, "type":"variable", "datatype":"float", "scale":"scaleLog", "range":[0.2,max(self.tax_scores[taxrule][rank]['score'])], "preload":False, "active":False })
805-
tax_rank_data.append({ "id":"%s_cindex" % id, "name":"%s c-index" % id, "type":"variable", "datatype":"integer", "scale":"scaleLinear", "range":[0,max(self.tax_scores[taxrule][rank]['c_index'])], "preload":False, "active":False })
806-
tax_rank_meta = { "id":id, "name":id, "data": tax_rank_data }
807+
tax_rank_data.append({ "id":"%s_score" % _id, "name":"%s score" % _id, "type":"variable", "datatype":"float", "scale":"scaleLog", "range":[0.2,max(self.tax_scores[taxrule][rank]['score'])], "preload":False, "active":False })
808+
tax_rank_data.append({ "id":"%s_cindex" % _id, "name":"%s c-index" % _id, "type":"variable", "datatype":"integer", "scale":"scaleLinear", "range":[0,max(self.tax_scores[taxrule][rank]['c_index'])], "preload":False, "active":False })
809+
tax_rank_meta = { "id":_id, "name":_id, "data": tax_rank_data }
807810
if rank == "phylum":
808811
tax_rank_meta["preload"] = True
809-
meta['plot']['cat'] = id
812+
meta['plot']['cat'] = _id
810813
taxrule_meta['children'].append(tax_rank_meta)
811814
tax_rules.append(taxrule_meta)
812815
tax_meta = {"id":"taxonomy", "name":"Taxonomy", "type":"category", "datatype":"string"}
@@ -833,7 +836,7 @@ def output(self):
833836
# meta
834837
meta = self.get_meta()
835838
meta_f = join(self.view_dir, "meta.json")
836-
BtIO.writeJson(meta, meta_f, indent=2)
839+
BtIO.writeJson(meta, meta_f)
837840
# gc
838841
gc_f = join(self.view_dir, "gc.json")
839842
print(BtLog.status_d['13'] % (gc_f))

lib/BtIO.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ def parseNodesDB(**kwargs):
585585
BtLog.error('47', nodesDB_f)
586586
BtLog.status_d['27'] % (nodesDB_f, nodes_f, names_f)
587587
else:
588-
print BtLog.status_d['3'] % (nodes_f, names_f)
588+
print(BtLog.status_d['3'] % (nodes_f, names_f))
589589
try:
590590
nodesDB = readNamesNodes(names_f, nodes_f)
591591
except:
@@ -611,11 +611,11 @@ def parseNodesDB(**kwargs):
611611
# exist. Otherwise, write to nodesDB_default if it does not exist, unless
612612
# nodesDB given, then do nothing with nodesDB_default.
613613
if (nodes_f and names_f and nodesDB_f):
614-
print BtLog.status_d['28'] % nodesDB_f
614+
print(BtLog.status_d['28'] % nodesDB_f)
615615
writeNodesDB(nodesDB, nodesDB_f)
616616
elif (not nodesDB_f and not isfile(nodesDB_default)):
617617
nodesDB_f = nodesDB_default
618-
print BtLog.status_d['5'] % nodesDB_f
618+
print(BtLog.status_d['5'] % nodesDB_f)
619619
writeNodesDB(nodesDB, nodesDB_f)
620620

621621
return nodesDB, nodesDB_f
@@ -744,7 +744,7 @@ def readYaml(infile):
744744
str = "".join(fh.readlines())
745745
try:
746746
data = yaml.load(str)
747-
except yaml.YAMLError, exc:
747+
except yaml.YAMLError:
748748
BtLog.error('37', infile, "yaml")
749749
return data
750750

lib/view.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def main():
9292
else:
9393
tableView = BtCore.ViewObj(name="table", out_f=out_f, suffix="table.txt", body=[])
9494
viewObjs.append(tableView)
95-
if (experimental):
95+
if not experimental == 'False':
9696
meta = {}
9797
if isfile(experimental):
9898
meta = BtIO.readYaml(experimental)
@@ -115,6 +115,8 @@ def main():
115115
covView = BtCore.ViewObj(name="covlib", out_f=out_f, suffix="cov", body=[])
116116
blobDb.view(viewObjs=[covView], ranks=None, taxrule=None, hits_flag=None, seqs=None, cov_libs=[cov_lib_name], progressbar=True)
117117
if (viewObjs):
118+
#for viewObj in viewObjs:
119+
# print(viewObj.name)
118120
blobDb.view(viewObjs=viewObjs, ranks=ranks, taxrule=taxrule, hits_flag=hits_flag, seqs=seqs, cov_libs=[], progressbar=True)
119121
print(BtLog.status_d['19'])
120122

0 commit comments

Comments
 (0)