[med-svn] [Git][med-team/unifrac-tools][master] 2 commits: Backport upstream patch to fix FTBFS in unifrac version 1.3

Nilesh Patra (@nilesh) gitlab at salsa.debian.org
Mon Oct 23 23:43:30 BST 2023



Nilesh Patra pushed to branch master at Debian Med / unifrac-tools


Commits:
ed9eddef by Nilesh Patra at 2023-10-24T04:03:47+05:30
Backport upstream patch to fix FTBFS in unifrac version 1.3

- - - - -
e996f0fc by Nilesh Patra at 2023-10-24T04:03:58+05:30
Upload to unstable

- - - - -


3 changed files:

- debian/changelog
- + debian/patches/PR53.patch
- debian/patches/series


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+unifrac-tools (1.4-2) unstable; urgency=medium
+
+  * Team Upload.
+  * Backport upstream patch to fix FTBFS in unifrac 1.3.
+
+ -- Nilesh Patra <nilesh at debian.org>  Tue, 24 Oct 2023 04:03:49 +0530
+
 unifrac-tools (1.4-1) unstable; urgency=medium
 
   * Team Upload.


=====================================
debian/patches/PR53.patch
=====================================
@@ -0,0 +1,113 @@
+From 39c8fbf839ea46df0f11fa49f5592433f10749aa Mon Sep 17 00:00:00 2001
+From: Igor Sfiligoi <isfiligoi at sdsc.edu>
+Date: Fri, 6 Oct 2023 10:37:51 -0700
+Subject: [PATCH 1/5] Add support for empty after filter in biom_inmem
+
+---
+ src/biom_inmem.cpp | 14 +++++++++++---
+ 1 file changed, 11 insertions(+), 3 deletions(-)
+
+--- a/src/biom_inmem.cpp
++++ b/src/biom_inmem.cpp
+@@ -257,8 +257,9 @@
+   , sample_ids()
+   , obs_ids()
+ {
+-    #pragma omp parallel for schedule(static)
+-    for(int i = 0; i < 2; i++) {
++    if ((resident_obj.n_obs>0) && (resident_obj.n_samples>0)) {
++     #pragma omp parallel for schedule(static)
++     for(int i = 0; i < 2; i++) {
+         if (i==0) {
+           // filter out zero obs
+           uint32_t obs_cnt = 0;
+@@ -293,7 +294,14 @@
+            }
+            create_id_index(sample_ids, sample_id_index);
+         }
+-    }
++     }
++   } //((resident_obj.n_obs>0) && (resident_obj.n_samples>0))
++   else
++   {
++     // degenerate case, just set to 0
++     n_samples = 0;
++     n_obs = 0;
++   }
+ }
+ 
+ 
+--- a/src/unifrac.cpp
++++ b/src/unifrac.cpp
+@@ -361,7 +361,8 @@
+     double length;
+ 
+     // for node in postorderselect
+-    for(unsigned int k = 0; k < (tree.nparens / 2) - 1; k++) {
++    const unsigned int max_k = (tree.nparens>1) ? ((tree.nparens / 2) - 1) : 0;
++    for(unsigned int k = 0; k < max_k; k++) {
+         node = tree.postorderselect(k);
+         // get branch length
+         length = tree.lengths[node];
+--- a/src/unifrac_cmp.cpp
++++ b/src/unifrac_cmp.cpp
+@@ -142,7 +142,7 @@
+          */
+ 
+     unsigned int k = 0; // index in tree
+-    const unsigned int max_k = (tree.nparens / 2) - 1;
++    const unsigned int max_k = (tree.nparens>1) ? ((tree.nparens / 2) - 1) : 0;
+ 
+     const unsigned int num_prop_chunks = propstack_multi.get_num_stacks();
+     while (k<max_k) {
+@@ -293,7 +293,7 @@
+ #pragma acc enter data create(lengths[:max_emb])
+ 
+     unsigned int k = 0; // index in tree
+-    const unsigned int max_k = (tree.nparens / 2) - 1;
++    const unsigned int max_k = (tree.nparens>1) ? ((tree.nparens / 2) - 1) : 0;
+ 
+     const unsigned int num_prop_chunks = propstack_multi.get_num_stacks();
+     while (k<max_k) {
+--- a/src/api.cpp
++++ b/src/api.cpp
+@@ -510,14 +510,33 @@
+     SETUP_TDBG("faith_pd_one_off")
+     CHECK_FILE(biom_filename, table_missing)
+     CHECK_FILE(tree_filename, tree_missing)
+-    PARSE_SYNC_TREE_TABLE(tree_filename, table_filename)
+-
++    PARSE_TREE_TABLE(tree_filename, biom_filename)
+     TDBG_STEP("load_files")
+-    initialize_results_vec(*result, table);
+ 
+-    // compute faithpd
+-    su::faith_pd(table, tree_sheared, std::ref((*result)->values));
+-    TDBG_STEP("faith_pd")
++    // Filter out any elements with zero counts
++    su::biom_inmem table_nz(table,1.0);
++    if ((table_nz.n_samples==0) || (table_nz.n_obs==0)) {
++      fprintf(stderr, "WARNING: All samples had zero counts. Forcing zero result.\n");
++      SYNC_TREE_TABLE(tree, table)
++
++      TDBG_STEP("sync_tree_table")
++      initialize_results_vec(*result, table);
++      // nothing else to do... results already initialized to 0
++      TDBG_STEP("faith_pd")
++    } else {
++      if ((table_nz.n_samples!=table.n_samples) || (table_nz.n_obs!=table.n_obs)) {
++        fprintf(stderr, "WARNING: Some samples had zero counts and were filtered out.\n");
++      }
++      SYNC_TREE_TABLE(tree, table_nz)
++
++      TDBG_STEP("sync_tree_table")
++    
++      initialize_results_vec(*result, table_nz);
++
++      // compute faithpd
++      su::faith_pd(table_nz, tree_sheared, std::ref((*result)->values));
++      TDBG_STEP("faith_pd")
++    }
+ 
+     return okay;
+ }


=====================================
debian/patches/series
=====================================
@@ -5,3 +5,4 @@ baseline.patch
 enable_linking_to_shared_hdf5_lib.patch
 enable-debug-flag.patch
 hardening
+PR53.patch



View it on GitLab: https://salsa.debian.org/med-team/unifrac-tools/-/compare/30371a96e254628e402e15a84c246fa44ae0187e...e996f0fc6980e8683b2124c5337a0b578fc5ad1b

-- 
View it on GitLab: https://salsa.debian.org/med-team/unifrac-tools/-/compare/30371a96e254628e402e15a84c246fa44ae0187e...e996f0fc6980e8683b2124c5337a0b578fc5ad1b
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20231023/5317431c/attachment-0001.htm>


More information about the debian-med-commit mailing list