[med-svn] [Git][med-team/gfapy][master] 3 commits: New upstream version 1.2.1+dfsg

Sascha Steinbiss (@satta) gitlab at salsa.debian.org
Sun Nov 14 10:13:25 GMT 2021



Sascha Steinbiss pushed to branch master at Debian Med / gfapy


Commits:
995ef4ed by Sascha Steinbiss at 2021-11-14T11:07:40+01:00
New upstream version 1.2.1+dfsg
- - - - -
7832bc30 by Sascha Steinbiss at 2021-11-14T11:07:41+01:00
Update upstream source from tag 'upstream/1.2.1+dfsg'

Update to upstream version '1.2.1+dfsg'
with Debian dir 0c800d1dfba586485a2a5a8156159dcee50b2b68
- - - - -
e4735e65 by Sascha Steinbiss at 2021-11-14T11:13:00+01:00
new upstream release

- - - - -


13 changed files:

- CHANGES.txt
- bin/gfapy-mergelinear
- debian/changelog
- doc/conf.py
- gfapy/field/oriented_identifier_list_gfa1.py
- gfapy/graph_operations/linear_paths.py
- gfapy/line/edge/link/canonical.py
- gfapy/line/group/path/captured_path.py
- gfapy/line/group/path/references.py
- setup.py
- tests/test_api_linear_paths.py
- + tests/testdata/linear_merging.6.gfa
- + tests/testdata/linear_merging.6.merged.gfa


Changes:

=====================================
CHANGES.txt
=====================================
@@ -1,3 +1,8 @@
+== 1.2.1 ==
+
+- fixed an issue with linear path merging (issue 21)
+- GFA1 paths can contain a single segment only (issue 22)
+
 == 1.2.0 ==
 
 - fixed all open issues


=====================================
bin/gfapy-mergelinear
=====================================
@@ -16,6 +16,8 @@ op.add_argument("--no-progress", '-p', help="do not show progress log",
                 action="store_false", dest="progress")
 op.add_argument("--quiet", '-q', help="suppress output", action="store_false",
                 dest="output")
+op.add_argument("--short", help="use short names for merged segments",
+                action="store_true")
 op.add_argument("--vlevel", help="validation level", default=0, type=int)
 op.add_argument('--version', action='version', version='%(prog)s 1.0')
 opts = op.parse_args()
@@ -30,8 +32,12 @@ if opts.redundant:
   for cc in gfa.connected_components():
     if len(cc) == 1:
       gfa.segment(cc[0]).disconnect()
+if opts.short:
+  merged_name="short"
+else:
+  merged_name=None
 gfa.merge_linear_paths(redundant_junctions=opts.redundant,
                        enable_tracking=False,
-                       merged_name="short")
+                       merged_name=merged_name)
 if opts.output:
   print(gfa)


=====================================
debian/changelog
=====================================
@@ -1,3 +1,9 @@
+gfapy (1.2.1+dfsg-1) unstable; urgency=medium
+
+  * New upstream release.
+
+ -- Sascha Steinbiss <satta at debian.org>  Sun, 14 Nov 2021 11:08:01 +0100
+
 gfapy (1.2.0+dfsg-2) unstable; urgency=medium
 
   * Fix watchfile to check /tags.


=====================================
doc/conf.py
=====================================
@@ -66,7 +66,7 @@ master_doc = 'index'
 
 # General information about the project.
 project = 'Gfapy'
-copyright = '2017, Giorgio Gonnella and others (see CONTRIBUTORS)'
+copyright = '2017--2021, Giorgio Gonnella and others (see CONTRIBUTORS)'
 author = 'Giorgio Gonnella and others (see CONTRIBUTORS)'
 
 # The version info for the project you're documenting, acts as replacement for
@@ -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.0'
+release = '1.2.1'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.


=====================================
gfapy/field/oriented_identifier_list_gfa1.py
=====================================
@@ -10,14 +10,14 @@ def decode(string):
   return unsafe_decode(string)
 
 def validate_encoded(string):
