nodes: 0, module; 1, function_definition; 2, function_name:usearch61_smallmem_cluster; 3, parameters; 4, block; 5, identifier:intermediate_fasta; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_parameter; 15, default_parameter; 16, default_parameter; 17, default_parameter; 18, default_parameter; 19, default_parameter; 20, expression_statement; 21, expression_statement; 22, expression_statement; 23, if_statement; 24, if_statement; 25, if_statement; 26, if_statement; 27, if_statement; 28, expression_statement; 29, expression_statement; 30, expression_statement; 31, return_statement; 32, identifier:percent_id; 33, float:0.97; 34, identifier:minlen; 35, integer:64; 36, identifier:rev; 37, False; 38, identifier:output_dir; 39, string:"."; 40, identifier:remove_usearch_logs; 41, False; 42, identifier:wordlength; 43, integer:8; 44, identifier:usearch61_maxrejects; 45, integer:32; 46, identifier:usearch61_maxaccepts; 47, integer:1; 48, identifier:sizeorder; 49, False; 50, identifier:HALT_EXEC; 51, False; 52, identifier:output_uc_filepath; 53, None; 54, identifier:log_name; 55, string:"smallmem_clustered.log"; 56, identifier:sizeout; 57, False; 58, identifier:consout_filepath; 59, None; 60, comment:""" Performs usearch61 de novo clustering via cluster_smallmem option
  
      Only supposed to be used with length sorted data (and performs length
      sorting automatically) and does not support reverse strand matching
  
      intermediate_fasta:  fasta filepath to be clustered with usearch61
      percent_id:  percentage id to cluster at
      minlen: minimum sequence length
      rev: will enable reverse strand matching if True
      output_dir: directory to output log, OTU mapping, and intermediate files
      remove_usearch_logs: Saves usearch log files
      wordlength: word length to use for initial high probability sequence matches
      usearch61_maxrejects: Set to 'default' or an int value specifying max
       rejects
      usearch61_maxaccepts: Number of accepts allowed by usearch61
      HALT_EXEC: application controller option to halt execution
      output_uc_filepath: Path to write clusters (.uc) file.
      log_name: filepath to write usearch61 generated log file
      sizeout: If True, will save abundance data in output fasta labels.
      consout_filepath: Needs to be set to save clustered consensus fasta
       filepath used for chimera checking.
      """; 61, assignment; 62, assignment; 63, identifier:sizeorder; 64, block; 65, not_operator; 66, block; 67, identifier:rev; 68, block; 69, else_clause; 70, identifier:sizeout; 71, block; 72, identifier:consout_filepath; 73, block; 74, assignment; 75, assignment; 76, assignment; 77, expression_list; 78, identifier:log_filepath; 79, call; 80, identifier:params; 81, dictionary; 82, expression_statement; 83, identifier:remove_usearch_logs; 84, expression_statement; 85, expression_statement; 86, block; 87, expression_statement; 88, expression_statement; 89, identifier:clusters_fp; 90, identifier:output_uc_filepath; 91, identifier:app; 92, call; 93, identifier:app_result; 94, call; 95, identifier:clusters_fp; 96, identifier:app_result; 97, identifier:join; 98, argument_list; 99, pair; 100, pair; 101, pair; 102, pair; 103, pair; 104, pair; 105, pair; 106, pair; 107, assignment; 108, assignment; 109, assignment; 110, expression_statement; 111, assignment; 112, assignment; 113, identifier:Usearch61; 114, argument_list; 115, identifier:app; 116, argument_list; 117, identifier:output_dir; 118, identifier:log_name; 119, string; 120, identifier:minlen; 121, string; 122, identifier:intermediate_fasta; 123, string; 124, identifier:percent_id; 125, string; 126, identifier:output_uc_filepath; 127, string; 128, identifier:wordlength; 129, string; 130, identifier:usearch61_maxrejects; 131, string; 132, identifier:usearch61_maxaccepts; 133, string; 134, True; 135, subscript; 136, True; 137, subscript; 138, identifier:log_filepath; 139, subscript; 140, string; 141, assignment; 142, subscript; 143, True; 144, subscript; 145, identifier:consout_filepath; 146, identifier:params; 147, keyword_argument; 148, keyword_argument; 149, string_content:--minseqlength; 150, string_content:--cluster_smallmem; 151, string_content:--id; 152, string_content:--uc; 153, string_content:--wordlength; 154, string_content:--maxrejects; 155, string_content:--maxaccepts; 156, string_content:--usersort; 157, identifier:params; 158, string; 159, identifier:params; 160, string; 161, identifier:params; 162, string; 163, string_content:both; 164, subscript; 165, string; 166, identifier:params; 167, string; 168, identifier:params; 169, string; 170, identifier:WorkingDir; 171, identifier:output_dir; 172, identifier:HALT_EXEC; 173, identifier:HALT_EXEC; 174, string_content:--sizeorder; 175, string_content:--log; 176, string_content:--strand; 177, identifier:params; 178, string; 179, string_content:plus; 180, string_content:--sizeout; 181, string_content:--consout; 182, string_content:--strand
code: def usearch61_smallmem_cluster(intermediate_fasta,
                                 percent_id=0.97,
                                 minlen=64,
                                 rev=False,
                                 output_dir=".",
                                 remove_usearch_logs=False,
                                 wordlength=8,
                                 usearch61_maxrejects=32,
                                 usearch61_maxaccepts=1,
                                 sizeorder=False,
                                 HALT_EXEC=False,
                                 output_uc_filepath=None,
                                 log_name="smallmem_clustered.log",
                                 sizeout=False,
                                 consout_filepath=None):
      """ Performs usearch61 de novo clustering via cluster_smallmem option
  
      Only supposed to be used with length sorted data (and performs length
      sorting automatically) and does not support reverse strand matching
  
      intermediate_fasta:  fasta filepath to be clustered with usearch61
      percent_id:  percentage id to cluster at
      minlen: minimum sequence length
      rev: will enable reverse strand matching if True
      output_dir: directory to output log, OTU mapping, and intermediate files
      remove_usearch_logs: Saves usearch log files
      wordlength: word length to use for initial high probability sequence matches
      usearch61_maxrejects: Set to 'default' or an int value specifying max
       rejects
      usearch61_maxaccepts: Number of accepts allowed by usearch61
      HALT_EXEC: application controller option to halt execution
      output_uc_filepath: Path to write clusters (.uc) file.
      log_name: filepath to write usearch61 generated log file
      sizeout: If True, will save abundance data in output fasta labels.
      consout_filepath: Needs to be set to save clustered consensus fasta
       filepath used for chimera checking.
      """
  
      log_filepath = join(output_dir, log_name)
  
      params = {'--minseqlength': minlen,
                '--cluster_smallmem': intermediate_fasta,
                '--id': percent_id,
                '--uc': output_uc_filepath,
                '--wordlength': wordlength,
                '--maxrejects': usearch61_maxrejects,
                '--maxaccepts': usearch61_maxaccepts,
                '--usersort': True
                }
  
      if sizeorder:
          params['--sizeorder'] = True
      if not remove_usearch_logs:
          params['--log'] = log_filepath
      if rev:
          params['--strand'] = 'both'
      else:
          params['--strand'] = 'plus'
      if sizeout:
          params['--sizeout'] = True
      if consout_filepath:
          params['--consout'] = consout_filepath
  
      clusters_fp = output_uc_filepath
  
      app = Usearch61(params, WorkingDir=output_dir, HALT_EXEC=HALT_EXEC)
  
      app_result = app()
  
      return clusters_fp, app_result