original_docstring: Copy k-mer signatures under the same folder per sketch id
      
      cell_id_fun : function
          String manipulation function to clean cell id from the basename of the 
          sketch to have it match the list of select cell ids
      
docstring: Copy k-mer signatures under the same folder per sketch id
  cell_id_fun : function
  String manipulation function to clean cell id from the basename of the
  sketch to have it match the list of select cell ids
docstring_tokens: Copy k - mer signatures under the same folder per sketch id cell_id_fun : function String manipulation function to clean cell id from the basename of the sketch to have it match the list of select cell ids
code: def _per_sketch_id_copy_sketches(
      sketch_ids,
      input_sketch_dir,
      pre_sketch_id_outdir,
      select_cell_ids=None,
      dryrun=False,
      cell_id_fun=None
  ):
      """Copy k-mer signatures under the same folder per sketch id
      
      cell_id_fun : function
          String manipulation function to clean cell id from the basename of the 
          sketch to have it match the list of select cell ids
      """
      for sketch_id in sketch_ids:
          print(f"Copying {sketch_id}")
          outdir = os.path.join(pre_sketch_id_outdir, sketch_id)
          if not dryrun and not os.path.exists(outdir):
              os.makedirs(outdir)
  
          sigfile_glob = os.path.join(input_sketch_dir, sketch_id, "*.sig")
  
          for sigfile_original in tqdm(glob.iglob(sigfile_glob)):
              basename = os.path.basename(sigfile_original)
              
              # Don't need to check for aligned/unaligned here because the signatures are already merged
              cell_id = basename.split(".")[0]
              if cell_id_fun is not None:
                  cell_id = cell_id_fun(cell_id)
  #             import pdb; pdb.set_trace()
              
              if select_cell_ids is not None and cell_id not in select_cell_ids:
                  continue
  
              # Set to the new, cleaned cell id if applicable
              sigfile_newplace = os.path.join(outdir, f"{cell_id}.sig")
              if dryrun:
                  print(f"Copy:\n{sigfile_original}\n--> {sigfile_newplace}")
              if not dryrun and not os.path.exists(sigfile_newplace):
                  shutil.copy(sigfile_original, sigfile_newplace)
code_tokens: def _per_sketch_id_copy_sketches ( sketch_ids , input_sketch_dir , pre_sketch_id_outdir , select_cell_ids = None , dryrun = False , cell_id_fun = None ) : for sketch_id in sketch_ids : print ( f"Copying {sketch_id}" ) outdir = os . path . join ( pre_sketch_id_outdir , sketch_id ) if not dryrun and not os . path . exists ( outdir ) : os . makedirs ( outdir ) sigfile_glob = os . path . join ( input_sketch_dir , sketch_id , "*.sig" ) for sigfile_original in tqdm ( glob . iglob ( sigfile_glob ) ) : basename = os . path . basename ( sigfile_original ) cell_id = basename . split ( "." ) [ 0 ] if cell_id_fun is not None : cell_id = cell_id_fun ( cell_id ) if select_cell_ids is not None and cell_id not in select_cell_ids : continue sigfile_newplace = os . path . join ( outdir , f"{cell_id}.sig" ) if dryrun : print ( f"Copy:\n{sigfile_original}\n--> {sigfile_newplace}" ) if not dryrun and not os . path . exists ( sigfile_newplace ) : shutil . copy ( sigfile_original , sigfile_newplace )
short_docstring: Copy k-mer signatures under the same folder per sketch id
  cell_id_fun : function
  String manipulation function to clean cell id from the basename of the
  sketch to have it match the list of select cell ids
short_docstring_tokens: Copy k - mer signatures under the same folder per sketch id cell_id_fun : function String manipulation function to clean cell id from the basename of the sketch to have it match the list of select cell ids
comment: """Copy k-mer signatures under the same folder per sketch id
      
      cell_id_fun : function
          String manipulation function to clean cell id from the basename of the 
          sketch to have it match the list of select cell ids
      """$SEP$# Don't need to check for aligned/unaligned here because the signatures are already merged$SEP$#             import pdb; pdb.set_trace()$SEP$# Set to the new, cleaned cell id if applicable