~ubuntu-branches/ubuntu/oneiric/ncbi-tools6/oneiric

« back to all changes in this revision

Viewing changes to api/asn2gnb1.c

  • Committer: Bazaar Package Importer
  • Author(s): Aaron M. Ucko
  • Date: 2011-02-13 15:07:22 UTC
  • mfrom: (5.1.2 experimental)
  • Revision ID: james.westby@ubuntu.com-20110213150722-0ua6hh0mua84jxr5
Tags: 6.1.20100808-2
Reupload to unstable following the release of Debian 6.0 (squeeze).

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
*
32
32
* Version Creation Date:   10/21/98
33
33
*
34
 
* $Revision: 1.179 $
 
34
* $Revision: 1.198 $
35
35
*
36
36
* File Description:  New GenBank flatfile generator - work in progress
37
37
*
867
867
 
868
868
static CharPtr url_anchor_strings [] = {
869
869
  "</A>",
 
870
 "</ACRONYM>",
870
871
  "<A HREF=/",
871
872
  "<A HREF=\"/",
872
873
  "<A HREF=FTP://",
875
876
  "<A HREF=HTTPS://",
876
877
  "<A HREF=\"HTTP://",
877
878
  "<A HREF=\"HTTPS://",
 
879
  "<ACRONYM TITLE=\"",
878
880
  NULL
879
881
};
880
882
 
1132
1134
  Int4 i,
1133
1135
       done = FALSE,
1134
1136
       copied = 0, 
1135
 
       start = *break_pos;
 
1137
       start = *break_pos,
 
1138
       pos = 0;
1136
1139
  Char ch;
1137
1140
  Boolean found_comma = FALSE, found_dash = FALSE, found_lb = FALSE;
1138
1141
  /* each candidate is a pair of buffer and position withingh this buffer */
1177
1180
  start = i;
1178
1181
 
