diff --git a/python/obitools3/commands/import.pyx b/python/obitools3/commands/import.pyx index 1c66471..15c8625 100644 --- a/python/obitools3/commands/import.pyx +++ b/python/obitools3/commands/import.pyx @@ -104,9 +104,15 @@ def addOptions(parser): const='pep', help="Input file contains protein sequences") + group.add_argument('--NA', + action="store", dest="import:NA", + metavar='', + default='NA', + type=str, + help="Character string for Not Available values in the input file " + "(default: 'NA'") + -# TODO: Handling of NA values. Check None. Specify in doc? None or NA? Possiblity to specify in option? -# look in R read.table option to specify NA value def run(config): cdef int i @@ -192,6 +198,10 @@ def run(config): value = seq['tags'][tag] + # Check NA value + if value == config['import']['NA'] : + value = None + if tag not in dcols : value_type = type(value) @@ -209,7 +219,7 @@ def run(config): if value_obitype != OBI_VOID : dcols[tag] = (Column.new_column(view, tag, value_obitype, nb_elements_per_line=nb_elts, elements_names=elt_names), value_obitype) - + # Fill value dcols[tag][0][i] = value