def _gwas_interaction(data, *entities):
# Finding all the columns for all the targets
column_names = tuple(
tuple(name for name in data.columns if name.startswith(entity.id))
for entity in entities
)
# Finding the level column names if there are factors
factor_levels = tuple(
tuple(name[len(entity.id)+1:] for name in names)
for names, entity in zip(column_names, entities)
)
# Only creating the column name
out = {}
for cols, level_names in zip(itertools.product(*column_names),
itertools.product(*factor_levels)):
# Getting the key (for factors, if present)
key = re.sub(":{2,}", "", ":".join(level_names).strip(":"))
# Saving the columns to multiply with SNPs
out[key] = cols
return out
评论列表
文章目录