obi import: added an option to specify the NA value in the input file
(default is 'NA', same as in R's read.table function)
This commit is contained in:
@ -104,9 +104,15 @@ def addOptions(parser):
|
|||||||
const='pep',
|
const='pep',
|
||||||
help="Input file contains protein sequences")
|
help="Input file contains protein sequences")
|
||||||
|
|
||||||
|
group.add_argument('--NA',
|
||||||
|
action="store", dest="import:NA",
|
||||||
|
metavar='<NA_value>',
|
||||||
|
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):
|
def run(config):
|
||||||
|
|
||||||
cdef int i
|
cdef int i
|
||||||
@ -192,6 +198,10 @@ def run(config):
|
|||||||
|
|
||||||
value = seq['tags'][tag]
|
value = seq['tags'][tag]
|
||||||
|
|
||||||
|
# Check NA value
|
||||||
|
if value == config['import']['NA'] :
|
||||||
|
value = None
|
||||||
|
|
||||||
if tag not in dcols :
|
if tag not in dcols :
|
||||||
|
|
||||||
value_type = type(value)
|
value_type = type(value)
|
||||||
|
Reference in New Issue
Block a user