64d224c975cf63ad9f784e522ee6782cfe144abd markd Mon Feb 22 12:52:50 2021 -0800 fixed gff3ToGenePred -refseqHacks to not SEGV on a CDS without a Name parameter diff --git src/hg/utils/gff3ToGenePred/gff3ToGenePred.c src/hg/utils/gff3ToGenePred/gff3ToGenePred.c index 465a3a0..0d35697 100644 --- src/hg/utils/gff3ToGenePred/gff3ToGenePred.c +++ src/hg/utils/gff3ToGenePred/gff3ToGenePred.c @@ -265,31 +265,31 @@ { return sameString(mrna->type, gff3FeatGene) && (mrna->children != NULL) && (sameString(mrna->children->ann->type, gff3FeatCDS)); } static char* refSeqHacksFindName(struct gff3Ann* mrna) /* return the value to use for the genePred name field under refSeqHacks * rules. */ { // if this is a gene with CDS child, the get the id out of the CDS if it looks like // a refseq accession if (isGeneWithCdsChildCase(mrna)) { // is name something like YP_203370.1 (don't try too hard) struct gff3Ann *cds = mrna->children->ann; - if ((strlen(cds->name) > 4) && isupper(cds->name[0]) && isupper(cds->name[1]) + if ((cds->name != NULL) && (strlen(cds->name) > 4) && isupper(cds->name[0]) && isupper(cds->name[1]) && (cds->name[2] == '_') && isdigit(cds->name[3])) return cds->name; } return NULL; } static char* getRnaName(struct gff3Ann* mrna) /* return the value to use for the genePred name field */ { char *name = NULL; if (rnaNameAttr != NULL) { struct gff3Attr *attr = gff3AnnFindAttr(mrna, rnaNameAttr); if (attr != NULL) name = attr->vals->name;