1179
1182
  while ( iter != NULL && !done ) {
1180
 
    for ( i = start; i < iter->pos; ++i ) {
 
1183
    for ( i = start; iter != NULL && i < iter->pos; ++i ) {
1181
1184
      if ( found_comma ) {
1182
1185
        candidate_sip_comma = iter;
1183
1186
        candidate_int_comma = i;
1226
1229
      }      
1227
1230
    }
1228
1231
    start = 0;
1229
 
    if ( !done ) {
 
1232
    if ( iter != NULL && !done ) {
1230
1233
      prev = iter;
 
1234
      pos = prev->pos;
1231
1235
      iter = iter->next;
1232
1236
    }
1233
1237
  }
1235
1239
  /* the order in which we examine the various candidate breaks is important */
1236
1240
  if ( iter == NULL && !done) { /* reached the end */
1237
1241
    *break_sip = prev;
1238
 
    *break_pos = prev->pos;
 
1242
    *break_pos = pos;
1239
1243
  } else {
1240
1244
    if( candidate_sip_space != NULL ) {
1241
1245
        *break_sip = candidate_sip_space;
2168
2172
  SeqMgrBioseqContext  bcontext;
2169
2173
  BlockMask            bkmask;
2170
2174
  BaseBlockPtr         PNTR blockArray;
 
2175
  Boolean              cagemaster = FALSE;
2171
2176
  SeqMgrDescContext    dcontext;
2172
2177
  Boolean              hasRefs;
2173
2178
  Int4                 i;
2184
2189
  ValNodePtr           vnp;
2185
2190
  Boolean              wgsmaster = FALSE;
2186
2191
  Boolean              wgstech = FALSE;
 
2192
  Boolean              willshowcage = FALSE;
2187
2193
  Boolean              willshowwgs = FALSE;
2188
2194
  Boolean              willshowgenome = FALSE;
2189
2195
  Boolean              willshowcontig = FALSE;
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) {
2318
 
        wgstech = TRUE;
 
2326
      if (mip != NULL) {
 
2327
        if (mip->tech == MI_TECH_wgs) {
 
2328
          wgstech = TRUE;
 
2329
        } else if (mip->tech == MI_TECH_other && StringCmp (mip->techexp, "cage") == 0) {
 
2330
          cagemaster = TRUE;
 
2331
        }
2319
2332
      }
2320
2333
    }
2321
2334
  }
2348
2361
 
2349
2362
    if (wgsmaster && wgstech) {
2350
2363
      willshowwgs = TRUE;
 
2364
    } else if (cagemaster) {
 
2365
      willshowcage = TRUE;
2351
2366
    } else if (nsgenome) {
2352
2367
      willshowgenome = TRUE;
2353
2368
    } else if (contig) {
2370
2385
      }
2371
2386
    }
2372
2387
 
2373
 
    AddLocusBlock (awp, willshowwgs, willshowgenome, willshowcontig, willshowsequence);
 
2388
    AddLocusBlock (awp, willshowwgs, willshowcage, willshowgenome, willshowcontig, willshowsequence);
2374
2389
 
2375
2390
    if (awp->format == GENBANK_FMT || awp->format == GENPEPT_FMT) {
2376
2391
 
2459
2474
 
2460
2475
      AddWGSBlock (awp);
2461
2476
 
 
2477
    } else if (cagemaster) {
 
2478
 
 
2479
      AddCAGEBlock (awp);
 
2480
 
2462
2481
    } else if (nsgenome) {
2463
2482
 
2464
2483
      AddGenomeBlock (awp);
3640
3659
 
3641
3660
  if (bsp == NULL || bsp->repr != Seq_repr_delta) return;
3642
3661
  gapvnp = (ValNodePtr PNTR) userdata;
 
3662
  if (gapvnp == NULL) return;
3643
3663
  sip = SeqIdFindBest (bsp->id, 0);
3644
3664
  if (sip == NULL) return;
3645
3665
  /* no longer suppress on far delta contigs */
3737
3757
  MakeGapFeatsBase (bsp, userdata, FALSE);
3738
3758
}
3739
3759
 
 
3760
static CharPtr gapstr1 = "     gap             ";
 
3761
static CharPtr gapstr2 = "                     /estimated_length=";
 
3762
static CharPtr gapstr3 = "unknown";
 
3763
 
 
3764
static void MakeFarGapFeats (
 
3765
  BioseqPtr bsp,
 
3766
  Pointer userdata
 
3767
)
 
3768
 
 
3769
{
 
3770
  Char             buf [256];
 
3771
  Int4             currpos = 0;
 
3772
  ValNodePtr PNTR  fargaps;
 
3773
  IntFuzzPtr       fuzz;
 
3774
  SeqLitPtr        litp;
 
3775
  Boolean          notFar = FALSE;
 
3776
  SeqIdPtr         sip;
 
3777
  SeqLocPtr        slp;
 
3778
  ValNodePtr       vnp;
 
3779
 
 
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; */
 
3787
 
 
3788
  /* empty string at beginning for GetFeatsOnSeg to skip over */
 
3789
  ValNodeAddPointer (fargaps, 0, NULL);
 
3790
 
 
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);
 
3796
    }
 
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) {
 
3802
          fuzz = litp->fuzz;
 
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,
 
3806
                     gapstr2, gapstr3);
 
3807
          } else {
 
3808
            sprintf (buf, "%s%ld..%ld\n%s%ld\n",
 
3809
                     gapstr1, (long) currpos + 1, (long) currpos + litp->length,
 
3810
                     gapstr2, (long) litp->length);
 
3811
          }
 
3812
          ValNodeCopyStr (fargaps, 0, (Pointer) buf);
 
3813
        }
 
3814
      } else {
 
3815
        notFar = TRUE;
 
3816
      }
 
3817
      currpos += litp->length;
 
3818
    }
 
3819
  }
 
3820
 
 
3821
  if (notFar) {
 
3822
    for (vnp = *fargaps; vnp != NULL; vnp = vnp->next) {
 
3823
      vnp->choice = 1;
 
3824
    }
 
3825
  }
 
3826
}
 
3827
 
 
3828
typedef struct featpolicy {
 
3829
  Boolean  forceOnlyNearFeats;
 
3830
  Boolean  forceAllowFarFeats;
 
3831
} FeatPolicy, PNTR FeatPolicyPtr;
 
3832
 
3740
3833
static void LookFarFeatFetchPolicy (
3741
3834
  SeqDescrPtr sdp,
3742
3835
  Pointer userdata
3743
3836
)
3744
3837
 
