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 copy_fastas(
      fasta_outdir_base,
      input_fasta_dir,
      select_cell_ids=None,
      dryrun=False,
      molecule_types=("peptides", "nucleotides"),
      upper=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 moltype in molecule_types:
          print(f"Copying {moltype}")
          outdir = os.path.join(fasta_outdir_base, moltype)
          if not dryrun and not os.path.exists(outdir):
              os.makedirs(outdir)
  
          fasta_glob = os.path.join(input_fasta_dir, f"*_coding_reads_{moltype}.fasta")
  
          for fasta_original in tqdm(glob.iglob(fasta_glob)):
  
              basename = os.path.basename(fasta_original)
              cell_id = (
                  basename.replace("__aligned__aligned", "")
                  .replace("__aligned__", "__")
                  .replace("__unaligned__unaligned", "")
                  .replace("__unaligned__", "__")
                  .split("__coding")[0]
              )
              if upper:
                  cell_id = cell_id.upper()
              
              # Apply cell id cleaning function if specified    
              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
  
              fasta_newplace = os.path.join(outdir, basename)
              if dryrun:
                  print(f"Copy:\n{fasta_original}\n--> {fasta_newplace}")
              if not dryrun and not os.path.exists(fasta_newplace):
                  shutil.copy(fasta_original, fasta_newplace)
code_tokens: def copy_fastas ( fasta_outdir_base , input_fasta_dir , select_cell_ids = None , dryrun = False , molecule_types = ( "peptides" , "nucleotides" ) , upper = False , cell_id_fun = None ) : for moltype in molecule_types : print ( f"Copying {moltype}" ) outdir = os . path . join ( fasta_outdir_base , moltype ) if not dryrun and not os . path . exists ( outdir ) : os . makedirs ( outdir ) fasta_glob = os . path . join ( input_fasta_dir , f"*_coding_reads_{moltype}.fasta" ) for fasta_original in tqdm ( glob . iglob ( fasta_glob ) ) : basename = os . path . basename ( fasta_original ) cell_id = ( basename . replace ( "__aligned__aligned" , "" ) . replace ( "__aligned__" , "__" ) . replace ( "__unaligned__unaligned" , "" ) . replace ( "__unaligned__" , "__" ) . split ( "__coding" ) [ 0 ] ) if upper : cell_id = cell_id . upper ( ) 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 fasta_newplace = os . path . join ( outdir , basename ) if dryrun : print ( f"Copy:\n{fasta_original}\n--> {fasta_newplace}" ) if not dryrun and not os . path . exists ( fasta_newplace ) : shutil . copy ( fasta_original , fasta_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$# Apply cell id cleaning function if specified    $SEP$#             import pdb; pdb.set_trace()