Oct-19-2023, 10:15 PM
Hi all, trying to run a python code (not mine) that used a function generate_index(arg). The arg function is actually meant to have 5 parts (host, graft, index, memory, and threads) and these components are called later in the function as arg.host, arg.graft...etc.
Probably a dumb question, but how can i input these five variables into the function? when I separate by commas, i get an error saying only expected one variable. I tried adding a double asterisk to before the variable arg, but this did not help either...
Relevant introduction to the Code as below and is from the xenocell repository:
Probably a dumb question, but how can i input these five variables into the function? when I separate by commas, i get an error saying only expected one variable. I tried adding a double asterisk to before the variable arg, but this did not help either...
Relevant introduction to the Code as below and is from the xenocell repository:
def generate_index(**args): print_header(args) print_log('Generate index...') create_directory(args.output) run_xenome(args) print_log('Generation of Xenome index finished!') # def print_header(args): header = '''##----------------------------------------------------------------------------## ## XenoCell: Generate Xenome index of reference genomes. ##----------------------------------------------------------------------------## ## FASTA of host reference genome: {host} ## FASTA of graft reference genome: {graft} ## Output directory: {output} ## Number of threads: {threads} ## Memory in GB: {memory} ##----------------------------------------------------------------------------##'''.format( host = args.host, graft = args.graft, output = args.output, threads = args.threads, memory = args.memory