3745
3838
{
3746
 
  BoolPtr        forceOnlyNearFeatsP;
 
3839
  FeatPolicyPtr  fpP;
3747
3840
  ObjectIdPtr    oip;
 
3841
  CharPtr        str;
3748
3842
  UserFieldPtr   ufp;
3749
3843
  UserObjectPtr  uop;
3750
3844
 
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;
3754
3848
 
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;
3767
3864
      }
3768
3865
    }
3769
3866
  }
3770
3867
}
3771
3868
 
 
3869
static void FindMultiIntervalGenes (
 
3870
  SeqFeatPtr sfp,
 
3871
  Pointer userdata
 
3872
)
 
3873
 
 
3874
{
 
3875
  BoolPtr    multiIntervalGenesP;
 
3876
  SeqLocPtr  slp;
 
3877
 
 
3878
  if (sfp == NULL || sfp->data.choice != SEQFEAT_GENE) return;
 
3879
  multiIntervalGenesP = (BoolPtr) userdata;
 
3880
  if (multiIntervalGenesP == NULL) return;
 
3881
 
 
3882
  slp = sfp->location;
 
3883
  if (slp == NULL) return;
 
3884
  switch (slp->choice) {
 
3885
    case SEQLOC_PACKED_INT :
 
3886
    case SEQLOC_PACKED_PNT :
 
3887
    case SEQLOC_MIX :
 
3888
    case SEQLOC_EQUIV :
 
3889
      *multiIntervalGenesP = TRUE;
 
3890
      break;
 
3891
    default :
 
3892
      break;
 
3893
  }
 
3894
}
 
3895
 
3772
3896
static CharPtr bad_html_strings [] = {
3773
3897
  "<script", "<object", "<applet", "<embed", "<form", "javascript:", "vbscript:", NULL
3774
3898
};
3790
3914
</html>\n";
3791
3915
 
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)
3796
3920
 
3823
3947
  Uint2            entityID = 0;
3824
3948
  Uint2            item_type = 0;
3825
3949
  Uint4            item_id = 0;
 
3950
  ValNodePtr       fargaps = NULL;
3826
3951
  CharPtr          ffhead = NULL;
3827
3952
  CharPtr          fftail = NULL;
3828
3953
  Asn2gbWriteFunc  ffwrite = NULL;
3829
 
  Boolean          forceOnlyNearFeats = FALSE;
 
3954
  FeatPolicy       featpolicy;
3830
3955
  ValNodePtr       gapvnp = NULL;
3831
3956
  GBSeqPtr         gbseq = NULL;
3832
3957
  Int4             i;
3856
3981
  Boolean          lookupFarOthers;
3857
3982
  Boolean          lookupFarProd;
3858
3983
  Boolean          missingVersion;
 
3984
  Boolean          multiIntervalGenes = FALSE;
3859
3985
  Int4             nextGi = 0;
3860
3986
  Boolean          noLeft;
3861
3987
  Boolean          noRight;
3877
4003
  Asn2gbSectPtr    PNTR sectionArray;
3878
4004
  SubmitBlockPtr   sbp;
3879
4005
  SeqEntryPtr      sep;
 
4006
  Boolean          seqspans = FALSE;
3880
4007
  SeqIntPtr        sintp;
3881
4008
  SeqIdPtr         sip;
3882
4009
  Boolean          skipMrnas = FALSE;
3912
4039
    nextGi = extra->nextGi;
3913
4040
    bkmask = extra->bkmask;
3914
4041
    reindex = extra->reindex;
 
4042
    seqspans = extra->seqspans;
3915
4043
  }
3916
4044
 
3917
4045
  if (slp != NULL) {
4006
4134
  ajp = (IntAsn2gbJobPtr) MemNew (sizeof (IntAsn2gbJob));
4007
4135
  if (ajp == NULL) return NULL;
4008
4136
 
4009
 
  VisitDescriptorsInSep (sep, (Pointer) &forceOnlyNearFeats, LookFarFeatFetchPolicy);
 
4137
  featpolicy.forceOnlyNearFeats = FALSE;
 
4138
  featpolicy.forceAllowFarFeats = FALSE;
 
4139
  VisitDescriptorsInSep (sep, (Pointer) &featpolicy, LookFarFeatFetchPolicy);
 
4140
 
 
4141
  fargaps = NULL;
 
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);
 
4146
      }
 
4147
    }
 
4148
  }
 
4149
  if (fargaps != NULL && fargaps->choice == 1) {
 
4150
    fargaps = ValNodeFreeData (fargaps);
 
4151
  }
 
