Nicolas Vannieuwkerke
09/03/2024, 1:49 PMLookupError: Could not find branch information for component 'happy/happy/happy'.Please remove the 'modules.json' and rerun the command to recreate it
I already recreated the modules.json file but the error persists.Arthur
09/03/2024, 1:53 PMNicolas Vannieuwkerke
09/03/2024, 1:53 PMnf-core pipelines lint on the current dev branch ๐Arthur
09/03/2024, 1:55 PMNicolas Vannieuwkerke
09/03/2024, 1:56 PMNicolas Vannieuwkerke
09/03/2024, 1:56 PMNicolas Vannieuwkerke
09/03/2024, 1:57 PMNicolas Vannieuwkerke
09/03/2024, 1:57 PMmodule_changes apparentlyNicolas Vannieuwkerke
09/03/2024, 2:09 PMhappy/happy module because it wasn't used anywhere anymore but now I have the same error with snpeff/snpeff (also a modules I do not use in my pipeline but got installed via a subworkflow)Arthur
09/03/2024, 2:10 PMsnpeff/snpeff/snpeff has no branch info?Nicolas Vannieuwkerke
09/03/2024, 2:12 PMNicolas Vannieuwkerke
09/03/2024, 2:13 PMLookupError: Could not find branch information for component 'snpeff/snpeff/snpeff'.Please remove the 'modules.json' and rerun the command to recreate itNicolas Vannieuwkerke
09/03/2024, 2:13 PMArthur
09/03/2024, 2:13 PM<http://module.org|module.org> must be being set to e.g. snpeffNicolas Vannieuwkerke
09/03/2024, 2:13 PMArthur
09/03/2024, 2:14 PMtool==subtoolNicolas Vannieuwkerke
09/03/2024, 2:14 PMNicolas Vannieuwkerke
09/03/2024, 2:15 PMArthur
09/03/2024, 2:19 PMtool==subtool.
https://github.com/nf-core/tools/blame/25224a03db8d16767e4241982f6bf66829a03b21/nf_core/components/nfcore_component.py#L67-L72
Looks like the guilty code went in 5 days ago so makes sense you see the error nowNicolas Vannieuwkerke
09/03/2024, 2:20 PMJames Fellows Yates
09/03/2024, 2:21 PMNicolas Vannieuwkerke
09/03/2024, 2:22 PMNicolas Vannieuwkerke
09/03/2024, 2:23 PMJames Fellows Yates
09/03/2024, 2:23 PMNicolas Vannieuwkerke
09/03/2024, 2:24 PMNicolas Vannieuwkerke
09/03/2024, 2:24 PMArthur
09/03/2024, 2:27 PMfrom operator import indexOf
def rindex(li, value):
return len(li) - 1 - indexOf(reversed(li), value)
name_index = (
len(self.component_dir.parts)
- 1
- rindex(self.component_dir.parts[::-1],self.component_name.split("/")[0])
)
SCRATCH THAT:
The current code is actually already reversing the list to find the index of the โlastโ occurrence of the component name. So actually we can just find the โfirstโ using:
name_index = self.component_dir.parts.index(self.component_name.split("/")[0])
Caveat that I havenโt looked into why the changes were implemented in the first place so maybe something more needs to be done.
@Jรบlia Mir may know.Nicolas Vannieuwkerke
09/03/2024, 2:30 PMNicolas Vannieuwkerke
09/03/2024, 2:31 PMArthur
09/03/2024, 2:32 PMorg==tool maybe? And then my solution above also fails for the reverse reasonArthur
09/03/2024, 2:34 PMNicolas Vannieuwkerke
09/03/2024, 2:42 PMArthur
09/03/2024, 2:44 PMcomponent_name then take the last element of it split by /. But itโs not very clean.Nicolas Vannieuwkerke
09/03/2024, 2:48 PMNicolas Vannieuwkerke
09/03/2024, 2:50 PMcomponent_list = self.component_name.split("/")
name_index = (
len(self.component_dir.parts)
- 1
- self.component_dir.parts[::-1].index(component_list[0])
)
if len(component_list) != 1 and component_list[0] == component_list[1]:
# Handle cases where the subtool has the same name as the tool
name_index -= 1
repo_dir = self.component_dir.parts[:name_index][-1]
It checks if the tool and subtool are the same and in that case it moves the index one back so the org is actually correctly parsedNicolas Vannieuwkerke
09/03/2024, 2:51 PMNicolas Vannieuwkerke
09/03/2024, 2:51 PMArthur
09/03/2024, 2:55 PMtool, subtool = self.component_name.partition("/")
if subtool and (tool == subtool):
idx = 1
else:
idx = 0
name_idx = (
len(self.component_dir.parts)
- 1
- self.component_dir.parts[::-1].index(tool, idx)
)
(.index can take a starting or end idx to limit the search space to whilst still returning the actual index)Nicolas Vannieuwkerke
09/03/2024, 2:56 PMJรบlia Mir
09/03/2024, 2:57 PMNicolas Vannieuwkerke
09/03/2024, 2:57 PMNicolas Vannieuwkerke
09/03/2024, 2:57 PM