mirror of
https://github.com/biopython/biopython.git
synced 2025-10-20 05:33:47 +08:00
added test and docstring for #5053
This commit is contained in:
committed by
Peter Cock
parent
5d48cf583f
commit
f2004e04da
@ -214,6 +214,14 @@ def _parse_primers_packet(length, data, record):
|
||||
A Primers packet is similar to a Features packet but specifically
|
||||
stores primer binding features. The data is a XML string starting
|
||||
with a 'Primers' root node.
|
||||
|
||||
Within the Primers packet, a primer can have multiple BindingSite
|
||||
elements. However, not all of them are shown to the user when the file is
|
||||
opened SnapGene. This seems to depend on the HybridizationParams element, which
|
||||
stores a minimal hybridization length and Tm. When a SnapGene file is parsed,
|
||||
`primer_bind` features that do not meet the hybridization parameters are dropped,
|
||||
since they are not shown to the user when the file is opened in SnapGene.
|
||||
For more details, see #5053.
|
||||
"""
|
||||
xml = parseString(data.decode("UTF-8"))
|
||||
min_match_length = 0
|
||||
|
BIN
Tests/SnapGene/sample-hybridization-params.dna
Normal file
BIN
Tests/SnapGene/sample-hybridization-params.dna
Normal file
Binary file not shown.
@ -260,6 +260,17 @@ class TestSnapGene(unittest.TestCase):
|
||||
if "segments" in exp_feat:
|
||||
self._check_feature_segments(exp_feat["segments"], read_feat)
|
||||
|
||||
def test_filter_with_hybridization_params(self):
|
||||
"""Ensure only releveant `primer_bind` features from SnapGene files are retained in
|
||||
the `SeqRecord`. See the docstring of `_parse_primers_packet` for more details.
|
||||
"""
|
||||
record = SeqIO.read("SnapGene/sample-hybridization-params.dna", "snapgene")
|
||||
count_primer_features = 0
|
||||
for feature in record.features:
|
||||
if "XhoI-hht2(US)-Fwd" in feature.qualifiers["label"]:
|
||||
count_primer_features += 1
|
||||
self.assertEqual(count_primer_features, 1)
|
||||
|
||||
|
||||
class TestCorruptedSnapGene(unittest.TestCase):
|
||||
def setUp(self):
|
||||
|
BIN
hht2+-1000.dna
Normal file
BIN
hht2+-1000.dna
Normal file
Binary file not shown.
Reference in New Issue
Block a user