4152
  ajp->fargaps = fargaps;
4010
4153
 
4011
4154
  gapvnp = NULL;
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)) {
4015
4158
        if (isSP) {
4107
4250
  }
4108
4251
  ajp->bkmask = bkmask;
4109
4252
  ajp->reindex = reindex;
 
4253
  ajp->seqspans = seqspans;
4110
4254
  ajp->aip = aip;
4111
4255
  ajp->atp = atp;
4112
4256
 
4168
4312
  }
4169
4313
  ajp->seqGapCurrLen = 0;
4170
4314
 
4171
 
  ajp->produceInsdSeq = (Boolean) ((flags & PRODUCE_OLD_GBSEQ) == 0);
 
4315
  ajp->produceInsdSeq = (Boolean) (((flags & PRODUCE_OLD_GBSEQ) == 0) && ((custom & OLD_GBSEQ_XML) == 0));
 
4316
  ajp->oldXmlPolicy = (Boolean) ((custom & NEW_XML_POLICY) == 0);
4172
4317
 
4173
4318
  ajp->gihead = NULL;
4174
4319
  ajp->gitail = NULL;
4180
4325
    ajp->newSourceOrg = TRUE;
4181
4326
  }
4182
4327
 
 
4328
  VisitFeaturesInSep (sep, (Pointer) &multiIntervalGenes, FindMultiIntervalGenes);
 
4329
  ajp->multiIntervalGenes = multiIntervalGenes;
 
4330
 
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;
4244
4392
 
4245
 
  if (isNC) {
 
4393
  if (featpolicy.forceAllowFarFeats) {
 
4394
 
 
4395
    /* do not set other flags */
 
4396
 
 
4397
  } else if ((Boolean) ((flags & FEAT_FETCH_MASK) == FORCE_ALLOW_FAR_FEATS)) {
 
4398
 
 
4399
    /* do not set other flags */
 
4400
 
 
4401
  } else if (isNC) {
4246
4402
 
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;
4251
4407
    } else {
4252
4408
      aw.nearFeatsSuppress = TRUE;
4260
4416
 
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;
4265
4421
    } else {
4266
4422
      aw.nearFeatsSuppress = TRUE;
4267
4423
    }
4268
4424
    ajp->showFarTransl = TRUE;
4269
4425
 
4270
 
  } else if (forceOnlyNearFeats) {
 
4426
  } else if (featpolicy.forceOnlyNearFeats) {
4271
4427
 
4272
4428
    aw.onlyNearFeats = TRUE;
4273
4429
    
4377
4533
    }
4378
4534
    if (ffhead != NULL) {
4379
4535
      if (fp != NULL) {
4380
 
        fprintf (fp, ffhead);
 
4536
        fprintf (fp, "%s", ffhead);
4381
4537
      }
4382
4538
    }
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);
4385
4541
    }
4386
4542
    if (is_html) {
4387
4543
      DoQuickLinkFormat (aw.afp, "<div class=\"sequence\">");
4428
4584
    }
4429
4585
    if (fftail != NULL) {
4430
4586
      if (fp != NULL) {
4431
 
        fprintf (fp, fftail);
 
4587
        fprintf (fp, "%s", fftail);
4432
4588
      }
4433
4589
    }
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);
4436
4592
    }
4437
4593
  }
4438
4594
 
4921
5077
  }
4922
5078
}
4923
5079
 
4924
 
static void PrintFTCodeBreak (
 
5080
NLM_EXTERN void PrintFTCodeBreak (
4925
5081
  ValNodePtr PNTR head,
4926
5082
  CodeBreakPtr cbp,
4927
5083
  BioseqPtr target
4964
5120
 
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);
5427
5583
  SeqFeatPtr         prot;
5428
5584
  ProtRefPtr         prp = NULL;
5429
5585
  Boolean            pseudo;
 
5586
  RNAGenPtr          rgp;
 
5587
  RNAQualPtr         rqp;
5430
5588
  RnaRefPtr          rrp;
5431
5589
  SeqDescrPtr        sdp;
5432
5590
  Int4               sec_str;
5435
5593
  Int2               siteidx;
5436
5594
  SeqLocPtr          slp;
5437
5595
  Char               str [256];
5438
 
  Char               tmp [300];
 
5596
  Char               tmp [512];
5439
5597
  CharPtr            tmpx;
5440
5598
  tRNAPtr            trp;
5441
5599
  ValNodePtr         vnp;
5621
5779
            }
