docs: def setup_jobs(outpath, options, input_files):
      ''' This function sets up the jobs by creating the necessary input files as expected.
            - outpath is where the output is to be stored.
            - options is the optparse options object.
            - input_files is a list of paths to input files.
      '''
  
      job_inputs = None
      reverse_mapping = None
      fasta_file_contents = {}
  
      # Generate FASTA files for PDB inputs
      # fasta_file_contents is a mapping from a file path to a pair (FASTA contents, file type). We remember the file type
      # since we offset residue IDs depending on file type i.e. for FASTA files, we treat each sequence separately and do
      # not renumber the fragments in postprocessing. For PDB files, however, we need to respect the order and length of
      # sequences so that we renumber the fragments appropriately in postprocessing - we assume that if a PDB file is passed in
      # then all chains (protein, RNA, or DNA) will be used in a Rosetta run.
      for input_file in input_files:
          assert(not(fasta_file_contents.get(input_file)))
          if any(fnmatch(input_file, x) for x in pdb_file_wildcards):
              pdb = PDB.from_filepath(input_file, strict=True)
              pdb.pdb_id = os.path.basename(input_file).split('.')[0]            
              if pdb.pdb_id.startswith('pdb') and len(pdb.pdb_id) >= 7:
                  # Hack to rename FASTA identifiers for pdb*.ent files which are present in mirrors of the PDB
                  pdb.pdb_id = pdb.pdb_id.replace('pdb', '')    
              fasta_file_contents[input_file] = (pdb.create_fasta(prefer_seqres_order = False), 'PDB')
          else:
              fasta_file_contents[input_file] = (read_file(input_file), 'FASTA')
  
      # Extract sequences from the input FASTA files.
      found_sequences, reverse_mapping, errors = get_sequences(options, fasta_file_contents)
      if found_sequences:
          reformat(found_sequences)
      if errors:
          return None, False, errors
  
      # Discard sequences that are the wrong chain.
      desired_sequences = {}
      for key, sequence in found_sequences.iteritems():
          pdb_id, chain, file_name = key
          if options.chain is None or chain == options.chain:
              desired_sequences[key] = sequence
  
      # Create the input FASTA and script files.
      job_inputs, errors = create_inputs(options, outpath, desired_sequences)
  
      # Create the reverse mapping file
      if reverse_mapping:
          segment_mapping_file = os.path.join(outpath, "segment_map.json")
          colorprinter.message("Creating a reverse mapping file %s." % segment_mapping_file)
          write_file(segment_mapping_file, json.dumps(reverse_mapping))
  
      # Create the post-processing script file
      post_processing_script = read_file(os.path.join(os.path.split(os.path.realpath(__file__))[0], 'post_processing.py'))
      write_file(os.path.join(outpath, 'post_processing.py'), post_processing_script, 'w')
  
      # Create the secondary structure filter file
      if options.secondary_structure_file:
          write_file(os.path.join(outpath, 'ss_filter.json'), json.dumps({'secondary_structure_filter' : SecondaryStructureDefinition.from_filepath(options.secondary_structure_file).data}), 'w')
  
      return job_inputs, reverse_mapping != None, errors