Cleaner stderr prints

This commit is contained in:
Celine Mercier
2019-03-13 18:36:31 +01:00
parent e3c565d6be
commit 478d19ab43
15 changed files with 79 additions and 37 deletions

View File

@ -255,8 +255,8 @@ def run(config):
# Save command config in output DMS comments
o_dms.record_command_line(command_line)
print("\n")
print(repr(o_dms[final_o_view_name]))
#print("\n\nOutput view:\n````````````", file=sys.stderr)
#print(repr(o_dms[final_o_view_name]), file=sys.stderr)
# If the two input DMS are different, delete the temporary input view in the first input DMS
if i_dms_2 and i_dms != i_dms_2:
@ -269,4 +269,6 @@ def run(config):
o_dms.close()
i_dms.close()
logger("info", "Done.")

View File

@ -226,6 +226,9 @@ def run(config):
i+=1
pb(i, force=True)
print("", file=sys.stderr)
if kmer_ali :
aligner.free()
@ -234,11 +237,13 @@ def run(config):
view.write_config(config, "alignpairedend", command_line, input_dms_name=input_dms_name, input_view_name=input_view_name)
output[0].record_command_line(command_line)
print("\n")
print(repr(view))
#print("\n\nOutput view:\n````````````", file=sys.stderr)
#print(repr(view), file=sys.stderr)
input[0].close()
if two_views:
rinput[0].close()
output[0].close()
logger("info", "Done.")

View File

@ -356,6 +356,9 @@ def run(config):
except Exception, e:
raise RollbackException("obi annotate error, rollbacking view: "+str(e), o_view)
pb(i, force=True)
print("", file=sys.stderr)
# Save command config in View and DMS comments
command_line = " ".join(sys.argv[1:])
@ -367,12 +370,13 @@ def run(config):
o_view.write_config(config, "annotate", command_line, input_dms_name=input_dms_name, input_view_name=input_view_name)
output[0].record_command_line(command_line)
print("\n")
print(repr(o_view))
#print("\n\nOutput view:\n````````````", file=sys.stderr)
#print(repr(o_view), file=sys.stderr)
# If the input and the output DMS are different, delete the temporary imported view used to create the final view
if i_dms != o_dms:
View.delete_view(o_dms, imported_view_name)
o_dms.close()
i_dms.close()
logger("info", "Done.")

View File

@ -91,8 +91,8 @@ def run(config):
# Save command config in DMS comments
o_dms.record_command_line(command_line)
print("\n")
print(repr(o_dms[final_o_view_name]))
#print("\n\nOutput view:\n````````````", file=sys.stderr)
#print(repr(o_dms[final_o_view_name]), file=sys.stderr)
# If the input and the output DMS are different, delete the temporary result view in the input DMS
if i_dms != o_dms:
@ -101,3 +101,5 @@ def run(config):
i_dms.close()
logger("info", "Done.")

View File

@ -111,8 +111,8 @@ def run(config):
# Save command config in DMS comments
o_dms.record_command_line(command_line)
print("\n")
print(repr(o_dms[final_o_view_name]))
#print("\n\nOutput view:\n````````````", file=sys.stderr)
#print(repr(o_dms[final_o_view_name]), file=sys.stderr)
# If the input and the output DMS are different, delete the temporary result view in the input DMS
if i_dms != o_dms:
@ -120,3 +120,5 @@ def run(config):
o_dms.close()
i_dms.close()
logger("info", "Done.")

View File

@ -194,8 +194,9 @@ def run(config):
free(restrict_to_taxids_p)
free(ignore_taxids_p)
print("\n")
print(repr(o_dms[o_view_name]))
#print("\n\nOutput view:\n````````````", file=sys.stderr)
#print(repr(o_dms[o_view_name]), file=sys.stderr)
o_dms.close()
logger("info", "Done.")

View File

@ -115,8 +115,8 @@ def run(config):
# Save command config in DMS comments
o_dms.record_command_line(command_line)
print("\n")
print(repr(o_dms[final_o_view_name]))
#print("\n\nOutput view:\n````````````", file=sys.stderr)
#print(repr(o_dms[final_o_view_name]), file=sys.stderr)
# If the input and the output DMS are different, delete the temporary result view in the input DMS
if i_dms != o_dms:
@ -124,3 +124,6 @@ def run(config):
o_dms.close()
i_dms.close()
logger("info", "Done.")

View File

@ -9,6 +9,7 @@ from obitools3.dms.obiseq import Nuc_Seq
from obitools3.apps.optiongroups import addMinimalInputOption, \
addExportOutputOption
import sys
__title__="Export a view to a different file format"
@ -56,10 +57,13 @@ def run(config):
break
i+=1
pb(i, force=True)
print("", file=sys.stderr)
# TODO save command in input dms?
output_object.close()
iview.close()
input[0].close()
logger("info", "obi export: Done")
logger("info", "Done.")

View File