5622
5780
            break;
5623
5781
          case 2 :
5624
 
            trp = rrp->ext.value.ptrvalue;
 
5782
            trp = (tRNAPtr) rrp->ext.value.ptrvalue;
5625
5783
            if (trp != NULL) {
5626
5784
              FeatDefLabel (sfp, str, sizeof (str) - 1, OM_LABEL_CONTENT);
5627
5785
              if (! StringHasNoText (str)) {
5649
5807
                aa += 5;
5650
5808
              }
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);
5661
5819
              }
5662
5820
            }
5663
5821
            break;
 
5822
          case 3 :
 
5823
            rgp = (RNAGenPtr) rrp->ext.value.ptrvalue;
 
5824
            if (rgp != NULL) {
 
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);
 
5829
              }
 
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);
 
5834
              }
 
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);
 
5838
                }
 
5839
              }
 
5840
            }
5664
5841
          default :
5665
5842
            break;
5666
5843
        }
5992
6169
  BlockType        blocktype;
5993
6170
  BioseqPtr        bsp;
5994
6171
  FormatProc       fmt;
 
6172
  IntFeatBlockPtr  ifp;
5995
6173
  Boolean          is_www;
 
6174
  Int4             left = 0;
5996
6175
  size_t           max;
5997
6176
  SeqEntryPtr      oldscope;
5998
6177
  QualValPtr       qv = NULL;
 
6178
  Int4             right = 0;
5999
6179
  SeqEntryPtr      sep;
6000
6180
  CharPtr          str = NULL;
6001
6181
  Uint2            itemtype;
6035
6215
  SeqEntrySetScope (oldscope);
6036
6216
  BioseqUnlock (bsp);
6037
6217
 
 
6218
  if (blocktype == FEATURE_BLOCK && afp->ffwrite != NULL) {
 
6219
    ifp = (IntFeatBlockPtr) bbp;
 
6220
    left = ifp->left + 1;
 
6221
    right = ifp->right + 1;
 
6222
  }
 
6223
 
6038
6224
  if (str != NULL) {
6039
6225
    if (afp->fp != NULL) {
6040
6226
      fprintf (afp->fp, "%s", str);
6041
6227
    }
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);
6044
6230
    }
6045
6231
  } else {
6046
6232
    if (afp->fp != NULL) {
6047
6233
      fprintf (afp->fp, "?\n");
6048
6234
    }
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);
6051
6237
    }
6052
6238
  }
6053
6239
 
6083
6269
      fprintf (afp->fp, "%s", str);
6084
6270
    }
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);
6087
6273
    }
6088
6274
  }
6089
6275
}
6271
6457
    UnlockFarComponents (iajp->lockedBspList);
6272
6458
  }
6273
6459
 
 
6460
  if (iajp->fargaps != NULL) {
 
6461
    ValNodeFreeData (iajp->fargaps);
 
6462
  }
 
6463
 
6274
6464
  if (iajp->gapvnp != NULL || iajp->remotevnp != NULL) {
6275
6465
    SeqMgrClearFeatureIndexes (ajp->entityID, NULL);
6276
6466
    if (iajp->reindex) {
6494
6684
        }
6495
6685
      }
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);
6498
6688
      }
6499
6689
 
6500
6690
      /* send each paragraph */
6516
6706
            fprintf (fp, "%s", str);
6517
6707
          }
6518
6708
          if (ffwrite != NULL) {
6519
 
            ffwrite (str, userdata, block, 0, 0, 0);
 
6709
            ffwrite (str, userdata, block, 0, 0, 0, 0, 0);
6520
6710
          }
6521
6711
        } else {
6522
6712
          if (fp != NULL) {
6523
6713
            fprintf (fp, "?\n");
6524
6714
          }
6525
6715
          if (ffwrite != NULL) {
6526
 
            ffwrite ("?\n", userdata, block, 0, 0, 0);
 
6716
            ffwrite ("?\n", userdata, block, 0, 0, 0, 0, 0);
6527
6717
          }
6528
6718
        }
6529
6719
 
6541
6731
        }
6542
6732
      }
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);
6545
6735
      }
6546
6736
    }
6547
6737
#endif