Closed sandain closed 2 years ago
I got it to work with the following changes:
--- a/func.py 2022-10-07 18:43:07.732793417 -0500
+++ b/func.py 2022-10-07 18:40:47.295190378 -0500
@@ -645,7 +645,7 @@
from collections import defaultdict, deque
import sys
annos = defaultdict(dict)
- acceptlist = {'mrna', 'cds'}
+ acceptlist = {'gene', 'cds'}
featwarn = True
skipchr = []
chrs = set(chrlengths[0][1].keys())
@@ -654,6 +654,8 @@
model = None
for line in fin:
line = line.strip().split()
+ if not line:
+ continue
if line[0] not in chrs:
if line[0] not in skipchr:
skipchr.append(line[0])
@@ -672,7 +674,7 @@
sys.exit()
if model is not None:
- if t == 'mrna':
+ if t == 'gene':
k = list(model.keys())[0]
annos[k[0]][(k[1], k[2])] = model.values()
model = defaultdict()
@@ -682,7 +684,7 @@
model[cse].append((int(line[3]), int(line[4])))
elif model is None:
if t == 'cds':
- self.logger.error("In GFF: {} at line {}, CDS feature is before the mRNA feature. Expected mRNA before CDS. Exiting.".format(self.f, line))
+ self.logger.error("In GFF: {} at line {}, CDS feature is before the gene feature. Expected gene before CDS. Exiting.".format(self.f, line))
sys.exit()
else:
model = defaultdict()
I don't know if swapping mRNA for gene is appropriate in all cases, but it works for me.
There is a second fix in that patch -- ignore blank lines.
Hi Jason,
Thanks for checking this out. Indeed, this could work for cases when the GFF file do not have the mRNA field. Alternatively, it is also possible to edit the gff file to substitute gene
to 'mRNA`. That might be easier as well.
I'm trying to add gene annotation to my plot, and I get the following error about missing mRNA:
Here is the tracks file:
HG316453.2.gff was downloaded from Genbank and does not include mRNA: https://eutils.ncbi.nlm.nih.gov/sviewer/viewer.cgi?retmode=text&id=HG316453.2&db=nucleotide&report=gff3
Is it possible to have plotsr add gene annotation without mRNA, or do I need to find a different source for my annotation? Note that the plot works just fine if I don't try to include the annotation track.
Thank you.