Sascha Steinbiss pushed to branch master at Debian Med / gfapy
Commits: b9a7cb0d by Sascha Steinbiss at 2022-02-07T15:34:38+01:00 New upstream version 1.2.3+dfsg - - - - - 07968513 by Sascha Steinbiss at 2022-02-07T15:34:39+01:00 Update upstream source from tag 'upstream/1.2.3+dfsg' Update to upstream version '1.2.3+dfsg' with Debian dir 3e95a0f8d2714079e9de2a8ab3e707adac08518b - - - - - 8017c0ba by Sascha Steinbiss at 2022-02-07T15:46:23+01:00 new upstream release - - - - - 8 changed files: - CHANGES.txt - debian/changelog - 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 ===================================== debian/changelog ===================================== @@ -1,3 +1,9 @@ +gfapy (1.2.3+dfsg-1) unstable; urgency=medium + + * New upstream release. + + -- Sascha Steinbiss <[email protected]> Mon, 07 Feb 2022 15:34:57 +0100 + gfapy (1.2.2+dfsg-1) unstable; urgency=medium * New upstream release. ===================================== 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/-/compare/f7f120aab1cd22f9256abb3b2acf206de1bb1feb...8017c0badd67fae021ddb4ec7d344bb133cc3068 -- View it on GitLab: https://salsa.debian.org/med-team/gfapy/-/compare/f7f120aab1cd22f9256abb3b2acf206de1bb1feb...8017c0badd67fae021ddb4ec7d344bb133cc3068 You're receiving this email because of your account on salsa.debian.org.
_______________________________________________ debian-med-commit mailing list [email protected] https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/debian-med-commit
