[med-svn] [Git][med-team/python-biopython][upstream] bigBed big-endian (#4670)
Étienne Mollier (@emollier)
gitlab at salsa.debian.org
Thu Mar 21 20:40:16 GMT 2024
Étienne Mollier pushed to branch upstream at Debian Med / python-biopython
Commits:
6a3c977c by Michiel de Hoon at 2024-03-18T21:43:54+01:00
bigBed big-endian (#4670)
Signed-off-by: Étienne Mollier <emollier at debian.org>
- - - - -
3 changed files:
- + Tests/Blat/bigbed_extended.bigendian.bb
- Tests/Blat/bigbed_extended.bb → Tests/Blat/bigbed_extended.littleendian.bb
- Tests/test_Align_bigbed.py
Changes:
=====================================
Tests/Blat/bigbed_extended.bigendian.bb
=====================================
Binary files /dev/null and b/Tests/Blat/bigbed_extended.bigendian.bb differ
=====================================
Tests/Blat/bigbed_extended.bb → Tests/Blat/bigbed_extended.littleendian.bb
=====================================
=====================================
Tests/test_Align_bigbed.py
=====================================
@@ -2240,8 +2240,9 @@ table bed
class TestAlign_extended_bed(unittest.TestCase):
- # The bigBed file bigbed_extended.bb is a BED9+2 file, with nine predefined
- # BED fields and 2 extra (custom) fields. It was created by running
+ # The bigBed files bigbed_extended.littleendian.bb and
+ # bigbed_extended.bigendian.bb are BED9+2 files, with nine predefined BED
+ # fields and 2 extra (custom) fields. It was created by running
#
# bedToBigBed -as=bedExample2.as -type=bed9+2 -extraIndex=name,geneSymbol bedExample2.bed hg18.chrom.sizes bigbed_extended.bb
#
@@ -2251,12 +2252,23 @@ class TestAlign_extended_bed(unittest.TestCase):
# and bedExample2.as the associated AutoSQL file, also downloaded from UCSC
# (https://genome.ucsc.edu/goldenPath/help/examples/bedExample2.as)
# declaring the nine predefined BED fields and the two extra fields
-
- path = "Blat/bigbed_extended.bb"
+ #
+ # The bigBed file bigbed_extended.littleendian.bb was generated on a
+ # little-endian machine; the bigBed file bigbed_extended.bigendian.bb was
+ # generated on a big-endian machine.
def test_reading(self):
"""Test parsing bigbed_extended.bb."""
- alignments = Align.parse(self.path, "bigbed")
+ path = "Blat/bigbed_extended.littleendian.bb"
+ alignments = Align.parse(path, "bigbed")
+ self.assertEqual(alignments.byteorder, "<")
+ self.check_alignments(alignments)
+ path = "Blat/bigbed_extended.bigendian.bb"
+ alignments = Align.parse(path, "bigbed")
+ self.assertEqual(alignments.byteorder, ">")
+ self.check_alignments(alignments)
+
+ def check_alignments(self, alignments):
self.assertEqual(
str(alignments.declaration),
"""\
@@ -2482,9 +2494,11 @@ table hg18KGchr7
def test_writing(self):
"""Test writing bigbed_extended.bb."""
- with open(self.path, "rb") as stream:
+ byteorder = sys.byteorder # "little" or "big"
+ path = f"Blat/bigbed_extended.{byteorder}endian.bb"
+ with open(path, "rb") as stream:
correct = stream.read()
- alignments = Align.parse(self.path, "bigbed")
+ alignments = Align.parse(path, "bigbed")
with open("Blat/bedExample2.as") as stream:
autosql_data = stream.read()
declaration = bigbed.AutoSQLTable.from_string(autosql_data)
@@ -2501,7 +2515,7 @@ table hg18KGchr7
output.seek(0)
data = output.read()
self.assertEqual(correct, data)
- alignments = Align.parse(self.path, "bigbed")
+ alignments = Align.parse(path, "bigbed")
targets = alignments.targets
with tempfile.TemporaryFile() as output:
Align.write(
View it on GitLab: https://salsa.debian.org/med-team/python-biopython/-/commit/6a3c977ca14978d9f96ea22f0a2806f4478323b9
--
View it on GitLab: https://salsa.debian.org/med-team/python-biopython/-/commit/6a3c977ca14978d9f96ea22f0a2806f4478323b9
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/20240321/e63a060e/attachment-0001.htm>
More information about the debian-med-commit
mailing list