From accbd367fbcac64b912412281b7a735667575c43 Mon Sep 17 00:00:00 2001 From: JeanMainguy Date: Mon, 1 Jul 2024 19:01:26 +0200 Subject: [PATCH] add check on negative coordinates --- ppanggolin/genome.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ppanggolin/genome.py b/ppanggolin/genome.py index 57d2d04a..19359a42 100644 --- a/ppanggolin/genome.py +++ b/ppanggolin/genome.py @@ -187,7 +187,8 @@ def fill_annotations(self, start: int, stop: int, strand: str, gene_type: str = raise TypeError(f"Stop should be int. Got {type(stop_i)} instead in {self} from {self.organism}.") if stop_i < start_i: raise ValueError(f"Wrong coordinates: {coordinates}. Start ({start_i}) should not be greater than stop ({stop_i}) in {self} from {self.organism}.") - + if start_i < 1 or stop_i < 1: + raise ValueError(f"Wrong coordinates: {coordinates}. Start ({start_i}) and stop ({stop_i}) should be greater than 0 in {self} from {self.organism}.") self.start = start self.stop = stop