import snakemake.utils
snakemake.utils.min_version("7.8.0")
snake_dir = workflow.basedir
rootdir = ''.join([ sub + '/' for sub in snake_dir.split('/')[:-1] ] )
print(' benchmark all running in ' , rootdir)
configfile: rootdir+ "workflow/config/config_vars.yaml"
# remote homologues search parameters

foldseekpath = config["foldseek_path"]
if foldseekpath == 'provided':
	foldseekpath = rootdir + "foldseek/foldseek"

if 'folder' in config:
	if type(config['folder']) == str:
		folders = [config['folder']]
	else:
		folders = config['folder']
else:
	folders = glob_wildcards("{folders}/identifiers.txt").folders
	config['folder']  = folders

if config['fam_limit'] > 0:
	folders = folders[:config['fam_limit']]
	config['folder']  = folders


alntype = ['3di','AA']#, 'foldtree']
mattypes = ['fident', 'alntmscore', 'lddt' ]
alntypes = ['0', '1']
exp = ['raw', 'exp']
aligners = [  'muscle' ] #['clustalo', '3dcoffee' ]
print( len(folders) , 'families to benchmark' )

rule all:
	input:
		expand('{folder}/alnfident_dist_{restype}_{alntype}.json', folder = folders, alntype = alntype, restype = ['AA', '3di']),
		expand( '{folder}/alnfident_dist_{alntype}_raw_.json' , folder = folders, alntype = alntypes)

module benchmarking:
	# here, plain paths, URLs and the special markers for code hosting providers (see below) are possible.
	snakefile: "benchmarking"
	config: config

use rule * from benchmarking as BM_*

module FidentXaln:
	# here, plain paths, URLs and the special markers for code hosting providers (see below) are possible.
	snakefile: "FidentXaln"
	config: config

use rule * from FidentXaln as FX_*

module iqtreeXsingle:
	# here, plain paths, URLs and the special markers for code hosting providers (see below) are possible.
	snakefile: "iqtreeXsingle"
	config: config

use rule * from iqtreeXsingle as IX_*

