2275
2281
for (sip = bsp->id; sip != NULL; sip = sip->next) {
2276
2282
if (sip->choice == SEQID_GENBANK ||
2277
2283
sip->choice == SEQID_EMBL ||
2278
sip->choice == SEQID_DDBJ) {
2284
sip->choice == SEQID_DDBJ ||
2285
sip->choice == SEQID_TPG ||
2286
sip->choice == SEQID_TPE ||
2287
sip->choice == SEQID_TPD) {
2279
2288
tsip = (TextSeqIdPtr) sip->data.ptrvalue;
2280
2289
if (tsip != NULL && tsip->accession != NULL) {
2281
2290
acclen = StringLen (tsip->accession);
2314
2323
sdp = SeqMgrGetNextDescriptor (bsp, NULL, Seq_descr_molinfo, &dcontext);
2315
2324
if (sdp != NULL) {
2316
2325
mip = (MolInfoPtr) sdp->data.ptrvalue;
2317
if (mip != NULL && mip->tech == MI_TECH_wgs) {
2327
if (mip->tech == MI_TECH_wgs) {
2329
} else if (mip->tech == MI_TECH_other && StringCmp (mip->techexp, "cage") == 0) {
2373
AddLocusBlock (awp, willshowwgs, willshowgenome, willshowcontig, willshowsequence);
2388
AddLocusBlock (awp, willshowwgs, willshowcage, willshowgenome, willshowcontig, willshowsequence);
2375
2390
if (awp->format == GENBANK_FMT || awp->format == GENPEPT_FMT) {
3737
3757
MakeGapFeatsBase (bsp, userdata, FALSE);
3760
static CharPtr gapstr1 = " gap ";
3761
static CharPtr gapstr2 = " /estimated_length=";
3762
static CharPtr gapstr3 = "unknown";
3764
static void MakeFarGapFeats (
3772
ValNodePtr PNTR fargaps;
3775
Boolean notFar = FALSE;
3780
if (bsp == NULL || bsp->repr != Seq_repr_delta) return;
3781
fargaps = (ValNodePtr PNTR) userdata;
3782
if (fargaps == NULL) return;
3783
sip = SeqIdFindBest (bsp->id, 0);
3784
if (sip == NULL) return;
3785
/* no longer suppress on far delta contigs */
3786
/* if (! DeltaLitOnly (bsp)) return; */
3788
/* empty string at beginning for GetFeatsOnSeg to skip over */
3789
ValNodeAddPointer (fargaps, 0, NULL);
3791
for (vnp = (ValNodePtr)(bsp->seq_ext); vnp != NULL; vnp = vnp->next) {
3792
if (vnp->choice == 1) {
3793
slp = (SeqLocPtr) vnp->data.ptrvalue;
3794
if (slp == NULL) continue;
3795
currpos += SeqLocLen (slp);
3797
if (vnp->choice == 2) {
3798
litp = (SeqLitPtr) vnp->data.ptrvalue;
3799
if (litp == NULL) continue;
3800
if (litp->seq_data == NULL || litp->seq_data_type == Seq_code_gap) {
3801
if (litp->length > 0) {
3803
if (fuzz != NULL && fuzz->choice == 4 && fuzz->a == 0) {
3804
sprintf (buf, "%s%ld..%ld\n%s%s\n",
3805
gapstr1, (long) currpos + 1, (long) currpos + litp->length,
3808
sprintf (buf, "%s%ld..%ld\n%s%ld\n",
3809
gapstr1, (long) currpos + 1, (long) currpos + litp->length,
3810
gapstr2, (long) litp->length);
3812
ValNodeCopyStr (fargaps, 0, (Pointer) buf);
3817
currpos += litp->length;
3822
for (vnp = *fargaps; vnp != NULL; vnp = vnp->next) {
3828
typedef struct featpolicy {
3829
Boolean forceOnlyNearFeats;
3830
Boolean forceAllowFarFeats;
3831
} FeatPolicy, PNTR FeatPolicyPtr;
3740
3833
static void LookFarFeatFetchPolicy (
3741
3834
SeqDescrPtr sdp,
3742
3835
Pointer userdata
3746
BoolPtr forceOnlyNearFeatsP;
3747
3840
ObjectIdPtr oip;
3748
3842
UserFieldPtr ufp;
3749
3843
UserObjectPtr uop;
3751
3845
if (sdp == NULL || sdp->choice != Seq_descr_user) return;
3752
forceOnlyNearFeatsP = (BoolPtr) userdata;
3753
if (forceOnlyNearFeatsP == NULL) return;
3846
fpP = (FeatPolicyPtr) userdata;
3847
if (fpP == NULL) return;
3755
3849
uop = (UserObjectPtr) sdp->data.ptrvalue;
3756
3850
if (uop == NULL) return;
3762
3856
oip = ufp->label;
3763
3857
if (oip == NULL || ufp->data.ptrvalue == NULL) continue;
3764
3858
if (StringCmp (oip->str, "Policy") == 0) {
3765
if (StringICmp ((CharPtr) ufp->data.ptrvalue, "OnlyNearFeatures") == 0) {
3766
*forceOnlyNearFeatsP = TRUE;
3859
str = (CharPtr) ufp->data.ptrvalue;
3860
if (StringICmp (str, "OnlyNearFeatures") == 0) {
3861
fpP->forceOnlyNearFeats = TRUE;
3862
} else if (StringICmp (str, "AllowFarFeatures") == 0) {
3863
fpP->forceAllowFarFeats = TRUE;
3869
static void FindMultiIntervalGenes (
3875
BoolPtr multiIntervalGenesP;
3878
if (sfp == NULL || sfp->data.choice != SEQFEAT_GENE) return;
3879
multiIntervalGenesP = (BoolPtr) userdata;
3880
if (multiIntervalGenesP == NULL) return;
3882
slp = sfp->location;
3883
if (slp == NULL) return;
3884
switch (slp->choice) {
3885
case SEQLOC_PACKED_INT :
3886
case SEQLOC_PACKED_PNT :
3889
*multiIntervalGenesP = TRUE;
3772
3896
static CharPtr bad_html_strings [] = {
3773
3897
"<script", "<object", "<applet", "<embed", "<form", "javascript:", "vbscript:", NULL
3792
3916
#define FAR_TRANS_MASK (SHOW_FAR_TRANSLATION | TRANSLATE_IF_NO_PRODUCT | ALWAYS_TRANSLATE_CDS)
3793
#define FEAT_FETCH_MASK (ONLY_NEAR_FEATURES | FAR_FEATURES_SUPPRESS | NEAR_FEATURES_SUPPRESS)
3917
#define FEAT_FETCH_MASK (ONLY_NEAR_FEATURES | FAR_FEATURES_SUPPRESS | NEAR_FEATURES_SUPPRESS | FORCE_ALLOW_FAR_FEATS)
3794
3918
#define HTML_XML_ASN_MASK (CREATE_HTML_FLATFILE | CREATE_XML_GBSEQ_FILE | CREATE_ASN_GBSEQ_FILE)
3795
3919
#define PUBLICATION_MASK (HIDE_GENE_RIFS | ONLY_GENE_RIFS | ONLY_REVIEW_PUBS | NEWEST_PUBS | OLDEST_PUBS | HIDE_ALL_PUBS)
4006
4134
ajp = (IntAsn2gbJobPtr) MemNew (sizeof (IntAsn2gbJob));
4007
4135
if (ajp == NULL) return NULL;
4009
VisitDescriptorsInSep (sep, (Pointer) &forceOnlyNearFeats, LookFarFeatFetchPolicy);
4137
featpolicy.forceOnlyNearFeats = FALSE;
4138
featpolicy.forceAllowFarFeats = FALSE;
4139
VisitDescriptorsInSep (sep, (Pointer) &featpolicy, LookFarFeatFetchPolicy);
4142
if (format != FTABLE_FMT) {
4143
if (isRefSeq && isNC && VisitFeaturesInSep (sep, NULL, NULL) == 0) {
4144
if ((Boolean) ((custom & HIDE_GAP_FEATS) == 0)) {
4145
VisitBioseqsInSep (sep, (Pointer) &fargaps, MakeFarGapFeats);
4149
if (fargaps != NULL && fargaps->choice == 1) {
4150
fargaps = ValNodeFreeData (fargaps);
4152
ajp->fargaps = fargaps;
4012
if (format != FTABLE_FMT) {
4155
if (fargaps == NULL && format != FTABLE_FMT) {
4013
4156
if (isGED /* was isG */ || isTPG || isOnlyLocal || isRefSeq || isSP || (isGeneral && (! isGED))) {
4014
4157
if ((Boolean) ((custom & HIDE_GAP_FEATS) == 0)) {
4180
4325
ajp->newSourceOrg = TRUE;
4328
VisitFeaturesInSep (sep, (Pointer) &multiIntervalGenes, FindMultiIntervalGenes);
4329
ajp->multiIntervalGenes = multiIntervalGenes;
4183
4331
ajp->relModeError = FALSE;
4184
4332
ajp->skipProts = skipProts;
4185
4333
ajp->skipMrnas = skipMrnas;
4242
4390
aw.farFeatsSuppress = FALSE;
4243
4391
aw.nearFeatsSuppress = FALSE;
4393
if (featpolicy.forceAllowFarFeats) {
4395
/* do not set other flags */
4397
} else if ((Boolean) ((flags & FEAT_FETCH_MASK) == FORCE_ALLOW_FAR_FEATS)) {
4399
/* do not set other flags */
4247
4403
if ((Boolean) ((flags & FEAT_FETCH_MASK) == ONLY_NEAR_FEATURES)) {
4248
4404
aw.onlyNearFeats = TRUE;
4249
} else if (forceOnlyNearFeats) {
4405
} else if (featpolicy.forceOnlyNearFeats) {
4250
4406
aw.onlyNearFeats = TRUE;
4252
4408
aw.nearFeatsSuppress = TRUE;
4261
4417
if ((Boolean) ((flags & FEAT_FETCH_MASK) == ONLY_NEAR_FEATURES)) {
4262
4418
aw.onlyNearFeats = TRUE;
4263
} else if (forceOnlyNearFeats) {
4419
} else if (featpolicy.forceOnlyNearFeats) {
4264
4420
aw.onlyNearFeats = TRUE;
4266
4422
aw.nearFeatsSuppress = TRUE;
4268
4424
ajp->showFarTransl = TRUE;
4270
} else if (forceOnlyNearFeats) {
4426
} else if (featpolicy.forceOnlyNearFeats) {
4272
4428
aw.onlyNearFeats = TRUE;
4378
4534
if (ffhead != NULL) {
4379
4535
if (fp != NULL) {
4380
fprintf (fp, ffhead);
4536
fprintf (fp, "%s", ffhead);
4383
4539
if (ffwrite != NULL) {
4384
ffwrite (ffhead, userdata, HEAD_BLOCK, entityID, item_type, item_id);
4540
ffwrite (ffhead, userdata, HEAD_BLOCK, entityID, item_type, item_id, 0, 0);
4387
4543
DoQuickLinkFormat (aw.afp, "<div class=\"sequence\">");
4429
4585
if (fftail != NULL) {
4430
4586
if (fp != NULL) {
4431
fprintf (fp, fftail);
4587
fprintf (fp, "%s", fftail);
4434
4590
if (ffwrite != NULL) {
4435
ffwrite (fftail, userdata, TAIL_BLOCK, entityID, item_type, item_id);
4591
ffwrite (fftail, userdata, TAIL_BLOCK, entityID, item_type, item_id, 0, 0);
4965
5121
slp = SeqLocFindNext (cbp->loc, NULL);
4966
5122
while (slp != NULL) {
4967
str = FFFlatLoc (&iaj, target, slp, FALSE);
5123
str = FFFlatLoc (&iaj, target, slp, FALSE, FALSE);
4968
5124
if (str != NULL) {
4969
5125
residue = cbaa.value.intvalue;
4970
5126
ptr = Get3LetterSymbol (&iaj, seqcode, sctp, residue);
5651
5809
if (slp != NULL && StringDoesHaveText (aa)) {
5652
tmpx = FFFlatLoc (ajp, target, slp, ajp->masterStyle);
5810
tmpx = FFFlatLoc (ajp, target, slp, ajp->masterStyle, FALSE);
5653
5811
if (tmpx != NULL) {
5654
5812
sprintf (tmp, "\t\t\tanticodon\t(pos:%s,aa:%s)\n", tmpx, aa);
5655
5813
ValNodeCopyStr (head, 0, tmp);
5823
rgp = (RNAGenPtr) rrp->ext.value.ptrvalue;
5825
StringNCpy_0 (str, rgp->_class, sizeof (str));
5826
if (StringDoesHaveText (str)) {
5827
sprintf (tmp, "\t\t\tncRNA_class\t%s\n", str);
5828
ValNodeCopyStr (head, 0, tmp);
5830
StringNCpy_0 (str, rgp->product, sizeof (str));
5831
if (StringDoesHaveText (str)) {
5832
sprintf (tmp, "\t\t\tproduct\t%s\n", str);
5833
ValNodeCopyStr (head, 0, tmp);
5835
for (rqp = rgp->quals; rqp != NULL; rqp = rqp->next) {
5836
if (StringDoesHaveText (rqp->qual) && StringDoesHaveText (rqp->val)) {
5837
AddOneFtableQual (head, rqp->qual, rqp->val);
6035
6215
SeqEntrySetScope (oldscope);
6036
6216
BioseqUnlock (bsp);
6218
if (blocktype == FEATURE_BLOCK && afp->ffwrite != NULL) {
6219
ifp = (IntFeatBlockPtr) bbp;
6220
left = ifp->left + 1;
6221
right = ifp->right + 1;
6038
6224
if (str != NULL) {
6039
6225
if (afp->fp != NULL) {
6040
6226
fprintf (afp->fp, "%s", str);
6042
6228
if (afp->ffwrite != NULL) {
6043
afp->ffwrite (str, afp->userdata, blocktype, bbp->entityID, itemtype, itemID);
6229
afp->ffwrite (str, afp->userdata, blocktype, bbp->entityID, itemtype, itemID, left, right);
6046
6232
if (afp->fp != NULL) {
6047
6233
fprintf (afp->fp, "?\n");
6049
6235
if (afp->ffwrite != NULL) {
6050
afp->ffwrite ("?\n", afp->userdata, blocktype, bbp->entityID, itemtype, itemID);
6236
afp->ffwrite ("?\n", afp->userdata, blocktype, bbp->entityID, itemtype, itemID, left, right);
6083
6269
fprintf (afp->fp, "%s", str);
6085
6271
if (afp->ffwrite != NULL) {
6086
afp->ffwrite (str, afp->userdata, (BlockType) 0, entityID, item_type, itemID);
6272
afp->ffwrite (str, afp->userdata, (BlockType) 0, entityID, item_type, itemID, 0, 0);
6496
6686
if (ffwrite != NULL) {
6497
ffwrite (ffhead, userdata, HEAD_BLOCK, 0, 0, 0);
6687
ffwrite (ffhead, userdata, HEAD_BLOCK, 0, 0, 0, 0, 0, 0, 0);
6500
6690
/* send each paragraph */
6516
6706
fprintf (fp, "%s", str);
6518
6708
if (ffwrite != NULL) {
6519
ffwrite (str, userdata, block, 0, 0, 0);
6709
ffwrite (str, userdata, block, 0, 0, 0, 0, 0);
6522
6712
if (fp != NULL) {
6523
6713
fprintf (fp, "?\n");
6525
6715
if (ffwrite != NULL) {
6526
ffwrite ("?\n", userdata, block, 0, 0, 0);
6716
ffwrite ("?\n", userdata, block, 0, 0, 0, 0, 0);
6543
6733
if (ffwrite != NULL) {
6544
ffwrite (fftail, userdata, TAIL_BLOCK, 0, 0, 0);
6734
ffwrite (fftail, userdata, TAIL_BLOCK, 0, 0, 0, 0, 0);