[med-svn] [Git][med-team/python-nanomath][upstream] New upstream version 1.2.1+ds

Nilesh Patra (@nilesh) gitlab at salsa.debian.org
Sun May 16 14:29:54 BST 2021



Nilesh Patra pushed to branch upstream at Debian Med / python-nanomath


Commits:
461e5d26 by Nilesh Patra at 2021-05-16T18:56:01+05:30
New upstream version 1.2.1+ds
- - - - -


4 changed files:

- PKG-INFO
- nanomath.egg-info/PKG-INFO
- nanomath/nanomath.py
- nanomath/version.py


Changes:

=====================================
PKG-INFO
=====================================
@@ -1,6 +1,6 @@
 Metadata-Version: 1.2
 Name: nanomath
-Version: 1.2.0
+Version: 1.2.1
 Summary: A few simple math function for other Oxford Nanopore processing scripts
 Home-page: https://github.com/wdecoster/nanomath
 Author: Wouter De Coster


=====================================
nanomath.egg-info/PKG-INFO
=====================================
@@ -1,6 +1,6 @@
 Metadata-Version: 1.2
 Name: nanomath
-Version: 1.2.0
+Version: 1.2.1
 Summary: A few simple math function for other Oxford Nanopore processing scripts
 Home-page: https://github.com/wdecoster/nanomath
 Author: Wouter De Coster


=====================================
nanomath/nanomath.py
=====================================
@@ -53,6 +53,11 @@ class Stats(object):
                                          col="quals",
                                          values=["quals", "lengths"])
             self._reads_above_qual = [reads_above_qual(df, q) for q in self._qualgroups]
+        else:
+            self._top5_lengths = get_top_5(df=df,
+                                           col="lengths",
+                                           values=["lengths"],
+                                           fill='quals')
 
     def long_features_as_string(self):
         """formatting long features to a string to print for legacy stats output"""
@@ -95,12 +100,16 @@ class Stats(object):
 
     def unwind_long_features_top5(self, feature, name):
         """for tsv stats output"""
+        if feature not in self.__dict__:
+            return
         for entry, label in zip(self.__dict__[feature], range(1, 6)):
             self.__dict__[name + ':' + str(label)] = '{} ({})'.format(round(entry[0], ndigits=1),
                                                                       round(entry[1], ndigits=1))
 
     def unwind_long_features_above_qual(self, feature, name):
         """for tsv stats output"""
+        if feature not in self.__dict__:
+            return
         for entry, label in zip(self.__dict__[feature],
                                 ['>Q{}:'.format(q) for q in self._qualgroups]):
             numberAboveQ, megAboveQ = entry
@@ -148,13 +157,20 @@ def ave_qual(quals, qround=False, tab=errs_tab(128)):
         return None
 
 
-def get_top_5(df, col, values):
+def get_top_5(df, col, values, fill=False):
     if "readIDs" in df:
         values.append("readIDs")
-    return df.sort_values(col, ascending=False) \
-        .head(5)[values] \
-        .reset_index(drop=True) \
-        .itertuples(index=False, name=None)
+    if fill:
+        return df.sort_values(col, ascending=False) \
+            .head(5)[values] \
+            .assign(fill=[0]*5) \
+            .reset_index(drop=True) \
+            .itertuples(index=False, name=None)
+    else:
+        return df.sort_values(col, ascending=False) \
+            .head(5)[values] \
+            .reset_index(drop=True) \
+            .itertuples(index=False, name=None)
 
 
 def reads_above_qual(df, qual):


=====================================
nanomath/version.py
=====================================
@@ -1 +1 @@
-__version__ = "1.2.0"
+__version__ = "1.2.1"



View it on GitLab: https://salsa.debian.org/med-team/python-nanomath/-/commit/461e5d26467062fbb1c665e294418b4ec57eea30

-- 
View it on GitLab: https://salsa.debian.org/med-team/python-nanomath/-/commit/461e5d26467062fbb1c665e294418b4ec57eea30
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/20210516/7e7d055d/attachment-0001.htm>


More information about the debian-med-commit mailing list