nodes: 0, module; 1, function_definition; 2, function_name:sort_by_abundance_usearch61; 3, parameters; 4, block; 5, identifier:seq_path; 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, expression_statement; 16, if_statement; 17, if_statement; 18, expression_statement; 19, expression_statement; 20, if_statement; 21, if_statement; 22, expression_statement; 23, expression_statement; 24, return_statement; 25, identifier:output_dir; 26, string; 27, identifier:rev; 28, False; 29, identifier:minlen; 30, integer:64; 31, identifier:remove_usearch_logs; 32, False; 33, identifier:HALT_EXEC; 34, False; 35, identifier:output_fna_filepath; 36, None; 37, identifier:output_uc_filepath; 38, None; 39, identifier:log_name; 40, string:"abundance_sorted.log"; 41, identifier:threads; 42, float:1.0; 43, comment:""" usearch61 application call to sort fasta file by abundance.
  
      seq_path:  fasta filepath to be clustered with usearch61
      output_dir: directory to output log, OTU mapping, and intermediate files
      rev: enable reverse strand matching for clustering/sorting
      minlen: minimum sequence length
      remove_usearch_logs: Saves usearch log files
      HALT_EXEC: application controller option to halt execution
      output_fna_filepath: path to write sorted fasta filepath
      output_uc_filepath: path to write usearch61 generated .uc file
      log_name: filepath to write usearch61 generated log file
      threads: Specify number of threads used per core per CPU
      """; 44, not_operator; 45, block; 46, not_operator; 47, block; 48, assignment; 49, assignment; 50, identifier:rev; 51, block; 52, not_operator; 53, block; 54, assignment; 55, assignment; 56, expression_list; 57, string_content:.; 58, identifier:output_fna_filepath; 59, expression_statement; 60, identifier:output_uc_filepath; 61, expression_statement; 62, identifier:log_filepath; 63, call; 64, identifier:params; 65, dictionary; 66, expression_statement; 67, identifier:remove_usearch_logs; 68, expression_statement; 69, identifier:app; 70, call; 71, identifier:app_result; 72, call; 73, identifier:output_fna_filepath; 74, identifier:output_uc_filepath; 75, identifier:app_result; 76, assignment; 77, assignment; 78, identifier:join; 79, argument_list; 80, pair; 81, pair; 82, pair; 83, pair; 84, pair; 85, pair; 86, assignment; 87, assignment; 88, identifier:Usearch61; 89, argument_list; 90, identifier:app; 91, argument_list; 92, pattern_list; 93, call; 94, pattern_list; 95, call; 96, identifier:output_dir; 97, identifier:log_name; 98, string; 99, identifier:minlen; 100, string; 101, True; 102, string; 103, identifier:seq_path; 104, string; 105, identifier:output_fna_filepath; 106, string; 107, identifier:output_uc_filepath; 108, string; 109, identifier:threads; 110, subscript; 111, string; 112, subscript; 113, identifier:log_filepath; 114, identifier:params; 115, keyword_argument; 116, keyword_argument; 117, identifier:_; 118, identifier:output_fna_filepath; 119, identifier:mkstemp; 120, argument_list; 121, identifier:_; 122, identifier:output_uc_filepath; 123, identifier:mkstemp; 124, argument_list; 125, string_content:--minseqlength; 126, string_content:--sizeout; 127, string_content:--derep_fulllength; 128, string_content:--output; 129, string_content:--uc; 130, string_content:--threads; 131, identifier:params; 132, string; 133, string_content:both; 134, identifier:params; 135, string; 136, identifier:WorkingDir; 137, identifier:output_dir; 138, identifier:HALT_EXEC; 139, identifier:HALT_EXEC; 140, keyword_argument; 141, keyword_argument; 142, keyword_argument; 143, keyword_argument; 144, string_content:--strand; 145, string_content:--log; 146, identifier:prefix; 147, string; 148, identifier:suffix; 149, string; 150, identifier:prefix; 151, string; 152, identifier:suffix; 153, string; 154, string_content:abundance_sorted; 155, string_content:.fna; 156, string_content:abundance_sorted; 157, string_content:.uc
code: def sort_by_abundance_usearch61(seq_path,
                                  output_dir='.',
                                  rev=False,
                                  minlen=64,
                                  remove_usearch_logs=False,
                                  HALT_EXEC=False,
                                  output_fna_filepath=None,
                                  output_uc_filepath=None,
                                  log_name="abundance_sorted.log",
                                  threads=1.0):
      """ usearch61 application call to sort fasta file by abundance.
  
      seq_path:  fasta filepath to be clustered with usearch61
      output_dir: directory to output log, OTU mapping, and intermediate files
      rev: enable reverse strand matching for clustering/sorting
      minlen: minimum sequence length
      remove_usearch_logs: Saves usearch log files
      HALT_EXEC: application controller option to halt execution
      output_fna_filepath: path to write sorted fasta filepath
      output_uc_filepath: path to write usearch61 generated .uc file
      log_name: filepath to write usearch61 generated log file
      threads: Specify number of threads used per core per CPU
      """
  
      if not output_fna_filepath:
          _, output_fna_filepath = mkstemp(prefix='abundance_sorted',
                                           suffix='.fna')
  
      if not output_uc_filepath:
          _, output_uc_filepath = mkstemp(prefix='abundance_sorted',
                                          suffix='.uc')
  
      log_filepath = join(output_dir, log_name)
  
      params = {'--minseqlength': minlen,
                '--sizeout': True,
                '--derep_fulllength': seq_path,
                '--output': output_fna_filepath,
                '--uc': output_uc_filepath,
                '--threads': threads
                }
  
      if rev:
          params['--strand'] = 'both'
      if not remove_usearch_logs:
          params['--log'] = log_filepath
  
      app = Usearch61(params, WorkingDir=output_dir, HALT_EXEC=HALT_EXEC)
  
      app_result = app()
  
      return output_fna_filepath, output_uc_filepath, app_result