294
297
{ "prot_names", Qual_class_protnames },
295
298
{ "protein_id", Qual_class_seq_id },
296
299
{ "pseudo", Qual_class_boolean },
300
{ "pyrrolysine", Qual_class_boolean },
301
{ "pyrrolysine", Qual_class_string },
297
302
{ "region", Qual_class_region },
298
303
{ "region_name", Qual_class_string },
299
304
{ "replace", Qual_class_replace },
321
326
{ "transposon", Qual_class_quote },
322
327
{ "trans_splicing", Qual_class_boolean },
323
328
{ "trna_aa", Qual_class_ignore },
329
{ "codon_recognized", Qual_class_trna_codons },
324
330
{ "trna_codons", Qual_class_trna_codons },
325
331
{ "usedin", Qual_class_usedin },
326
332
{ "xtra_products", Qual_class_xtraprds }
1598
1608
if (oip == NULL || ufp->data.ptrvalue == NULL) continue;
1599
1609
if (StringCmp (oip->str, "Method") == 0) {
1600
1610
method = StringSaveNoNull ((CharPtr) ufp->data.ptrvalue);
1602
if (StringCmp (oip->str, "mRNA") == 0) {
1611
} else if (StringCmp (oip->str, "mRNA") == 0) {
1603
1612
for (u = (UserFieldPtr) ufp->data.ptrvalue; u != NULL; u = u->next) {
1604
1613
if (u->data.ptrvalue == NULL) continue;
1605
1614
for (uu = (UserFieldPtr) u->data.ptrvalue; uu != NULL; uu = uu->next) {
1644
} else if (StringCmp (oip->str, "Counts") == 0) {
1646
for (u = (UserFieldPtr) ufp->data.ptrvalue; u != NULL; u = u->next) {
1647
if (u->data.ptrvalue == NULL) continue;
1648
if (u->choice != 2) continue;
1650
if (oip == NULL) continue;
1651
if (StringCmp (oip->str, "mRNA") == 0) {
1652
cm = (Int2) u->data.intvalue;
1653
} else if (StringCmp (oip->str, "EST") == 0) {
1654
ce = (Int2) u->data.intvalue;
1655
} else if (StringCmp (oip->str, "Protein") == 0) {
1656
cp = (Int2) u->data.intvalue;
1638
1668
len = StringLen (mrnaevtext1) + StringLen (mrnaevtext2) + StringLen (mrnaevtext3) + StringLen (method) + 80;
1639
1669
str = (CharPtr) MemNew (len);
1640
1670
if (str == NULL) return;
3256
case Qual_class_trna_codons :
3257
trna = qvp [idx].trp;
3259
numcodons = ComposeCodonsRecognizedString (trna, numbuf, sizeof (numbuf));
3260
if (numcodons < 1 || StringHasNoText (numbuf)) {
3262
FFAddTextToString(ffstring, "/", "codon_recognized", "=\"",
3263
FALSE, TRUE, TILDE_IGNORE);
3264
FFAddOneString(ffstring, numbuf, FALSE, TRUE, TILDE_TO_SPACES);
3265
FFAddOneChar(ffstring, '\"', FALSE);
3266
FFAddOneChar(ffstring, '\n', FALSE);
3203
3271
case Qual_class_codon :
3204
3272
gbq = qvp [idx].gbq;
3205
3273
if (gbq == NULL || (ajp->flags.dropIllegalQuals && (! AllowedValQual (featdeftype, idx)))) break;
3246
3314
pmid = (Int4) vnp->data.intvalue;
3247
3315
if (pmid > 0) {
3248
3316
sprintf (numbuf, "%ld", (long) pmid);
3317
FFAddOneString(ffstring, "/citation=[PUBMED ", FALSE, TRUE, TILDE_TO_SPACES);
3320
FFAddTextToString(ffstring, "<a href=", link_muid, NULL, FALSE, FALSE, TILDE_IGNORE);
3321
FFAddTextToString(ffstring, NULL, numbuf, ">", FALSE, FALSE, TILDE_IGNORE);
3322
FFAddOneString(ffstring, numbuf, FALSE, FALSE, TILDE_IGNORE);
3323
FFAddOneString(ffstring, "</a>", FALSE, FALSE, TILDE_IGNORE);
3325
FFAddOneString(ffstring, numbuf, FALSE, FALSE, TILDE_IGNORE);
3327
FFAddOneString(ffstring, "]", FALSE, FALSE, TILDE_IGNORE);
3249
3329
FFAddTextToString(ffstring, "/citation=[PUBMED ", numbuf, "]",
3250
3330
FALSE, TRUE, TILDE_TO_SPACES);
3251
3332
FFAddOneChar(ffstring, '\n', FALSE);
3315
3396
FFAddOneString(ffstring, "/db_xref=\"", FALSE, FALSE, TILDE_IGNORE);
3316
FF_www_db_xref(ajp, ffstring, dbt->db, buf);
3397
FF_www_db_xref(ajp, ffstring, dbt->db, buf, bsp);
3317
3398
FFAddOneString(ffstring, "\"\n", FALSE, FALSE, TILDE_IGNORE);
3357
3438
sprintf (seqid, "%ld", (long) sip->data.intvalue);
3358
3439
FFAddOneString(ffstring, "/db_xref=\"", FALSE, FALSE, TILDE_IGNORE);
3359
FF_www_db_xref(ajp, ffstring, "GI", seqid);
3440
FF_www_db_xref(ajp, ffstring, "GI", seqid, bsp);
3360
3441
FFAddOneString(ffstring, "\"\n", FALSE, FALSE, TILDE_IGNORE);
3361
3442
} else if (sip->choice == SEQID_GENERAL) {
3362
3443
dbt = (DbtagPtr) sip->data.ptrvalue;
3388
3469
if (sip->choice == SEQID_GI) {
3389
3470
gi = sip->data.intvalue;
3390
3471
if (GetAccnVerFromServer (gi, seqid)) {
3473
if (getenv ("ASN2GB_PSF_DEBUG") != NULL) {
3474
printf ("GetAccnVerFromServer returned %s\n", seqid);
3391
3477
if ((! ajp->flags.dropIllegalQuals) || ValidateAccn (seqid) == 0) {
3392
3478
FFAddTextToString(ffstring, "/", asn2gnbk_featur_quals [idx].name, "=\"",
3393
3479
FALSE, FALSE, TILDE_IGNORE);
3400
3486
sip = GetSeqIdForGI (gi);
3401
3487
if (sip != NULL && SeqIdWrite (sip, seqid, PRINTID_TEXTID_ACC_VER, sizeof (seqid)) != NULL) {
3489
if (getenv ("ASN2GB_PSF_DEBUG") != NULL) {
3490
printf ("GetSeqIdForGI returned %s\n", seqid);
3402
3493
if ((! ajp->flags.dropIllegalQuals) || ValidateAccn (seqid) == 0) {
3403
3494
FFAddTextToString(ffstring, "/", asn2gnbk_featur_quals [idx].name, "=\"",
3404
3495
FALSE, FALSE, TILDE_IGNORE);
3421
3512
sprintf (seqid, "%ld", (long) gi);
3422
3513
FFAddOneString(ffstring, "/db_xref=\"", FALSE, FALSE, TILDE_IGNORE);
3423
FF_www_db_xref(ajp, ffstring, "GI", seqid);
3514
FF_www_db_xref(ajp, ffstring, "GI", seqid, bsp);
3424
3515
FFAddOneString(ffstring, "\"\n", FALSE, FALSE, TILDE_IGNORE);
3425
3516
} else if (SeqIdWrite (sip, seqid, PRINTID_TEXTID_ACC_VER, sizeof (seqid)) != NULL) {
3426
3517
if ((! ajp->flags.dropIllegalQuals) || ValidateAccn (seqid) == 0) {
3437
3528
sprintf (seqid, "%ld", (long) gi);
3438
3529
FFAddOneString(ffstring, "/db_xref=\"", FALSE, FALSE, TILDE_IGNORE);
3439
FF_www_db_xref(ajp, ffstring, "GI", seqid);
3530
FF_www_db_xref(ajp, ffstring, "GI", seqid, bsp);
3440
3531
FFAddOneString(ffstring, "\"\n", FALSE, FALSE, TILDE_IGNORE);
3485
3576
if (! StringHasNoText (str)) {
3577
if (ajp->mode == RELEASE_MODE || ajp->mode == ENTREZ_MODE) {
3486
3580
FFAddTextToString(ffstring, "/translation=\"", str, "\"",
3487
3581
FALSE, TRUE, TILDE_TO_SPACES);
3488
3582
FFAddOneChar(ffstring, '\n', FALSE);
3510
3604
SeqPortStreamLoc (sfp->product, STREAM_EXPAND_GAPS | STREAM_CORRECT_INVAL, (Pointer) &protein_seq, SaveGBSeqSequence);
3511
3605
if (! StringHasNoText (str)) {
3606
if (ajp->mode == RELEASE_MODE || ajp->mode == ENTREZ_MODE) {
3512
3609
FFAddTextToString(ffstring, "/translation=\"", str, "\"",
3513
3610
FALSE, TRUE, TILDE_TO_SPACES);
3514
3611
FFAddOneChar(ffstring, '\n', FALSE);
4155
4259
gi = (Int4) sip->data.intvalue;
4263
if (sfp->id.choice == 3) {
4264
oip = (ObjectIdPtr) sfp->id.value.ptrvalue;
4265
if (oip != NULL && oip->str == NULL) {
4269
if (slp->choice == SEQLOC_INT) {
4270
sintp = (SeqIntPtr) slp->data.ptrvalue;
4271
if (sintp != NULL) {
4272
ffrom = sintp->from + 1;
4273
fto = sintp->to + 1;
4275
if (sip->choice == SEQID_GI) {
4276
gi = (Int4) sip->data.intvalue;
4160
sprintf(gi_buf, "%ld", (long)gi);
4161
sprintf(itemID_buf, "%ld", (long)itemID);
4282
sprintf (gi_buf, "%ld", (long)gi);
4164
4284
FFAddOneString(ffstring, "<a href=", FALSE, FALSE, TILDE_IGNORE);
4165
4285
FFAddOneString(ffstring, link_feat, FALSE, FALSE, TILDE_IGNORE);
4166
4286
FFAddOneString(ffstring, "val=", FALSE, FALSE, TILDE_IGNORE);
4167
4287
FFAddOneString(ffstring, gi_buf, FALSE, FALSE, TILDE_IGNORE);
4289
sprintf (buf, "%ld", (long) featID);
4290
FFAddOneString(ffstring, "&featID=", FALSE, FALSE, TILDE_IGNORE);
4291
FFAddOneString(ffstring, buf, FALSE, FALSE, TILDE_IGNORE);
4292
} else if (ffrom > 0 && fto > 0) {
4293
sprintf (buf, "%ld", (long) ffrom);
4294
FFAddOneString(ffstring, "&from=", FALSE, FALSE, TILDE_IGNORE);
4295
FFAddOneString(ffstring, buf, FALSE, FALSE, TILDE_IGNORE);
4296
sprintf (buf, "%ld", (long) fto);
4297
FFAddOneString(ffstring, "&to=", FALSE, FALSE, TILDE_IGNORE);
4298
FFAddOneString(ffstring, buf, FALSE, FALSE, TILDE_IGNORE);
4299
} else if (itemID > 0) {
4300
sprintf (buf, "%ld", (long) itemID);
4169
4301
FFAddOneString(ffstring, "&itemID=", FALSE, FALSE, TILDE_IGNORE);
4170
FFAddOneString(ffstring, itemID_buf, FALSE, FALSE, TILDE_IGNORE);
4302
FFAddOneString(ffstring, buf, FALSE, FALSE, TILDE_IGNORE);
4387
4548
"nonconsensus splice site",
4388
4549
"modified codon recognition",
4389
4550
"alternative start codon",
4390
4552
"unclassified transcription discrepancy",
4391
4553
"unclassified translation discrepancy",
4392
4554
"mismatches in transcription",
4393
4555
"mismatches in translation",
4556
"adjusted for low-quality genome",
4591
4754
*bad_inferenceP = bad;
4757
typedef struct geneprot {
4761
} GeneProtData, PNTR GeneProtPtr;
4763
static void CheckGeneOnIsolatedProtein (
4771
if (sfp == NULL || sfp->data.choice != SEQFEAT_GENE) return;
4772
gpp = (GeneProtPtr) userdata;
4773
if (gpp == NULL) return;
4775
if (SeqLocAinB (gpp->cds->location, sfp->location) < 0) return;
4776
if (gpp->gene != NULL) {
4783
static SeqFeatPtr FindGeneOnIsolatedProtein (
4791
if (sep == NULL || cds == NULL) return NULL;
4793
MemSet ((Pointer) &gpd, 0, sizeof (GeneProtData));
4795
VisitFeaturesInSep (sep, (Pointer) &gpd, CheckGeneOnIsolatedProtein);
4797
if (gpd.failed) return NULL;
4594
4802
static SeqFeatPtr GetOverlappingGeneInEntity (
4595
4803
Uint2 entityID,
4596
4804
SeqMgrFeatContextPtr fcontext,
4648
gene = SeqMgrGetOverlappingGene (locforgene, gcontext);
4856
if (fcontext->bad_order || fcontext->mixed_strand) {
4857
gene = SeqMgrGetOverlappingFeature (locforgene, FEATDEF_GENE, NULL, 0, NULL, LOCATION_SUBSET, gcontext);
4859
gene = SeqMgrGetOverlappingGene (locforgene, gcontext);
4650
4862
SeqEntrySetScope (oldscope);
4884
5101
is_other = TRUE;
4887
featdeftype = fcontext->featdeftype;
5104
featdeftype = fcontext->featdeftype;
4888
5106
if (featdeftype < FEATDEF_GENE || featdeftype >= FEATDEF_MAX) {
4889
5107
featdeftype = FEATDEF_BAD;
5109
if (featdeftype == 0) {
5110
featdeftype = sfp->idx.subtype;
4891
5112
key = FindKeyFromFeatDefType (featdeftype, TRUE);
5114
seqfeattype = fcontext->seqfeattype;
5115
if (seqfeattype == 0) {
5116
seqfeattype = sfp->data.choice;
4893
5119
if (format == GENPEPT_FMT && isProt) {
4894
5120
if (featdeftype == FEATDEF_REGION) {
4895
5121
key = "Region";
4926
5152
FFStartPrint(ffstring, format, 5, 21, NULL, 0, 5, 21, "FT", /* ifp->firstfeat */ FALSE);
4927
5153
if (ajp->ajp.slp != NULL) {
4928
5154
FFAddOneString(ffstring, key, FALSE, FALSE, TILDE_IGNORE);
4929
} else if ( GetWWW(ajp) /* && SeqMgrGetParentOfPart (bsp, NULL) == NULL */ ) {
4930
FF_asn2gb_www_featkey (ffstring, key, sfp->location, fcontext->left + 1, fcontext->right + 1, fcontext->strand, itemID);
5155
} else if ( GetWWW(ajp) && StringICmp (key, "gap") != 0 /* && SeqMgrGetParentOfPart (bsp, NULL) == NULL */ ) {
5156
FF_asn2gb_www_featkey (ffstring, key, sfp, fcontext->left + 1, fcontext->right + 1, fcontext->strand, itemID);
4932
5158
FFAddOneString(ffstring, key, FALSE, FALSE, TILDE_IGNORE);
4973
5199
if (gbseq != NULL) {
4974
5200
if (gbfeat != NULL) {
4975
5201
gbfeat->location = StringSave (str);
5202
if (StringDoesHaveText (str)) {
5203
if (StringStr (str, "join") != NULL) {
5204
gbfeat->operator__ = StringSave ("join");
5205
} else if (StringStr (str, "order") != NULL) {
5206
gbfeat->operator__ = StringSave ("order");
5209
gbfeat->partial5 = fcontext->partialL;
5210
gbfeat->partial3 = fcontext->partialR;
4976
5211
if (ajp->masterStyle) {
4977
5212
AddIntervalsToGbfeat (gbfeat, location, target);
5091
5326
gene_for_old_locus_tag = SeqMgrGetFeatureByLabel (bsp_for_old_locus_tag, grp->locus_tag, SEQFEAT_GENE, 0, &gcontext);
5094
if (grp == NULL && fcontext->featdeftype != FEATDEF_primer_bind) {
5329
if (grp == NULL && ifp->mapToNuc && cds != NULL) {
5330
grp = SeqMgrGetGeneXref (cds);
5332
if (grp == NULL && featdeftype != FEATDEF_primer_bind) {
5095
5333
gene = GetOverlappingGeneInEntity (ajp->ajp.entityID, fcontext, &gcontext, locforgene);
5096
5334
if (gene == NULL && ajp->ajp.entityID != sfp->idx.entityID) {
5097
5335
gene = GetOverlappingGeneInEntity (sfp->idx.entityID, fcontext, &gcontext, locforgene);
5338
/* special case to get gene by overlap for coded_by cds on isolated protein bioseq */
5339
if (ifp->mapToProt && seqfeattype == SEQFEAT_CDREGION) {
5340
sep = GetTopSeqEntryForEntityID (ajp->ajp.entityID);
5341
if (sep != NULL && IS_Bioseq (sep)) {
5342
bsp = (BioseqPtr) sep->data.ptrvalue;
5343
if (bsp != NULL && ISA_aa (bsp->mol)) {
5344
gene = FindGeneOnIsolatedProtein (sep, sfp);
5099
5349
gene_for_old_locus_tag = gene;
5100
5350
if (gene != NULL) {
5101
5351
qvp [FTQUAL_gene_note].str = gene->comment;
5135
5385
if (grp != NULL &&
5136
fcontext->featdeftype != FEATDEF_variation &&
5137
fcontext->featdeftype != FEATDEF_repeat_region) {
5386
featdeftype != FEATDEF_variation &&
5387
featdeftype != FEATDEF_repeat_region) {
5138
5388
qvp [FTQUAL_gene_allele].str = grp->allele; /* now propagating /allele */
5140
if (gene_for_old_locus_tag != NULL && fcontext->featdeftype != FEATDEF_repeat_region) {
5390
if (gene_for_old_locus_tag != NULL && featdeftype != FEATDEF_repeat_region) {
5141
5391
/* now propagate old_locus_tag to almost any underlying feature */
5142
5392
for (gbq = gene_for_old_locus_tag->qual; gbq != NULL; gbq = gbq->next) {
5143
5393
if (StringHasNoText (gbq->val)) continue;
5144
5394
idx = GbqualToFeaturIndex (gbq->qual);
5145
5395
if (idx == FTQUAL_old_locus_tag) {
5146
5396
qvp [FTQUAL_old_locus_tag].gbq = gbq;
5397
break; /* record first old_locus_tag gbqual to display all */
5150
if (fcontext->seqfeattype != SEQFEAT_CDREGION &&
5151
fcontext->seqfeattype != SEQFEAT_RNA) {
5401
if (seqfeattype != SEQFEAT_CDREGION && seqfeattype != SEQFEAT_RNA) {
5152
5402
qvp [FTQUAL_gene_xref].vnp = NULL;
5154
if (fcontext->featdeftype != FEATDEF_operon) {
5404
if (featdeftype != FEATDEF_operon) {
5155
5405
grp = SeqMgrGetGeneXref (sfp);
5156
5406
if (grp == NULL || (! SeqMgrGeneIsSuppressed (grp))) {
5157
5407
operon = SeqMgrGetOverlappingOperon (locforgene, &ocontext);
5684
5963
sap = fcontext->sap;
5685
5964
if (sap != NULL) {
5965
annotDescCommentToComment = FALSE;
5686
5966
for (adp = sap->desc; adp != NULL; adp = adp->next) {
5687
5967
if (adp->choice == Annot_descr_comment) {
5688
5968
if (StringDoesHaveText ((CharPtr) adp->data.ptrvalue)) {
5689
5969
qvp [FTQUAL_seqannot_note].str = (CharPtr) adp->data.ptrvalue;
5971
} else if (adp->choice == Annot_descr_user) {
5972
uop = (UserObjectPtr) adp->data.ptrvalue;
5973
if (uop == NULL) continue;
5975
if (oip == NULL) continue;
5976
if (StringCmp (oip->str, "AnnotDescCommentPolicy") == 0) {
5977
for (ufp = uop->data; ufp != NULL; ufp = ufp->next) {
5979
if (oip == NULL || ufp->data.ptrvalue == NULL) continue;
5980
if (StringCmp (oip->str, "Policy") == 0) {
5981
if (StringICmp ((CharPtr) ufp->data.ptrvalue, "ShowInComment") == 0) {
5982
annotDescCommentToComment = TRUE;
5989
if (annotDescCommentToComment) {
5990
qvp [FTQUAL_seqannot_note].str = NULL;
5695
5994
/* if RELEASE_MODE, check list of features that can have /pseudo */
5697
5996
if (ajp->flags.dropIllegalQuals && pseudo &&
5698
(fcontext->seqfeattype == SEQFEAT_RNA || fcontext->seqfeattype == SEQFEAT_IMP) ) {
5997
(seqfeattype == SEQFEAT_RNA || seqfeattype == SEQFEAT_IMP) ) {
5699
5998
switch (featdeftype) {
5701
6000
case FEATDEF_allele: