from jcvi.apps.base import OptionParser # Create an OptionParser object parser = OptionParser() # Add the set_cpus option parser.add_option("-p", "--cpus", dest="cpus", default=1, help="Number of CPUs for parallel processing") # Parse the command-line options (options, args) = parser.parse_args() # Get the number of CPUs specified cpus = int(options.cpus)
from jcvi.assembly.allpaths import RunAllPathsLG from jcvi.apps.base import OptionParser # Create an OptionParser object parser = OptionParser() # Add the set_cpus option parser.add_option("-p", "--cpus", dest="cpus", default=1, help="Number of CPUs for parallel processing") # Parse the command-line options (options, args) = parser.parse_args() # Get the number of CPUs specified cpus = int(options.cpus) # Run AllPathsLG with the specified number of CPUs RunAllPathsLG(cpus=cpus)In this example, we use the RunAllPathsLG function from the jcvi.assembly.allpaths package to run the AllPathsLG genome assembler. We create an OptionParser object and add the set_cpus option. The command-line options are parsed and the number of CPUs specified is obtained. We then pass this number to the cpus parameter of the RunAllPathsLG function to run the assembler with the specified number of CPUs. Package/library: jcvi.apps.base