Skip to content

Commit

Permalink
CNVkit exposed many small bugs, fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
fizwit committed Jul 7, 2020
1 parent d02e76b commit 95ba366
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 31 deletions.
14 changes: 9 additions & 5 deletions easy_annotate.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,18 @@ def main():
parser.add_argument('easyconfig', nargs='?')
args = parser.parse_args()

eb = None
args.lang = None
if args.easyconfig:
eb = FrameWork(args)
else:
print("provide a module nameModule with R-, or Python-")
sys.exit(1)
if eb.name == 'R':
args.lang = eb.lang
if eb.lang == 'Python':
args.pyver = eb.pyver
if eb.lang == 'R':
args.rver = eb.rver
if args.lang == 'R':
R(eb, args.verbose)
elif eb.name == 'Python':
elif args.lang == 'Python':
PythonExts(eb, args.verbose)
else:
print('easyanotate does not know how to process: {}'.format(eb.name))
Expand Down
7 changes: 5 additions & 2 deletions easy_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
"""

""" Release Notes
2.0.8.9 July 6, 2020 CNVkit, dependencies on both R and Python. fix bug so easy_update could
not determine language of exts_list. Fix base_path to find to of easyconfig
directory tree. Did not reconize R-bundel-Bioconductor as an R depenency, fixed.
2.0.8.8 June 9, 2020 fix R package dependency lookups. Support for "local_biocver"
2.0.8.7 Jan 26, 2020 Fix multi file dependency to support bundles
2.0.8.6 Oct 1, 2019 PR #17 merged from ccoulombe
Expand Down Expand Up @@ -52,7 +55,7 @@
2.0.8.2 Sept 20, 2019 - more bug fixes for --search. Fixed dependency issues
when checking agaist easyconfigs with the search feature.
2.0.8.1 Sep 18, 2019 Bug fix - output_module was broken when framework was
seperated from updateexts
Expand Down Expand Up @@ -122,7 +125,7 @@
Release API: GET /pypi/<project_name>/<version>/json
"""

__version__ = '2.0.8.8'
__version__ = '2.0.8.9'
__maintainer__ = 'John Dey [email protected]'


Expand Down
47 changes: 23 additions & 24 deletions framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ def __init__(self, args):
self.modulename = None
self.dep_exts = []

full_path = os.path.dirname(args.easyconfig)
if full_path == '.' or full_path == '':
self.base_path = '.'
else:
(head, tail) = os.path.split(full_path)
while tail:
if 'easyconfig' in tail:
self.base_path = os.path.join(head, tail)
break
(head, tail) = os.path.split(head)
# find the top of the EasyConfig file structure
ECpath = os.path.dirname(args.easyconfig)
if ECpath == '.' or ECpath == '':
fullPath = os.path.join(os.getcwd(), args.easyconfig)
(head, tail) = os.path.split(fullPath)
while tail:
if 'easyconfig' in tail:
self.base_path = os.path.join(head, tail)
break
(head, tail) = os.path.split(head)

# update EasyConfig exts_list or check single package
if args.easyconfig:
Expand Down Expand Up @@ -143,24 +143,23 @@ def parse_eb(self, file_name, primary):
return eb

def detect_language(self, eb):
""" R or Python? EasyConfig parameters: easyblock, name, versionsuffix
""" R or Python? EasyConfig parameters: easyblock or name
Test Case: CNVkit
"""
if eb.name == 'Python':
self.lang = str(eb.name)
self.interpolate['pyver'] = eb.version
return
if eb.easyblock == 'PythonPackage' or eb.easyblock == 'PythonBundle':
self.lang = 'Python'
if eb.name == 'R':
self.lang = str(eb.name)
self.interpolate['rver'] = eb.version
return
if 'Python' in self.versionsuffix:
self.lang = 'Python'
return
if '-R' in self.versionsuffix:
if eb.easyblock == 'RPackage':
self.lang = 'R'
return
if self.defaultclass:
self.lang = eb.exts_defaultclass.replace('Package', '')
if self.lang is None:
print('hmm, what languange?')

def build_dep_filename(self, eb, dep):
"""build a filename from a dependencie object"""
Expand All @@ -169,11 +168,8 @@ def build_dep_filename(self, eb, dep):
dep_filename += dep[2] + '.eb'
return dep_filename
dep_filename += '-{}-{}'.format(eb.toolchain['name'],eb.toolchain['version'])
if self.pyver and len(dep) > 2:
versionsuffix = dep[2] % {'pyver': self.pyver}
dep_filename += '{}'.format(versionsuffix)
if self.rver and len(dep) > 2:
versionsuffix = dep[2] % {'rver': self.rver}
if len(dep) > 2:
versionsuffix = dep[2] % self.interpolate
dep_filename += '{}'.format(versionsuffix)
dep_filename += '.eb'
return dep_filename
Expand Down Expand Up @@ -203,14 +199,17 @@ def parse_dependencies(self, eb, lang):
if dep[0] == 'Python':
self.interpolate['pyver'] = dep[1]
self.pyver = dep[1]
print('found Python {}'.format(self.pyver))
if dep[0] == 'R':
self.interpolate['rver'] = dep[1]
self.rver = dep[1]
print('found R-{}'.format(self.rver))
dep_filename = self.build_dep_filename(eb, dep)
easyconfig = self.find_easyconfig(dep_filename)
else:
dep_filename = self.build_dep_filename(eb, dep)
if '-R-' in dep_filename or '-Python-' in dep_filename:
if 'R-' == dep_filename[0:2] or '-R-' in dep_filename or '-Python-' in dep_filename:
print('deubug - find Dep: {}'.format(dep_filename))
easyconfig = self.find_easyconfig(dep_filename)
if easyconfig:
sys.stderr.write(" - reading dependency: {}\n".format(
Expand Down

0 comments on commit 95ba366

Please sign in to comment.