Basic obi check command to check DMS and view informations

This commit is contained in:
Celine Mercier
2017-07-05 13:54:19 +02:00
parent d252131950
commit 20c72af697

View File

@ -0,0 +1,68 @@
#cython: language_level=3
from obitools3.dms.dms import DMS # TODO cimport doesn't work
from obitools3.dms.view.view import View # TODO cimport doesn't work
__title__="Print a preview of a DMS, view, column...."
default_config = { 'inputview' : None,
}
# TODO make it work with URIs
def addOptions(parser):
# TODO put this common group somewhere else but I don't know where
group=parser.add_argument_group('DMS and view options')
group.add_argument('--default-dms','-d',
action="store", dest="obi:defaultdms",
metavar='<DMS NAME>',
default=None,
type=str,
help="Name of the default DMS for reading and writing data.")
group.add_argument('--view','-v',
action="store", dest="obi:view",
metavar='<VIEW NAME>',
default=None,
type=str,
help="Name of the view.")
# group=parser.add_argument_group('obi check specific options')
# group.add_argument('--print',
# action="store", dest="less:print",
# metavar='<N>',
# default=None,
# type=int,
# help="Print N sequences (default: 10)")
def run(config):
# Open DMS
d = DMS.open(config['obi']['defaultdms'])
# Open input view uif there is one
if config['obi']['inputview'] is not None :
iview = View.open(d, config['obi']['inputview'])
print(repr(iview))
else :
for v in d :
print(repr(v))
d.close()