Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
359a9fe237 | |||
f9b6851f75 | |||
29a2652bbf | |||
2a2c233936 | |||
faf8ea9d86 | |||
ffe2485e94 | |||
6094ce2bbc |
@ -35,12 +35,14 @@ def addOptions(parser):
|
|||||||
action="store", dest="ecopcr:primer1",
|
action="store", dest="ecopcr:primer1",
|
||||||
metavar='<PRIMER>',
|
metavar='<PRIMER>',
|
||||||
type=str,
|
type=str,
|
||||||
|
required=True,
|
||||||
help="Forward primer, length must be less than or equal to 32")
|
help="Forward primer, length must be less than or equal to 32")
|
||||||
|
|
||||||
group.add_argument('--primer2', '-R',
|
group.add_argument('--primer2', '-R',
|
||||||
action="store", dest="ecopcr:primer2",
|
action="store", dest="ecopcr:primer2",
|
||||||
metavar='<PRIMER>',
|
metavar='<PRIMER>',
|
||||||
type=str,
|
type=str,
|
||||||
|
required=True,
|
||||||
help="Reverse primer, length must be less than or equal to 32")
|
help="Reverse primer, length must be less than or equal to 32")
|
||||||
|
|
||||||
group.add_argument('--error', '-e',
|
group.add_argument('--error', '-e',
|
||||||
|
@ -260,7 +260,6 @@ def run(config):
|
|||||||
|
|
||||||
if entry is None: # error or exception handled at lower level, not raised because Python generators can't resume after any exception is raised
|
if entry is None: # error or exception handled at lower level, not raised because Python generators can't resume after any exception is raised
|
||||||
if config['obi']['skiperror']:
|
if config['obi']['skiperror']:
|
||||||
i-=1
|
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
raise RollbackException("obi import error, rollbacking view", view)
|
raise RollbackException("obi import error, rollbacking view", view)
|
||||||
@ -270,6 +269,8 @@ def run(config):
|
|||||||
elif not i%50000:
|
elif not i%50000:
|
||||||
logger("info", "Imported %d entries", i)
|
logger("info", "Imported %d entries", i)
|
||||||
|
|
||||||
|
try:
|
||||||
|
|
||||||
if NUC_SEQS_view:
|
if NUC_SEQS_view:
|
||||||
id_col[i] = entry.id
|
id_col[i] = entry.id
|
||||||
def_col[i] = entry.definition
|
def_col[i] = entry.definition
|
||||||
@ -388,6 +389,13 @@ def run(config):
|
|||||||
# Fill value
|
# Fill value
|
||||||
dcols[tag][0][i] = value
|
dcols[tag][0][i] = value
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print("\nCould not import sequence id:", entry.id, "(error raised:", e, ")")
|
||||||
|
if 'skiperror' in config['obi'] and not config['obi']['skiperror']:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
|
||||||
i+=1
|
i+=1
|
||||||
|
|
||||||
if pb is not None:
|
if pb is not None:
|
||||||
|
@ -42,6 +42,7 @@ def addOptions(parser):
|
|||||||
metavar="<URI>",
|
metavar="<URI>",
|
||||||
type=str,
|
type=str,
|
||||||
default=None,
|
default=None,
|
||||||
|
required=True,
|
||||||
help="URI to the view containing the samples definition (with tags, primers, sample names,...).\n"
|
help="URI to the view containing the samples definition (with tags, primers, sample names,...).\n"
|
||||||
"\nWarning: primer lengths must be less than or equal to 32")
|
"\nWarning: primer lengths must be less than or equal to 32")
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@ from libc.string cimport strcpy, strlen
|
|||||||
_featureMatcher = re.compile(b'^FEATURES.+\n(?=ORIGIN)',re.DOTALL + re.M)
|
_featureMatcher = re.compile(b'^FEATURES.+\n(?=ORIGIN)',re.DOTALL + re.M)
|
||||||
|
|
||||||
_headerMatcher = re.compile(b'^LOCUS.+(?=\nFEATURES)', re.DOTALL + re.M)
|
_headerMatcher = re.compile(b'^LOCUS.+(?=\nFEATURES)', re.DOTALL + re.M)
|
||||||
_seqMatcher = re.compile(b'(?<=ORIGIN).+(?=//\n)', re.DOTALL + re.M)
|
_seqMatcher = re.compile(b'ORIGIN.+(?=//\n)', re.DOTALL + re.M)
|
||||||
_cleanSeq = re.compile(b'[ \n0-9]+')
|
_cleanSeq1 = re.compile(b'ORIGIN.+\n')
|
||||||
|
_cleanSeq2 = re.compile(b'[ \n0-9]+')
|
||||||
_acMatcher = re.compile(b'(?<=^ACCESSION ).+',re.M)
|
_acMatcher = re.compile(b'(?<=^ACCESSION ).+',re.M)
|
||||||
_deMatcher = re.compile(b'(?<=^DEFINITION ).+\n( .+\n)*',re.M)
|
_deMatcher = re.compile(b'(?<=^DEFINITION ).+\n( .+\n)*',re.M)
|
||||||
_cleanDe = re.compile(b'\n *')
|
_cleanDe = re.compile(b'\n *')
|
||||||
@ -42,7 +43,8 @@ def genbankParser(bytes text):
|
|||||||
ft = _featureMatcher.search(text).group()
|
ft = _featureMatcher.search(text).group()
|
||||||
|
|
||||||
s = _seqMatcher.search(text).group()
|
s = _seqMatcher.search(text).group()
|
||||||
s = _cleanSeq.sub(b'', s).upper()
|
s = _cleanSeq1.sub(b'', s)
|
||||||
|
s = _cleanSeq2.sub(b'', s)
|
||||||
|
|
||||||
acs = _acMatcher.search(text).group()
|
acs = _acMatcher.search(text).group()
|
||||||
acs = acs.split()
|
acs = acs.split()
|
||||||
@ -52,12 +54,6 @@ def genbankParser(bytes text):
|
|||||||
de = _deMatcher.search(header).group()
|
de = _deMatcher.search(header).group()
|
||||||
de = _cleanDe.sub(b' ',de).strip().strip(b'.')
|
de = _cleanDe.sub(b' ',de).strip().strip(b'.')
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
print("\nCould not import sequence id:", text.split()[1], "(error raised:", e, ")")
|
|
||||||
# Do not raise any Exception if you need the possibility to resume the generator
|
|
||||||
# (Python generators can't resume after any exception is raised)
|
|
||||||
return None
|
|
||||||
|
|
||||||
tags = {}
|
tags = {}
|
||||||
extractTaxon(ft, tags)
|
extractTaxon(ft, tags)
|
||||||
|
|
||||||
@ -68,6 +64,12 @@ def genbankParser(bytes text):
|
|||||||
offset=-1,
|
offset=-1,
|
||||||
tags=tags)
|
tags=tags)
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print("\nCould not import sequence id:", text.split()[1], "(error raised:", e, ")")
|
||||||
|
# Do not raise any Exception if you need the possibility to resume the generator
|
||||||
|
# (Python generators can't resume after any exception is raised)
|
||||||
|
return None
|
||||||
|
|
||||||
return seq
|
return seq
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
major = 3
|
major = 3
|
||||||
minor = 0
|
minor = 0
|
||||||
serial= '0b20'
|
serial= '0b23'
|
||||||
|
|
||||||
version ="%d.%d.%s" % (major,minor,serial)
|
version ="%d.%d.%s" % (major,minor,serial)
|
||||||
|
10
setup.py
10
setup.py
@ -27,10 +27,11 @@ class Distribution(ori_Distribution):
|
|||||||
|
|
||||||
ori_Distribution.__init__(self, attrs)
|
ori_Distribution.__init__(self, attrs)
|
||||||
|
|
||||||
self.global_options.insert(0,('cobitools3', None, "intall location of the C library"
|
self.global_options.insert(0,('cobitools3', None, "install location of the C library"
|
||||||
))
|
))
|
||||||
|
|
||||||
from distutils.command.build import build as build_ori
|
from distutils.command.build import build as build_ori
|
||||||
|
from setuptools.command.bdist_egg import bdist_egg as bdist_egg_ori
|
||||||
from distutils.core import Command
|
from distutils.core import Command
|
||||||
|
|
||||||
|
|
||||||
@ -71,6 +72,12 @@ class build(build_ori):
|
|||||||
build_ori.run(self)
|
build_ori.run(self)
|
||||||
|
|
||||||
|
|
||||||
|
class bdist_egg(bdist_egg_ori):
|
||||||
|
def run(self):
|
||||||
|
self.run_command('build_clib')
|
||||||
|
bdist_egg_ori.run(self)
|
||||||
|
|
||||||
|
|
||||||
sys.path.append(os.path.abspath("python"))
|
sys.path.append(os.path.abspath("python"))
|
||||||
|
|
||||||
|
|
||||||
@ -166,6 +173,7 @@ setup(name=PACKAGE,
|
|||||||
ext_modules=xx,
|
ext_modules=xx,
|
||||||
distclass=Distribution,
|
distclass=Distribution,
|
||||||
cmdclass={'build': build,
|
cmdclass={'build': build,
|
||||||
|
'bdist_egg': bdist_egg,
|
||||||
'build_clib': build_clib},
|
'build_clib': build_clib},
|
||||||
cobitools3=get_python_lib(),
|
cobitools3=get_python_lib(),
|
||||||
packages = findPackage('python'),
|
packages = findPackage('python'),
|
||||||
|
Reference in New Issue
Block a user