From 84c8ec48dc7098fdc6cc3e6497e118ce97db1c73 Mon Sep 17 00:00:00 2001 From: Erin McAuley Date: Fri, 2 Aug 2024 18:12:31 -0400 Subject: [PATCH] fix: RTD needs an `__init__.py` in `fgpyo/platform/` (#174) * refactor: add init, docs: add docstring to illumina.py * style: mkdocs docstring formatting --- fgpyo/platform/__init__.py | 0 fgpyo/platform/illumina.py | 20 ++++++++++++++++---- tests/fgpyo/platform/test_illumina.py | 2 ++ 3 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 fgpyo/platform/__init__.py diff --git a/fgpyo/platform/__init__.py b/fgpyo/platform/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/fgpyo/platform/illumina.py b/fgpyo/platform/illumina.py index 161382c2..c3c0305e 100644 --- a/fgpyo/platform/illumina.py +++ b/fgpyo/platform/illumina.py @@ -1,3 +1,15 @@ +""" +Methods for working with Illumina-specific UMIs in SAM files +------------------------------------ + +The functions in this module make it easy to: + +* check whether a UMI is valid +* extract UMI(s) from an Illumina-style read name +* copy a UMI from an alignment's read name to its `RX` SAM tag + +""" + from typing import Optional from typing import Set @@ -35,10 +47,10 @@ def extract_umis_from_read_name( read_name_delimiter: The delimiter separating the components of the read name. umi_delimiter: The delimiter separating multiple UMIs. strict: If `strict` is `True`, the read name must contain either 7 or 8 colon-separated - segments. The UMI is assumed to be the last one in the case of 8 segments and `None` - in the case of 7 segments. `strict` requires the UMI to be valid and consistent with - Illumina's allowed UMI characters. If `strict` is `False`, the last segment is returned - so long as it appears to be a valid UMI. + segments. The UMI is assumed to be the last one in the case of 8 segments and `None` + in the case of 7 segments. `strict` requires the UMI to be valid and consistent with + Illumina's allowed UMI characters. If `strict` is `False`, the last segment is returned + so long as it appears to be a valid UMI. Returns: The UMI extracted from the read name, or None if no UMI was found. Multiple UMIs are diff --git a/tests/fgpyo/platform/test_illumina.py b/tests/fgpyo/platform/test_illumina.py index c68df023..43d05324 100644 --- a/tests/fgpyo/platform/test_illumina.py +++ b/tests/fgpyo/platform/test_illumina.py @@ -1,3 +1,5 @@ +"""Basic tests for Illumina-specific UMI Methods""" + from typing import Optional import pytest