nodes: 0, module; 1, function_definition; 2, function_name:remove_artifacts_from_biom_table; 3, parameters; 4, block; 5, identifier:table_filename; 6, identifier:fasta_filename; 7, identifier:ref_fp; 8, identifier:biom_table_dir; 9, identifier:ref_db_fp; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, expression_statement; 15, expression_statement; 16, expression_statement; 17, comment:# remove artifacts from the fasta file. output is in clean_fp fasta file; 18, expression_statement; 19, if_statement; 20, expression_statement; 21, comment:# read the clean fasta file; 22, expression_statement; 23, expression_statement; 24, expression_statement; 25, expression_statement; 26, comment:# filter and save the artifact biom table; 27, expression_statement; 28, comment:# remove the samples with 0 reads; 29, expression_statement; 30, expression_statement; 31, expression_statement; 32, expression_statement; 33, comment:# and save the reference-non-hit fasta file; 34, expression_statement; 35, expression_statement; 36, comment:# filter and save the only 16s biom table; 37, expression_statement; 38, comment:# remove the samples with 0 reads; 39, expression_statement; 40, expression_statement; 41, expression_statement; 42, expression_statement; 43, comment:# and save the reference-non-hit fasta file; 44, expression_statement; 45, expression_statement; 46, comment:# we also don't need the cleaned fasta file; 47, expression_statement; 48, return_statement; 49, identifier:threads; 50, integer:1; 51, identifier:verbose; 52, False; 53, identifier:sim_thresh; 54, None; 55, identifier:coverage_thresh; 56, None; 57, comment:"""Remove artifacts from a biom table using SortMeRNA
  
      Parameters
      ----------
      table : str
          name of the biom table file
      fasta_filename : str
          the fasta file containing all the sequences of the biom table
  
      Returns
      -------
      tmp_files : list of str
          The temp files created during the artifact removal step
      """; 58, assignment; 59, call; 60, assignment; 61, comparison_operator:clean_fp is None; 62, block; 63, call; 64, assignment; 65, call; 66, call; 67, assignment; 68, assignment; 69, call; 70, assignment; 71, call; 72, call; 73, assignment; 74, call; 75, call; 76, call; 77, assignment; 78, call; 79, call; 80, assignment; 81, call; 82, call; 83, identifier:tmp_files; 84, identifier:logger; 85, call; 86, attribute; 87, argument_list; 88, pattern_list; 89, call; 90, identifier:clean_fp; 91, None; 92, expression_statement; 93, return_statement; 94, attribute; 95, argument_list; 96, identifier:good_seqs; 97, set_comprehension; 98, attribute; 99, argument_list; 100, attribute; 101, argument_list; 102, identifier:table; 103, call; 104, identifier:artifact_table; 105, call; 106, identifier:filter_minreads_samples_from_table; 107, argument_list; 108, identifier:output_nomatch_fp; 109, call; 110, identifier:write_biom_table; 111, argument_list; 112, attribute; 113, argument_list; 114, identifier:output_nomatch_fasta_fp; 115, call; 116, identifier:fasta_from_biom; 117, argument_list; 118, attribute; 119, argument_list; 120, identifier:filter_minreads_samples_from_table; 121, argument_list; 122, identifier:output_fp; 123, call; 124, identifier:write_biom_table; 125, argument_list; 126, attribute; 127, argument_list; 128, identifier:output_match_fasta_fp; 129, call; 130, identifier:fasta_from_biom; 131, argument_list; 132, attribute; 133, argument_list; 134, attribute; 135, argument_list; 136, identifier:logger; 137, identifier:info; 138, string; 139, identifier:clean_fp; 140, identifier:num_seqs_left; 141, identifier:tmp_files; 142, identifier:remove_artifacts_seqs; 143, argument_list; 144, call; 145, identifier:tmp_files; 146, identifier:logger; 147, identifier:debug; 148, binary_operator:'removed artifacts from sequences input %s'
                   ' to output %s' % (fasta_filename, clean_fp); 149, identifier:s; 150, for_in_clause; 151, identifier:logger; 152, identifier:debug; 153, binary_operator:'loaded %d sequences from cleaned biom table'
                   ' fasta file' % len(good_seqs); 154, identifier:logger; 155, identifier:debug; 156, binary_operator:'loading biom table %s' % table_filename; 157, identifier:load_table; 158, argument_list; 159, attribute; 160, argument_list; 161, identifier:artifact_table; 162, identifier:join; 163, argument_list; 164, identifier:artifact_table; 165, identifier:output_nomatch_fp; 166, identifier:logger; 167, identifier:info; 168, binary_operator:'wrote artifact only filtered biom table to %s'
                  % output_nomatch_fp; 169, identifier:join; 170, argument_list; 171, identifier:artifact_table; 172, identifier:output_nomatch_fasta_fp; 173, identifier:table; 174, identifier:filter; 175, call; 176, keyword_argument; 177, identifier:table; 178, identifier:join; 179, argument_list; 180, identifier:table; 181, identifier:output_fp; 182, identifier:logger; 183, identifier:info; 184, binary_operator:'wrote 16s filtered biom table to %s' % output_fp; 185, identifier:join; 186, argument_list; 187, identifier:table; 188, identifier:output_match_fasta_fp; 189, identifier:tmp_files; 190, identifier:append; 191, identifier:clean_fp; 192, identifier:logging; 193, identifier:getLogger; 194, identifier:__name__; 195, string_content:getting 16s sequences from the biom table; 196, identifier:fasta_filename; 197, identifier:ref_fp; 198, keyword_argument; 199, keyword_argument; 200, keyword_argument; 201, keyword_argument; 202, keyword_argument; 203, keyword_argument; 204, keyword_argument; 205, attribute; 206, argument_list; 207, concatenated_string; 208, tuple; 209, pattern_list; 210, call; 211, concatenated_string; 212, call; 213, string; 214, identifier:table_filename; 215, identifier:table_filename; 216, identifier:table; 217, identifier:filter; 218, call; 219, keyword_argument; 220, keyword_argument; 221, keyword_argument; 222, identifier:biom_table_dir; 223, string; 224, string; 225, identifier:output_nomatch_fp; 226, identifier:biom_table_dir; 227, string; 228, identifier:list; 229, argument_list; 230, identifier:axis; 231, string; 232, identifier:biom_table_dir; 233, string; 234, string; 235, identifier:output_fp; 236, identifier:biom_table_dir; 237, string; 238, identifier:working_dir; 239, identifier:biom_table_dir; 240, identifier:ref_db_fp; 241, identifier:ref_db_fp; 242, identifier:negate; 243, False; 244, identifier:threads; 245, identifier:threads; 246, identifier:verbose; 247, identifier:verbose; 248, identifier:sim_thresh; 249, identifier:sim_thresh; 250, identifier:coverage_thresh; 251, identifier:coverage_thresh; 252, identifier:logger; 253, identifier:warn; 254, binary_operator:"No clean sequences in %s" % fasta_filename; 255, string; 256, string; 257, identifier:fasta_filename; 258, identifier:clean_fp; 259, identifier:_; 260, identifier:s; 261, identifier:sequence_generator; 262, argument_list; 263, string; 264, string; 265, identifier:len; 266, argument_list; 267, string_content:loading biom table %s; 268, identifier:list; 269, argument_list; 270, identifier:axis; 271, string; 272, identifier:inplace; 273, False; 274, identifier:invert; 275, True; 276, string_content:reference-non-hit.biom; 277, string_content:wrote artifact only filtered biom table to %s; 278, string_content:reference-non-hit.seqs.fa; 279, identifier:good_seqs; 280, string_content:observation; 281, string_content:reference-hit.biom; 282, string_content:wrote 16s filtered biom table to %s; 283, string_content:reference-hit.seqs.fa; 284, string:"No clean sequences in %s"; 285, identifier:fasta_filename; 286, string_content:removed artifacts from sequences input %s; 287, string_content:to output %s; 288, identifier:clean_fp; 289, string_content:loaded %d sequences from cleaned biom table; 290, string_content:fasta file; 291, identifier:good_seqs; 292, identifier:good_seqs; 293, string_content:observation
code: def remove_artifacts_from_biom_table(table_filename,
                                       fasta_filename,
                                       ref_fp,
                                       biom_table_dir,
                                       ref_db_fp,
                                       threads=1,
                                       verbose=False,
                                       sim_thresh=None,
                                       coverage_thresh=None):
      """Remove artifacts from a biom table using SortMeRNA
  
      Parameters
      ----------
      table : str
          name of the biom table file
      fasta_filename : str
          the fasta file containing all the sequences of the biom table
  
      Returns
      -------
      tmp_files : list of str
          The temp files created during the artifact removal step
      """
      logger = logging.getLogger(__name__)
      logger.info('getting 16s sequences from the biom table')
  
      # remove artifacts from the fasta file. output is in clean_fp fasta file
      clean_fp, num_seqs_left, tmp_files = remove_artifacts_seqs(fasta_filename, ref_fp,
                                                                 working_dir=biom_table_dir,
                                                                 ref_db_fp=ref_db_fp,
                                                                 negate=False, threads=threads,
                                                                 verbose=verbose,
                                                                 sim_thresh=sim_thresh,
                                                                 coverage_thresh=coverage_thresh)
      if clean_fp is None:
          logger.warn("No clean sequences in %s" % fasta_filename)
          return tmp_files
  
      logger.debug('removed artifacts from sequences input %s'
                   ' to output %s' % (fasta_filename, clean_fp))
  
      # read the clean fasta file
      good_seqs = {s for _, s in sequence_generator(clean_fp)}
      logger.debug('loaded %d sequences from cleaned biom table'
                   ' fasta file' % len(good_seqs))
  
      logger.debug('loading biom table %s' % table_filename)
      table = load_table(table_filename)
  
      # filter and save the artifact biom table
      artifact_table = table.filter(list(good_seqs),
                                    axis='observation', inplace=False,
                                    invert=True)
      # remove the samples with 0 reads
      filter_minreads_samples_from_table(artifact_table)
      output_nomatch_fp = join(biom_table_dir, 'reference-non-hit.biom')
      write_biom_table(artifact_table, output_nomatch_fp)
      logger.info('wrote artifact only filtered biom table to %s'
                  % output_nomatch_fp)
      # and save the reference-non-hit fasta file
      output_nomatch_fasta_fp = join(biom_table_dir, 'reference-non-hit.seqs.fa')
      fasta_from_biom(artifact_table, output_nomatch_fasta_fp)
  
      # filter and save the only 16s biom table
      table.filter(list(good_seqs), axis='observation')
      # remove the samples with 0 reads
      filter_minreads_samples_from_table(table)
      output_fp = join(biom_table_dir, 'reference-hit.biom')
      write_biom_table(table, output_fp)
      logger.info('wrote 16s filtered biom table to %s' % output_fp)
      # and save the reference-non-hit fasta file
      output_match_fasta_fp = join(biom_table_dir, 'reference-hit.seqs.fa')
      fasta_from_biom(table, output_match_fasta_fp)
  
      # we also don't need the cleaned fasta file
      tmp_files.append(clean_fp)
      return tmp_files