From 5919107ac0b961e0b67bf4ba629d2db72e30e69d Mon Sep 17 00:00:00 2001 From: Jacques Dainat Date: Mon, 7 Oct 2019 21:17:55 +0200 Subject: [PATCH] raise an error and stop when we meet a CDS wihtout strand. Fix #42 --- EMBLmyGFF3/modules/feature.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/EMBLmyGFF3/modules/feature.py b/EMBLmyGFF3/modules/feature.py index f4f9f2e..7e5eab4 100755 --- a/EMBLmyGFF3/modules/feature.py +++ b/EMBLmyGFF3/modules/feature.py @@ -251,6 +251,16 @@ def _infer_ORFs(self, feature): # basic info strand = self.location.strand + # raise an error if no strand for the CDS. Strand is not mandatory (can be a dot) except for CDS where it has an + # impact on the translation, and to check where is start and stop codon... + if strand == None: + ID='' + for qualifier in self.feature.qualifiers: + if 'id' == qualifier.lower(): + ID = "%s" % " ".join(self.feature.qualifiers[qualifier]) + break + logging.error('CDS %s does not have any strand! Please check your gff file.' % ID) + sys.exit() if start_codon.upper() not in codon_table.start_codons: self.location = self._set_before(self.location)