-  if not re.match(r"^[!-)+-<>-~][!-~]*[+-](,[!-)+-<>-~][!-~]*[+-])+$", string):
+  if not re.match(r"^[!-)+-<>-~][!-~]*[+-](,[!-)+-<>-~][!-~]*[+-])*$", string):
     raise gfapy.FormatError(
       "{} is not a valid list of GFA1 segment names ".format(repr(string))+
       "and orientations\n"+
       "(the segment names must match [!-)+-<>-~][!-~]*;\n"+
       " the orientations must be + or -;\n"+
       " the list must be comma-separated "+
-      "NameOrient,NameOrient[,NameOrient...])")
+      "NameOrient[,NameOrient...])")
 
 def validate_decoded(iterable):
   for elem in iterable:


=====================================
gfapy/graph_operations/linear_paths.py
=====================================
@@ -348,8 +348,10 @@ class LinearPaths:
     return merged, first_reversed, last_reversed
 
   def __link_merged(self, merged_name, segment_end, is_reversed):
-    for l in self.segment(segment_end.segment).dovetails_of_end(
-                                                 segment_end.end_type):
+    to_disconnect = self.segment(segment_end.segment).dovetails_of_end(
+                                                 segment_end.end_type)
+    to_add = []
+    for l in to_disconnect:
       l2 = l.clone()
       if l2.to_segment == segment_end.segment:
         l2.to_segment = merged_name
@@ -359,6 +361,10 @@ class LinearPaths:
         l2.from_segment = merged_name
         if is_reversed:
           l2.from_orient = gfapy.invert(l2.from_orient)
+      to_add.append(l2)
+    for l in to_disconnect:
       l.disconnect()
-      self.add_line(l2)
+    for l in to_add:
+      self.add_line(l)
+
 


=====================================
gfapy/line/edge/link/canonical.py
=====================================
@@ -48,3 +48,5 @@ class Canonical:
     """
     if not self.is_canonical():
       return self.complement()
+    else:
+      return self()


=====================================
gfapy/line/group/path/captured_path.py
=====================================
@@ -28,11 +28,14 @@ class CapturedPath:
         "Line is not connected to a GFA instance\n"+
         "Line: {}".format(self))
     retval = []
-    for i in range(len(self.segment_names) - 1):
-      retval.append(self.segment_names[i])
-      retval.append(self.links[i])
-    retval.append(self.segment_names[-1])
-    if len(self.segment_names) == len(self.links):
-      retval.append(self.links[-1])
+    if len(self.segment_names) == 1:
       retval.append(self.segment_names[0])
+    else:
+      for i in range(len(self.segment_names) - 1):
+        retval.append(self.segment_names[i])
+        retval.append(self.links[i])
+      retval.append(self.segment_names[-1])
+      if len(self.segment_names) == len(self.links):
+        retval.append(self.links[-1])
+        retval.append(self.segment_names[0])
     return retval


=====================================
gfapy/line/group/path/references.py
=====================================
@@ -13,6 +13,8 @@ class References:
       An array, which elements are 3-tuples
       (from oriented segment, to oriented segment, cigar)
     """
+    if len(self.segment_names) == 1:
+      return []
     has_undef_overlaps = self._undef_overlaps()
     retval = []
     is_circular = self.is_circular()


=====================================
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.0',
+      version='1.2.1',
       description='Library for handling data in the GFA1 and GFA2 formats',
       long_description=readme(),
       url='https://github.com/ggonnella/gfapy',


=====================================
tests/test_api_linear_paths.py
=====================================
@@ -47,6 +47,15 @@ class TestAPILinearPaths(unittest.TestCase):
         lps.add(" ".join([s.name for s in lp]))
       self.assertEqual({"1 19 18", "11 9 12", "22 16 20 21 23"}, lps)
 
+  def test_linear_path_merge_6(self):
+    gfa = gfapy.Gfa.from_file("tests/testdata/linear_merging.6.gfa")
+    expected = gfapy.Gfa.from_file("tests/testdata/linear_merging.6.merged.gfa")
+    gfa.merge_linear_paths()
+    self.assertEqual(set(gfa.segment_names), set(expected.segment_names))
+    dovetails_gfa = [str(l) for l in gfa.dovetails].sort()
+    dovetails_expected = [str(l) for l in expected.dovetails].sort()
+    self.assertEqual(dovetails_gfa, dovetails_expected)
+
   def test_linear_path_blunt_ends(self):
     for sfx in ["gfa1", "gfa2"]:
       gfa = gfapy.Gfa.from_file("tests/testdata/linear_blunt."+"{}".format(sfx))


