Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 25, 2023
1 parent 814c329 commit 33b7b88
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
8 changes: 3 additions & 5 deletions src/genomicranges/Seqinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,11 +315,9 @@ def __len__(self) -> int:


def merge_Seqinfo(objects: List[Seqinfo]) -> Seqinfo:
"""
Merge multiple :py:class:`~Seqinfo` objects, taking the union of all
reference sequences. If the same reference sequence is present with the
same details across ``objects``, only a single instance is present in the
final object; if details are contradictory, they are replaced with None.
"""Merge multiple :py:class:`~Seqinfo` objects, taking the union of all reference sequences. If the same reference
sequence is present with the same details across ``objects``, only a single instance is present in the final object;
if details are contradictory, they are replaced with None.
Args:
objects: List of ``Seqinfo`` objects.
Expand Down
28 changes: 14 additions & 14 deletions tests/test_Seqinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ def test_create_Seqinfo():
}

seq2 = seq.set_genome(None)
assert seq2.genome() == [ None ] * 3
assert seq2.genome(as_dict=True) == { "chr1": None, "chr2": None, "chr3": None}
assert seq2.genome() == [None] * 3
assert seq2.genome(as_dict=True) == {"chr1": None, "chr2": None, "chr3": None}


def test_merge_Seqinfo():
seq = Seqinfo(
seqnames = [ "chr1", "chr2", "chr3" ],
seqlengths = range(100, 103),
is_circular = [False, True, False],
genome = "hg19"
seqnames=["chr1", "chr2", "chr3"],
seqlengths=range(100, 103),
is_circular=[False, True, False],
genome="hg19",
)

combined = merge_Seqinfo([seq, seq])
Expand All @@ -56,14 +56,14 @@ def test_merge_Seqinfo():
assert combined.genome() == seq.genome()

seq2 = Seqinfo(
seqnames = [ "chr3", "chr4", "chr5" ],
seqlengths = range(100, 103),
is_circular = [False, True, False],
genome = "hg38"
seqnames=["chr3", "chr4", "chr5"],
seqlengths=range(100, 103),
is_circular=[False, True, False],
genome="hg38",
)

combined = merge_Seqinfo([seq, seq2])
assert combined.seqnames() == [ "chr1", "chr2", "chr3", "chr4", "chr5" ]
assert combined.seqlengths() == [ 100, 101, None, 101, 102 ]
assert combined.is_circular() == [ False, True, False, True, False ]
assert combined.genome() == [ "hg19", "hg19", None, "hg38", "hg38" ]
assert combined.seqnames() == ["chr1", "chr2", "chr3", "chr4", "chr5"]
assert combined.seqlengths() == [100, 101, None, 101, 102]
assert combined.is_circular() == [False, True, False, True, False]
assert combined.genome() == ["hg19", "hg19", None, "hg38", "hg38"]

0 comments on commit 33b7b88

Please sign in to comment.