@ -314,6 +314,9 @@ def run(config):
if good :
selection.append(i)
pb(i, force=True)
print("", file=sys.stderr)
# Create output view with the line selection
try:
o_view = selection.materialize(o_view_name)
@ -337,11 +340,13 @@ def run(config):
View.import_view(i_dms.full_path[:-7], o_dms.full_path[:-7], o_view_name, o_view_name_final)
o_view = o_dms[o_view_name_final]
print("\n")
print(repr(o_view))
#print("\n\nOutput view:\n````````````", file=sys.stderr)
#print(repr(o_view), file=sys.stderr)
# If the input and the output DMS are different, delete the temporary imported view used to create the final view
if i_dms != o_dms:
View.delete_view(i_dms, o_view_name)
o_dms.close()
i_dms.close()
logger("info", "Done.")

View File

@ -72,7 +72,10 @@ def run(config):
for i in range(n):
pb(i)
selection.append(i)
pb(i, force=True)
print("", file=sys.stderr)
# Create output view with the line selection
try:
o_view = selection.materialize(o_view_name)
@ -91,8 +94,8 @@ def run(config):
View.import_view(i_dms.full_path[:-7], o_dms.full_path[:-7], o_view_name, o_view_name_final)
o_view = o_dms[o_view_name_final]
print("\n")
print(repr(o_view))
#print("\n\nOutput view:\n````````````", file=sys.stderr)
#print(repr(view), file=sys.stderr)
# If the input and the output DMS are different, delete the temporary imported view used to create the final view
if i_dms != o_dms:
@ -100,3 +103,4 @@ def run(config):
o_dms.close()
i_dms.close()
logger("info", "Done.")

View File

@ -581,6 +581,9 @@ def run(config):
except Exception, e:
raise RollbackException("obi ngsfilter error, rollbacking views: "+str(e), o_view, unidentified)
pb(i, force=True)
print("", file=sys.stderr)
# Save command config in View and DMS comments
command_line = " ".join(sys.argv[1:])
o_view.write_config(config, "ngsfilter", command_line, input_dms_name=input_dms_name, input_view_name=input_view_name)
@ -589,8 +592,8 @@ def run(config):
unidentified.comments["info"] = "View containing sequences categorized as unidentified by the ngsfilter command"
output[0].record_command_line(command_line)
print("\n")
print(repr(o_view))
#print("\n\nOutput view:\n````````````", file=sys.stderr)
#print(repr(o_view), file=sys.stderr)
input[0].close()
output[0].close()
@ -598,3 +601,4 @@ def run(config):
unidentified_input[0].close()
aligner.free()
logger("info", "Done.")

View File

@ -109,6 +109,9 @@ def run(config):
for k in keys: # TODO order?
selection.sort(key=lambda line_idx: line_cmp(i_view[line_idx], k, pb(line_idx)), reverse=config['sort']['reverse'])
pb(len(i_view), force=True)
print("", file=sys.stderr)
# Create output view with the sorted line selection
try:
o_view = selection.materialize(o_view_name)
@ -129,11 +132,13 @@ def run(config):
View.import_view(i_dms.full_path[:-7], o_dms.full_path[:-7], o_view_name, o_view_name_final)
o_view = o_dms[o_view_name_final]
print("\n")
print(repr(o_view))
#print("\n\nOutput view:\n````````````", file=sys.stderr)
#print(repr(o_view), file=sys.stderr)
# If the input and the output DMS are different, delete the temporary imported view used to create the final view
if i_dms != o_dms:
View.delete_view(i_dms, o_view_name)
o_dms.close()
i_dms.close()
logger("info", "Done.")

View File

@ -11,6 +11,7 @@ from obitools3.dms.capi.obiview cimport COUNT_COLUMN
from functools import reduce
import math
import time
import sys
__title__="Compute basic statistics for attribute values."
@ -199,6 +200,9 @@ def run(config):
values[var][category]=[]
values[var][category].append(v)
pb(i, force=True)
print("", file=sys.stderr)
mini, lmini = minimum(values, config['stats'])
maxi, lmaxi = maximum(values, config['stats'])
avg, lavg = mean(values, config['stats'])
@ -258,5 +262,4 @@ def run(config):
input[0].close()
logger("info", "Done.")

View File

@ -73,6 +73,9 @@ def run(config):
pb(i)
selection.append(i)
pb(i, force=True)
print("", file=sys.stderr)
# Save command config in View comments
command_line = " ".join(sys.argv[1:])
comments = View.get_config_dict(config, "tail", command_line, input_dms_name=[i_dms.name], input_view_name=[i_view.name])
@ -95,8 +98,8 @@ def run(config):
View.import_view(i_dms.full_path[:-7], o_dms.full_path[:-7], o_view_name, o_view_name_final)
o_view = o_dms[o_view_name_final]
print("\n")
print(repr(o_view))
#print("\n\nOutput view:\n````````````", file=sys.stderr)
#print(repr(o_view), file=sys.stderr)
# If the input and the output DMS are different, delete the temporary imported view used to create the final view
if i_dms != o_dms:
@ -104,3 +107,4 @@ def run(config):
o_dms.close()
i_dms.close()
logger("info", "Done.")

View File

@ -115,9 +115,7 @@ def emblIterator_file(lineiterator,
line = next(iterator)
else:
line = firstline
DONECOUNT=0
while True:
if ionly >= 0 and read >= ionly-1:
@ -154,11 +152,7 @@ def emblIterator_file(lineiterator,
break
seq = emblParser(entry)
if DONECOUNT%10000 == 0:
print(DONECOUNT, "\n")
DONECOUNT+=1
yield seq
read+=1