=====================================
tests/testdata/linear_merging.6.gfa
=====================================
@@ -0,0 +1,27 @@
+S	A	TTTTTCCCCCGGGGGGGGGGNCCCCCCCCCCTTTTTAAAAA	LN:i:41
+S	B	AAAAAAAAAAGGGGGGGGGGNCCCCCCCCCCGGGGGAAAAA	LN:i:41
+S	C	CCCCCCCCCCGGGGGGGGGGNCCCCCCCCCCTTTTTTTTTT	LN:i:41
+S	D	TTTTTAAAAACCCCCCCCCCNAAAAAAAAAAAAAAATTTTT	LN:i:41
+S	E	TTTTTAAAAAGGGGGGGGGGNCCCCCCCCCCCCCCCGGGGG	LN:i:41
+S	F	AAAAAAAAAACCCCCCCCCCNAAAAAAAAAAAAAAATTTTT	LN:i:41
+S	X1	AAAAATTTTT	LN:i:10
+S	X2	AAAAATTTTT	LN:i:10
+S	X3	AAAAATTTTT	LN:i:10
+S	X4	AAAAATTTTT	LN:i:10
+S	X5	AAAAATTTTT	LN:i:10
+S	X6	AAAAATTTTT	LN:i:10
+S	X7	AAAAATTTTT	LN:i:10
+S	X8	AAAAATTTTT	LN:i:10
+L	B	+	A	-	5M
+L	B	-	C	-	5M
+L	C	-	D	-	5M
+L	D	-	E	-	5M
+L	E	-	F	+	5M
+L	A	-	X1	-	5M
+L	A	-	X2	+	5M
+L	X3	+	A	+	5M
+L	X4	-	A	+	5M
+L	F	+	X5	-	5M
+L	F	+	X6	+	5M
+L	X7	+	F	-	5M
+L	X8	-	F	-	5M


=====================================
tests/testdata/linear_merging.6.merged.gfa
=====================================
@@ -0,0 +1,17 @@
+S	A_B_C_D_E_F	TTTTTCCCCCGGGGGGGGGGNCCCCCCCCCCTTTTTAAAAACCCCCGGGGGGGGGGNCCCCCCCCCCTTTTTTTTTTAAAAAGGGGGGGGGGNCCCCCCCCCCGGGGGGGGGGTTTTTTTTTTTTTTTNGGGGGGGGGGTTTTTAAAAAGGGGGGGGGGGGGGGNCCCCCCCCCCTTTTTAAAAAAAAAACCCCCCCCCCNAAAAAAAAAAAAAAATTTTT	LN:i:221
+S	X1	AAAAATTTTT	LN:i:10
+S	X2	AAAAATTTTT	LN:i:10
+S	X3	AAAAATTTTT	LN:i:10
+S	X4	AAAAATTTTT	LN:i:10
+S	X5	AAAAATTTTT	LN:i:10
+S	X6	AAAAATTTTT	LN:i:10
+S	X7	AAAAATTTTT	LN:i:10
+S	X8	AAAAATTTTT	LN:i:10
+L	A_B_C_D_E_F	+	X6	+	5M
+L	A_B_C_D_E_F	+	X8	+	5M
+L	X1	+	A_B_C_D_E_F	+	5M
+L	X2	-	A_B_C_D_E_F	+	5M
+L	X3	+	A_B_C_D_E_F	+	5M
+L	X4	-	A_B_C_D_E_F	+	5M
+L	X5	+	A_B_C_D_E_F	-	5M
+L	X7	+	A_B_C_D_E_F	-	5M



View it on GitLab: https://salsa.debian.org/med-team/gfapy/-/compare/6371fbe0eb318909cb9e28dd75a1a42b91371cde...e4735e65d3ebdc0840bc14fdd63b1a2991e99ba4

-- 
View it on GitLab: https://salsa.debian.org/med-team/gfapy/-/compare/6371fbe0eb318909cb9e28dd75a1a42b91371cde...e4735e65d3ebdc0840bc14fdd63b1a2991e99ba4
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/20211114/e94df755/attachment-0001.htm>


More information about the debian-med-commit mailing list