Python Forum
Multiple variable inputs when only one is called for
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multiple variable inputs when only one is called for
#1
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:


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
Larz60+ write Oct-19-2023, 10:37 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Modified for you this time. Please use BBCode tags on future posts.
Reply


Messages In This Thread
Multiple variable inputs when only one is called for - by ChrisDall - Oct-19-2023, 10:15 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Couldn't install a go-game called dlgo Nomamesse 14 6,797 Jan-05-2023, 06:38 PM
Last Post: Nomamesse
  how can a function find the name by which it is called? Skaperen 18 6,804 Aug-24-2022, 04:52 PM
Last Post: Skaperen
  Multiple Loop Statements in a Variable Dexty 1 1,877 May-23-2022, 08:53 AM
Last Post: bowlofred
  function with 'self' input parameter errors out with and without 'self' called dford 12 8,534 Jan-15-2022, 06:07 PM
Last Post: deanhystad
Lightbulb Multiple inputs on the same line (beginner) dementshuk 9 4,942 Sep-03-2021, 02:21 PM
Last Post: dementshuk
  Generate Multiple sql Files With csv inputs vkomarag 13 6,628 Aug-20-2021, 07:03 PM
Last Post: vkomarag
  What is this formatting called? Mark17 2 2,662 Dec-14-2020, 08:42 PM
Last Post: snippsat
  Spyder Quirk? global variable does not increment when function called in console rrace001 1 2,989 Sep-18-2020, 02:50 PM
Last Post: deanhystad
  How to pass multiple values from one sample to nc variable? Baloch 0 2,524 Jun-01-2020, 09:27 PM
Last Post: Baloch
  Class Instances called in the wrong order IanIous 4 4,193 Mar-06-2020, 02:16 PM
Last Post: IanIous

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020