diff --git a/lib/galaxy/config/sample/datatypes_conf.xml.sample b/lib/galaxy/config/sample/datatypes_conf.xml.sample index f0f96237e80b..315525bc6183 100644 --- a/lib/galaxy/config/sample/datatypes_conf.xml.sample +++ b/lib/galaxy/config/sample/datatypes_conf.xml.sample @@ -361,6 +361,7 @@ + @@ -1079,6 +1080,7 @@ + diff --git a/lib/galaxy/datatypes/binary.py b/lib/galaxy/datatypes/binary.py index 853a6e402977..4bcb3f8488a5 100644 --- a/lib/galaxy/datatypes/binary.py +++ b/lib/galaxy/datatypes/binary.py @@ -3759,6 +3759,31 @@ def sniff(self, filename: str) -> bool: return Fast5Archive.sniff(self, filename) +class Pod5(Binary): + """ + Class describing a POD5 file. The POD5 Format Specification is at + https://pod5-file-format.readthedocs.io/en/latest/SPECIFICATION.html + + >>> from galaxy.datatypes.sniff import get_test_fname + >>> fname = get_test_fname('test.pod5') + >>> Pod5().sniff(fname) + True + >>> fname = get_test_fname('test.fast5.tar') + >>> Pod5().sniff(fname) + False + """ + + file_ext = "pod5" + + def sniff(self, filename: str) -> bool: + expected_signature = bytes([0x8B, 0x50, 0x4F, 0x44, 0x0D, 0x0A, 0x1A, 0x0A]) + with open(filename, "rb") as f: + first_8_bytes = f.read(8) + f.seek(-8, 2) + last_8_bytes = f.read(8) + return first_8_bytes == expected_signature and last_8_bytes == expected_signature + + class SearchGuiArchive(CompressedArchive): """Class describing a SearchGUI archive""" diff --git a/lib/galaxy/datatypes/test/test.pod5 b/lib/galaxy/datatypes/test/test.pod5 new file mode 100644 index 000000000000..0e62d3624220 Binary files /dev/null and b/lib/galaxy/datatypes/test/test.pod5 differ