nodes: 0, module; 1, function_definition; 2, function_name:sort_by_length_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, expression_statement; 13, if_statement; 14, expression_statement; 15, expression_statement; 16, if_statement; 17, expression_statement; 18, expression_statement; 19, return_statement; 20, identifier:output_dir; 21, string:"."; 22, identifier:minlen; 23, integer:64; 24, identifier:remove_usearch_logs; 25, False; 26, identifier:HALT_EXEC; 27, False; 28, identifier:output_fna_filepath; 29, None; 30, identifier:log_name; 31, string:"length_sorted.log"; 32, comment:""" usearch61 application call to sort fasta file by length.
  
      seq_path:  fasta filepath to be clustered with usearch61
      output_dir: directory to output log, OTU mapping, and intermediate files
      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
      log_name: filepath to write usearch61 generated log file
      """; 33, not_operator; 34, block; 35, assignment; 36, assignment; 37, not_operator; 38, block; 39, assignment; 40, assignment; 41, expression_list; 42, identifier:output_fna_filepath; 43, expression_statement; 44, identifier:log_filepath; 45, call; 46, identifier:params; 47, dictionary; 48, identifier:remove_usearch_logs; 49, expression_statement; 50, identifier:app; 51, call; 52, identifier:app_result; 53, call; 54, identifier:output_fna_filepath; 55, identifier:app_result; 56, assignment; 57, identifier:join; 58, argument_list; 59, pair; 60, pair; 61, pair; 62, assignment; 63, identifier:Usearch61; 64, argument_list; 65, identifier:app; 66, argument_list; 67, pattern_list; 68, call; 69, identifier:output_dir; 70, identifier:log_name; 71, string; 72, identifier:minlen; 73, string; 74, identifier:seq_path; 75, string; 76, identifier:output_fna_filepath; 77, subscript; 78, identifier:log_filepath; 79, identifier:params; 80, keyword_argument; 81, keyword_argument; 82, identifier:_; 83, identifier:output_fna_filepath; 84, identifier:mkstemp; 85, argument_list; 86, string_content:--minseqlength; 87, string_content:--sortbylength; 88, string_content:--output; 89, identifier:params; 90, string; 91, identifier:WorkingDir; 92, identifier:output_dir; 93, identifier:HALT_EXEC; 94, identifier:HALT_EXEC; 95, keyword_argument; 96, keyword_argument; 97, string_content:--log; 98, identifier:prefix; 99, string; 100, identifier:suffix; 101, string; 102, string_content:length_sorted; 103, string_content:.fna
code: def sort_by_length_usearch61(seq_path,
                               output_dir=".",
                               minlen=64,
                               remove_usearch_logs=False,
                               HALT_EXEC=False,
                               output_fna_filepath=None,
                               log_name="length_sorted.log"):
      """ usearch61 application call to sort fasta file by length.
  
      seq_path:  fasta filepath to be clustered with usearch61
      output_dir: directory to output log, OTU mapping, and intermediate files
      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
      log_name: filepath to write usearch61 generated log file
      """
  
      if not output_fna_filepath:
          _, output_fna_filepath = mkstemp(prefix='length_sorted', suffix='.fna')
  
      log_filepath = join(output_dir, log_name)
  
      params = {'--minseqlength': minlen,
                '--sortbylength': seq_path,
                '--output': output_fna_filepath
                }
      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, app_result