Exemplo n.º 1
0
  parser.add_argument("--cds", dest = "cdsFile", type = str, default = None,
    help = "Input file containing CDS corresponding to input protein seqs")

  parser.add_argument("--copy", dest = "copy", action = "store_false", default \
    = True, help = "Avoid copying database and configuration files to the ROOT "
    + "folder")

  ## If no arguments are given, just show the help and finish
  if len(sys.argv) == 1:
    parser.print_help()
    sys.exit(1)

  args = parser.parse_args()

  ## Check whether the ROOT directory already exist or not ...
  if lookForDirectory(args.outDir, False):
    sys.exit(("ERROR: Output ROOT folder already exist '%s'") % (args.outDir))
    
  args.outDir = os.path.abspath(args.outDir)
  ## ... and try to create it in case it doesn't exist 
  if not lookForDirectory(args.outDir, create = True):
    sys.exit(("ERROR: ROOT folder '%s' cannot be created") % (args.outDir))

  ## Create folders to store the jobs file and (potentially) the configuration
  ## file and input databases
  lookForDirectory(os.path.join(args.outDir, "jobs"))
  lookForDirectory(os.path.join(args.outDir, "Data"))
  lookForDirectory(os.path.join(args.outDir, "BlastDB"))

  ## Check parameters related to files / directories
  if not lookForFile(os.path.abspath(args.script)):
Exemplo n.º 2
0
  if not lookForFile(args.dbFile):
    sys.exit(("ERROR: Check input TARGET SEQUENCES file '%s' [Mode: HOMOLOGY "
    + "SEARCH]") % (args.dbFile))
  parameters.setdefault("db_file", os.path.abspath(args.dbFile))

  if args.cdsFile:
    if not lookForFile(args.cdsFile):
      sys.exit(("ERROR: Check input CDS file '%s'") % (args.cdsFile))
    parameters.setdefault("cds", os.path.abspath(args.cdsFile))

  if not lookForFile(args.configFile):
    sys.exit(("ERROR: Check input CONFIG file '%s'") % (args.configFile))
  parameters.setdefault("config_file", os.path.abspath(args.configFile))

  if not lookForDirectory(args.outFolder):
    sys.exit(("ERROR: Check output folder '%s'") % (args.outFolder))
  parameters.setdefault("out_directory", os.path.abspath(args.outFolder))

  ## Set output files prefix name depending on input user selection
  tag = os.path.split(args.inFile)[1].split(".")[0]
  parameters.setdefault("prefix", args.prefix if args.prefix else tag)

  ## Read the other parameters from the input config file
  parameters.update(readConfig(parameters["config_file"]))

  ## Check specific values for input parameters.
  if not "coverage" in parameters or not (0.0 < float(parameters["coverage"]) \
    <= 1.0):
    sys.exit(("ERROR: Check your 'coverage' parameter"))