File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -529,6 +529,15 @@ def is_shortnull(self, allele):
529529 """
530530 return allele in self .shortnulls and self ._config ["reduce_shortnull" ]
531531
532+ def is_null (self , allele ):
533+ """
534+ Check if allele is a null allele.
535+
536+ @param allele: Allele to check for null
537+ @return: boolean indicating whether allele is null or not
538+ """
539+ return allele .endswith ("N" ) and not self .is_mac (allele )
540+
532541 def is_exp_allele (self , allele ):
533542 """
534543 Test if allele is valid as a shortening (WHO rules)
Original file line number Diff line number Diff line change @@ -186,3 +186,22 @@ def test_cache_info(self):
186186 another_ard ._redux_allele .cache_info ().maxsize , higher_cache_size
187187 )
188188 self .assertEqual (another_ard .redux .cache_info ().maxsize , higher_cache_size )
189+
190+ def test_is_null (self ):
191+ # a null allele
192+ allele = "A*01:01N"
193+ self .assertTrue (self .ard .is_null (allele ), msg = "A Null Allele" )
194+ # not null allele
195+ allele = "A*01:01"
196+ self .assertFalse (self .ard .is_null (allele ), msg = "not null allele" )
197+ # MACs ending with N shouldn't be called as Nulls
198+ allele = "A*01:MN"
199+ self .assertFalse (
200+ self .ard .is_null (allele ),
201+ msg = "MACs ending with N shouldn't be called as Nulls" ,
202+ )
203+ # MACs shouldn't be called as Nulls
204+ allele = "A*01:AB"
205+ self .assertFalse (
206+ self .ard .is_null (allele ), msg = "MACs shouldn't be called as Nulls"
207+ )
You can’t perform that action at this time.
0 commit comments