Esempio n. 1
0
static unsigned int convert_distribution(unsigned int i, vp9_tree tree,
                                         unsigned int branch_ct[][2],
                                         const unsigned int num_events[]) {
  unsigned int left, right;

  if (tree[i] <= 0)
    left = num_events[-tree[i]];
  else
    left = convert_distribution(tree[i], tree, branch_ct, num_events);

  if (tree[i + 1] <= 0)
    right = num_events[-tree[i + 1]];
  else
    right = convert_distribution(tree[i + 1], tree, branch_ct, num_events);

  branch_ct[i >> 1][0] = left;
  branch_ct[i >> 1][1] = right;
  return left + right;
}
/*METHOD: Evaluate the kraken database file*/
void evaluate_kfile(string k_file, string o_file, const taxonomy *my_taxonomy, const map<int, taxonomy *> *taxid2node, const map<string, int> seqid2taxid, const int kmer_len, const int read_len){
    /*Read the file and get maps:
     * map of number seqid to the kmer distribution  
     * map of number seqid to taxid 
     */
    map<int, string> id2kmers;
    map<int, int> id2taxid;
    map<int, string> id2seqid;
    map<int, string> id2tandl;
    int num_reads = read_kfile(k_file, &seqid2taxid, &id2seqid, &id2kmers, &id2taxid, &id2tandl);
    /*For each seqid, in parallel, convert kmer distribution to read distribution*/
    convert_distribution(o_file, num_reads, &id2seqid, &id2kmers, &id2taxid, &id2tandl, my_taxonomy, taxid2node, kmer_len, read_len);
}
Esempio n. 3
0
void vp9_tree_probs_from_distribution(vp9_tree tree,
                                      unsigned int branch_ct[][2],
                                      const unsigned int num_events[]) {
  convert_distribution(0, tree, branch_ct, num_events);
}