[med-svn] [Git][med-team/gfapy][upstream] New upstream version 1.2.3+dfsg
Sascha Steinbiss (@satta)
gitlab at salsa.debian.org
Mon Feb 7 14:48:28 GMT 2022
Sascha Steinbiss pushed to branch upstream at Debian Med / gfapy
Commits:
b9a7cb0d by Sascha Steinbiss at 2022-02-07T15:34:38+01:00
New upstream version 1.2.3+dfsg
- - - - -
7 changed files:
- CHANGES.txt
- doc/conf.py
- doc/tutorial/header.rst
- gfapy/gfa.py
- gfapy/lines/creators.py
- gfapy/lines/headers.py
- setup.py
Changes:
=====================================
CHANGES.txt
=====================================
@@ -1,3 +1,7 @@
+== 1.2.3 ==
+
+- make it possible to count input header lines correctly
+
== 1.2.2 ==
- remove to/from aliases for GFA1 containment/link fields
=====================================
doc/conf.py
=====================================
@@ -76,7 +76,7 @@ author = 'Giorgio Gonnella and others (see CONTRIBUTORS)'
# The short X.Y version.
version = '1.2'
# The full version, including alpha/beta/rc tags.
-release = '1.2.2'
+release = '1.2.3'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
=====================================
doc/tutorial/header.rst
=====================================
@@ -167,3 +167,23 @@ The split header can be retrieved using the
>>> str(gfa)
'H\tVN:Z:1.0\nH\txx:i:1\nH\txx:i:2'
+Count the input header lines
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Due to the different way header lines are stored, the number of header elements
+is not equal to the number of header lines in the input. This is annoying if an
+application wants to count the number of input lines in a file. In order to make
+that possible, the number of input header lines are counted and can be
+retrieved using the :attr:`~gfapy.lines.headers.Headers.n_input_header_lines`
+property of the Gfa instance.
+
+.. doctest::
+
+ >>> gfa = gfapy.Gfa()
+ >>> gfa.add_line("H\txx:i:1\tyy:Z:ABC") #doctest: +ELLIPSIS
+ >>> gfa.add_line("H\txy:i:2") #doctest: +ELLIPSIS
+ >>> gfa.add_line("H\tyz:i:3\tab:A:A") #doctest: +ELLIPSIS
+ >>> len(gfa.headers)
+ 5
+ >>> gfa.n_input_header_lines
+ 3
=====================================
gfapy/gfa.py
=====================================
@@ -41,6 +41,7 @@ class Gfa(Lines,GraphOperations,RGFA):
self._records = defaultdict(dict)
self._records["H"] = gfapy.line.Header(["H"], vlevel = vlevel)
self._records["H"].connect(self)
+ self._n_input_header_lines = 0
self._records["S"] = {}
self._records["P"] = {}
self._records["F"] = {}
=====================================
gfapy/lines/creators.py
=====================================
@@ -87,6 +87,7 @@ class Creators:
gfa_line = gfapy.Line(gfa_line, dialect=self._dialect)
gfa_line.connect(self)
elif rt == "H":
+ self._n_input_header_lines += 1
if isinstance(gfa_line, str):
gfa_line = gfapy.Line(gfa_line, vlevel=self._vlevel,
dialect=self._dialect)
@@ -139,6 +140,7 @@ class Creators:
"Cannot add instance of incompatible line type "+
str(type(gfa_line)))
if gfa_line.record_type == "H":
+ self._n_input_header_lines += 1
if self._vlevel > 0 and gfa_line.VN and gfa_line.VN != "1.0":
raise gfapy.VersionError(
"Header line specified wrong version ({})\n".format(gfa_line.VN)+
@@ -172,6 +174,7 @@ class Creators:
"Cannot add instance of incompatible line type "+
str(type(gfa_line)))
if gfa_line.record_type == "H":
+ self._n_input_header_lines += 1
if self._vlevel > 0 and gfa_line.VN and gfa_line.VN != "2.0":
raise gfapy.VersionError(
"Header line specified wrong version ({})\n".format(gfa_line.VN)+
=====================================
gfapy/lines/headers.py
=====================================
@@ -9,6 +9,10 @@ class Headers:
"""
return self._records["H"]
+ @property
+ def n_input_header_lines(self):
+ return self._n_input_header_lines
+
@property
def headers(self):
"""The splitted header of the Gfa instance.
=====================================
setup.py
=====================================
@@ -9,7 +9,7 @@ if not sys.version_info[0] == 3:
sys.exit("Sorry, only Python 3 is supported")
setup(name='gfapy',
- version='1.2.2',
+ version='1.2.3',
description='Library for handling data in the GFA1 and GFA2 formats',
long_description=readme(),
url='https://github.com/ggonnella/gfapy',
View it on GitLab: https://salsa.debian.org/med-team/gfapy/-/commit/b9a7cb0dd4b02919b5ea4a7a97d3f7ec8d5fa76f
--
View it on GitLab: https://salsa.debian.org/med-team/gfapy/-/commit/b9a7cb0dd4b02919b5ea4a7a97d3f7ec8d5fa76f
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/20220207/202a0c54/attachment-0001.htm>
More information about the debian-med-commit
mailing list