Skip to content

Commit a8f8473

Browse files
authored
Merge pull request #3603 from boegel/20250216205558_new_pr_trinity
adopt `module_load_environment` in Trinity easyblock
2 parents 3715abd + fc4668d commit a8f8473

File tree

1 file changed

+18
-25
lines changed

1 file changed

+18
-25
lines changed

easybuild/easyblocks/t/trinity.py

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,20 @@ def __init__(self, *args, **kwargs):
5757

5858
self.build_in_installdir = True
5959

60+
version = LooseVersion(self.version)
61+
if version >= LooseVersion('2.0') and version < LooseVersion('2.3'):
62+
sep = '-'
63+
elif version >= LooseVersion('2.3') and version < LooseVersion('2.9'):
64+
sep = '-Trinity-v'
65+
elif version >= LooseVersion('2.9') and version < LooseVersion('3.0'):
66+
sep = '-v'
67+
else:
68+
sep = '_r'
69+
self.trinityrnaseq_subdir = f'trinityrnaseq{sep}{self.version}'
70+
71+
self.module_load_environment.PATH = self.trinityrnaseq_subdir
72+
self.module_load_environment.TRINITY_HOME = self.trinityrnaseq_subdir
73+
6074
@staticmethod
6175
def extra_options():
6276
"""Custom easyconfig parameters for Trinity."""
@@ -312,14 +326,6 @@ def sanity_check_step(self):
312326
"""Custom sanity check for Trinity."""
313327

314328
version = LooseVersion(self.version)
315-
if version >= LooseVersion('2.0') and version < LooseVersion('2.3'):
316-
sep = '-'
317-
elif version >= LooseVersion('2.3') and version < LooseVersion('2.9'):
318-
sep = '-Trinity-v'
319-
elif version >= LooseVersion('2.9') and version < LooseVersion('3.0'):
320-
sep = '-v'
321-
else:
322-
sep = '_r'
323329
# Chrysalis
324330
if version >= LooseVersion('2.9') and version < LooseVersion('2000'):
325331
chrysalis_bin = os.path.join('Chrysalis', 'bin')
@@ -344,30 +350,17 @@ def sanity_check_step(self):
344350
inchworm_files.extend(['FastaToDeBruijn', 'fastaToKmerCoverageStats'])
345351
inchworm_bin_files = [os.path.join(inchworm_bin, x) for x in inchworm_files]
346352

347-
path = 'trinityrnaseq%s%s' % (sep, self.version)
348-
349353
# folders path
350354
dir_path = ['util']
351355
if version < LooseVersion('2.9'):
352356
dir_path.append(os.path.join('Butterfly', 'src', 'bin'))
353357

354358
# these lists are definitely non-exhaustive, but better than nothing
355359
custom_paths = {
356-
'files': [os.path.join(path, x) for x in (inchworm_bin_files + chrysalis_bin_files)],
357-
'dirs': [os.path.join(path, x) for x in dir_path]
360+
'files': [os.path.join(self.trinityrnaseq_subdir, x) for x in (inchworm_bin_files + chrysalis_bin_files)],
361+
'dirs': [os.path.join(self.trinityrnaseq_subdir, x) for x in dir_path]
358362
}
359363

360-
super(EB_Trinity, self).sanity_check_step(custom_paths=custom_paths)
361-
362-
def make_module_req_guess(self):
363-
"""Custom tweaks for PATH variable for Trinity."""
364-
365-
guesses = super(EB_Trinity, self).make_module_req_guess()
366-
367-
install_rootdir = os.path.basename(self.cfg['start_dir'].strip('/'))
368-
guesses.update({
369-
'PATH': [install_rootdir],
370-
'TRINITY_HOME': [install_rootdir],
371-
})
364+
custom_commands = ["Trinity --version | grep 'Trinity version'"]
372365

373-
return guesses
366+
super(EB_Trinity, self).sanity_check_step(custom_commands=custom_commands, custom_paths=custom_paths)

0 commit comments

Comments
 (0)