Commands: updated for JSON formatted comments with history

This commit is contained in:
Celine Mercier
2018-10-07 19:10:34 +02:00
parent 35cf2962cc
commit e9a41c5b97
11 changed files with 144 additions and 34 deletions

View File

@ -16,6 +16,9 @@ from obitools3.align._qsrassemble import QSolexaRightReverseAssemble
from obitools3.align._solexapairend import buildConsensus, buildJoinedSequence
from obitools3.dms.obiseq cimport Nuc_Seq_Stored, Nuc_Seq
import sys
import os
REVERSE_SEQ_COLUMN_NAME = b"REVERSE_SEQUENCE"
REVERSE_QUALITY_COLUMN_NAME = b"REVERSE_QUALITY"
@ -112,7 +115,7 @@ def run(config):
DMS.obi_atexit()
logger("info", "obi alignpairedend")
# Open the input
two_views = False
@ -124,8 +127,8 @@ def run(config):
if input is None:
raise Exception("Could not open input reads")
if input[2] != View_NUC_SEQS:
raise NotImplementedError('obi alignpairedend only works on NUC_SEQS views')
raise NotImplementedError('obi alignpairedend only works on NUC_SEQS views')
if "reverse" in config["alignpairedend"]:
two_views = True
@ -144,10 +147,14 @@ def run(config):
raise Exception("Error: the number of forward and reverse reads are different")
entries = [forward, reverse]
input_dms_name = [forward.dms.name, reverse.dms.name]
input_view_name = [forward.name, reverse.name]
else:
entries = input[1]
input_dms_name = [entries.dms.name]
input_view_name = [entries.name]
if two_views:
entries_len = len(forward)
else:
@ -166,6 +173,7 @@ def run(config):
raise Exception("Could not create output view")
view = output[1]
Column.new_column(view, b"QUALITY", OBI_QUAL) #TODO output URI quality option
if 'smin' in config['alignpairedend']:
@ -213,7 +221,12 @@ def run(config):
# consensus[b"illumina_index"] = idx
i+=1
# Save command config in View and DMS comments
command_line = " ".join(sys.argv[1:])
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))