~ubuntu-branches/ubuntu/edgy/ncbi-tools6/edgy

« back to all changes in this revision

Viewing changes to api/seqmgr.c

  • Committer: Bazaar Package Importer
  • Author(s): Barry deFreese
  • Date: 2006-07-19 23:28:07 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20060719232807-et3cdmcjgmnyleyx
Tags: 6.1.20060507-3ubuntu1
Re-merge with Debian

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
*   
30
30
* Version Creation Date: 9/94
31
31
*
32
 
* $Revision: 6.252 $
 
32
* $Revision: 6.263 $
33
33
*
34
34
* File Description:  Manager for Bioseqs and BioseqSets
35
35
*
39
39
* -------  ----------  -----------------------------------------------------
40
40
*
41
41
* $Log: seqmgr.c,v $
 
42
* Revision 6.263  2006/04/13 20:02:15  kans
 
43
* LookupFarSeqIDs takes inference parameter
 
44
*
 
45
* Revision 6.262  2006/04/05 17:18:23  kans
 
46
* IndexSegmentedParts uses Int4 for numsegs to avoid overflow to negative number, failure to MemNew
 
47
*
 
48
* Revision 6.261  2006/03/21 15:32:13  kans
 
49
* set ignore flag on generated gaps in IndexRecordedFeatures, not as side effect of sorting callback
 
50
*
 
51
* Revision 6.260  2006/03/20 22:53:44  kans
 
52
* sort flatfile-generated gap feature last, set ignore flag
 
53
*
 
54
* Revision 6.259  2006/02/17 19:05:05  kans
 
55
* special case coded_by only for CDS feature on isolated protein bioseq
 
56
*
 
57
* Revision 6.258  2006/02/17 18:46:20  kans
 
58
* get gene overlapping coded_by CDS on isolated protein bioseq within flatfile generator, not feature indexer
 
59
*
 
60
* Revision 6.257  2006/02/17 17:24:24  kans
 
61
* changes to index CDS feature (with ignore flag) on isolated protein bioseq, xref gene feature
 
62
*
 
63
* Revision 6.256  2006/02/16 22:00:55  kans
 
64
* always pass FALSE for circular to CheckForTransSplice for more stringency
 
65
*
 
66
* Revision 6.255  2006/02/16 21:09:20  kans
 
67
* SeqMgrGetBestOverlappingFeat takes new parameter from get best gene by overlap, uses LOCATION_SUBSET if gene candidate is bad_order or mixed_strand
 
68
*
 
69
* Revision 6.254  2006/02/16 20:24:32  kans
 
70
* added bad_order and mixed_strand fields to feature index - to be used for get best gene overlap function in cases of trans-splicing
 
71
*
 
72
* Revision 6.253  2006/01/20 20:12:21  kans
 
73
* in LockAllSegments, bail if BioseqLockById returns NULL
 
74
*
42
75
* Revision 6.252  2005/09/21 19:20:45  kans
43
76
* SeqMgrGetNextAnnotDesc sets context->index properly
44
77
*
5373
5406
    context->partialL = item->partialL;
5374
5407
    context->partialR = item->partialR;
5375
5408
    context->farloc = item->farloc;
 
5409
    context->bad_order = item->bad_order;
 
5410
    context->mixed_strand = item->mixed_strand;
5376
5411
    context->strand = item->strand;
5377
5412
    if (curr != NULL) {
5378
5413
      context->seqfeattype = curr->data.choice;
5665
5700
*****************************************************************************/
5666
5701
 
5667
5702
typedef struct extraindex {
 
5703
  SeqEntryPtr     topsep;
5668
5704
  BioseqPtr       lastbsp;
5669
5705
  SeqAnnotPtr     lastsap;
5670
5706
  BioseqSetPtr    lastbssp;
5764
5800
 
5765
5801
  /* count alignments */
5766
5802
 
 
5803
  exind.topsep = NULL;
5767
5804
  exind.lastbsp = NULL;
5768
5805
  exind.lastsap = NULL;
5769
5806
  exind.lastbssp = NULL;
6004
6041
static void RecordOneFeature (BioseqExtraPtr bspextra, ObjMgrDataPtr omdp,
6005
6042
                              BioseqPtr bsp, ExtraIndexPtr exindx, SeqFeatPtr sfp,
6006
6043
                              Int4 left, Int4 right, Uint4 itemID, Uint2 subtype,
6007
 
                              Boolean farloc, Boolean ignore)
 
6044
                              Boolean farloc, Boolean bad_order, Boolean mixed_strand,
 
6045
                              Boolean ignore)
6008
6046
 
6009
6047
{
6010
6048
  Char            buf [129];
6084
6122
                item->dnaStop = -1;
6085
6123
        CheckSeqLocForPartial (sfp->location, &(item->partialL), &(item->partialR));
6086
6124
        item->farloc = farloc;
 
6125
        item->bad_order = bad_order;
 
6126
        item->mixed_strand = mixed_strand;
6087
6127
        /*
6088
6128
        item->strand = SeqLocStrand (sfp->location);
6089
6129
        if (exindx->flip) {
6159
6199
  }
6160
6200
}
6161
6201
 
 
6202
 
 
6203
static void CheckForTransSplice (
 
6204
  SeqFeatPtr sfp,
 
6205
  BoolPtr bad_orderP,
 
6206
  BoolPtr mixed_strandP,
 
6207
  Boolean circular
 
6208
)
 
6209
 
 
6210
{
 
6211
  Boolean    mixed_strand = FALSE, ordered = TRUE;
 
6212
  SeqIdPtr   id1, id2;
 
6213
  SeqLocPtr  prev, tmp;
 
6214
  SeqIntPtr  sip1, sip2, prevsip;
 
6215
  Uint1      strand1, strand2;
 
6216
 
 
6217
  if (sfp == NULL || sfp->location == NULL) return;
 
6218
 
 
6219
  tmp = NULL;
 
6220
  prev = NULL;
 
6221
  sip1 = NULL;
 
6222
  id1 = NULL;
 
6223
  prevsip = NULL;
 
6224
  strand1 = Seq_strand_other;
 
6225
 
 
6226
  while ((tmp = SeqLocFindNext (sfp->location, tmp)) != NULL) {
 
6227
 
 
6228
    /* just check seqloc_interval */
 
6229
 
 
6230
    if (tmp->choice == SEQLOC_INT) {
 
6231
      sip1 = prevsip;
 
6232
      sip2 = (SeqIntPtr) (tmp->data.ptrvalue);
 
6233
      strand2 = sip2->strand;
 
6234
      id2 = sip2->id;
 
6235
      if ((sip1 != NULL) && (ordered) && (! circular)) {
 
6236
        if (SeqIdForSameBioseq (sip1->id, sip2->id)) {
 
6237
          if (strand2 == Seq_strand_minus) {
 
6238
            if (sip1->to < sip2->to) {
 
6239
              ordered = FALSE;
 
6240
            }
 
6241
          } else {
 
6242
            if (sip1->to > sip2->to) {
 
6243
              ordered = FALSE;
 
6244
            }
 
6245
          }
 
6246
        }
 
6247
      }
 
6248
      prevsip = sip2;
 
6249
      if ((strand1 != Seq_strand_other) && (strand2 != Seq_strand_other)) {
 
6250
        if (SeqIdForSameBioseq (id1, id2)) {
 
6251
          if (strand1 != strand2) {
 
6252
            if (strand1 == Seq_strand_plus && strand2 == Seq_strand_unknown) {
 
6253
              /* unmarked_strand = TRUE; */
 
6254
            } else if (strand1 == Seq_strand_unknown && strand2 == Seq_strand_plus) {
 
6255
              /* unmarked_strand = TRUE; */
 
6256
            } else {
 
6257
              mixed_strand = TRUE;
 
6258
            }
 
6259
          }
 
6260
        }
 
6261
      }
 
6262
 
 
6263
      strand1 = strand2;
 
6264
      id1 = id2;
 
6265
    }
 
6266
  }
 
6267
 
 
6268
  /* Publication intervals ordering does not matter */
 
6269
 
 
6270
  if (sfp->idx.subtype == FEATDEF_PUB) {
 
6271
    ordered = TRUE;
 
6272
  }
 
6273
 
 
6274
  /* ignore ordering of heterogen bonds */
 
6275
 
 
6276
  if (sfp->data.choice == SEQFEAT_HET) {
 
6277
    ordered = TRUE;
 
6278
  }
 
6279
 
 
6280
  /* misc_recomb intervals SHOULD be in reverse order */
 
6281
 
 
6282
  if (sfp->idx.subtype == FEATDEF_misc_recomb) {
 
6283
    ordered = TRUE;
 
6284
  }
 
6285
 
 
6286
    /* primer_bind intervals MAY be in on opposite strands */
 
6287
 
 
6288
  if (sfp->idx.subtype == FEATDEF_primer_bind) {
 
6289
    mixed_strand = FALSE;
 
6290
    ordered = TRUE;
 
6291
  }
 
6292
 
 
6293
  if (! ordered) {
 
6294
    *bad_orderP = TRUE;
 
6295
  }
 
6296
  if (mixed_strand) {
 
6297
    *mixed_strandP = TRUE;
 
6298
  }
 
6299
}
 
6300
 
6162
6301
typedef struct adpbspdata {
6163
6302
  AnnotDescPtr  adp;
6164
6303
  BioseqPtr     bsp;
6171
6310
{
6172
6311
  AdpBspPtr       abp;
6173
6312
  AnnotDescPtr    adp = NULL;
 
6313
  Boolean         bad_order;
6174
6314
  BioseqPtr       bsp = NULL;
6175
6315
  BioseqExtraPtr  bspextra;
6176
6316
  BioseqSetPtr    bssp = NULL;
6181
6321
  ExtraIndexPtr   exindx;
6182
6322
  Int4            left;
6183
6323
  CharPtr         loclbl;
 
6324
  Boolean         mixed_strand;
6184
6325
  ObjMgrDataPtr   omdp;
6185
6326
  ProtRefPtr      prp;
6186
6327
  Int4            right;
6189
6330
  SeqFeatPtr      sfp = NULL;
6190
6331
  SeqAlignPtr     sal = NULL;
6191
6332
  SeqLocPtr       slp;
 
6333
  Boolean         special_case = FALSE;
6192
6334
  Int4            swap;
6193
6335
  SeqFeatPtr      tmp;
6194
6336
  Boolean         usingLocalBsp = FALSE;
6376
6518
    }
6377
6519
    MemFree (ctmp);
6378
6520
 
6379
 
    if (bsp == NULL) return TRUE;
6380
 
    usingLocalBsp = TRUE;
 
6521
    if (bsp == NULL && sfp->product != NULL &&
 
6522
        sfp->data.choice == SEQFEAT_CDREGION &&
 
6523
        IS_Bioseq (exindx->topsep)) {
 
6524
      bsp = (BioseqPtr) exindx->topsep->data.ptrvalue;
 
6525
      if (bsp == NULL || (! ISA_aa (bsp->mol))) return TRUE;
 
6526
      special_case = TRUE;
 
6527
      bsp = FindAppropriateBioseq (sfp->product, exindx->lastbsp);
 
6528
      if (bsp == NULL) return TRUE;
 
6529
    } else {
 
6530
      if (bsp == NULL) return TRUE;
 
6531
      usingLocalBsp = TRUE;
 
6532
    }
6381
6533
  }
6382
6534
 
6383
6535
  /* assume subsequent features will be on this bioseq */
6403
6555
  /*
6404
6556
  slp = SeqLocMergeEx (bsp, sfp->location, NULL, TRUE, TRUE, FALSE, FALSE);
6405
6557
  */
6406
 
  slp = sfp->location;
 
6558
  if (special_case) {
 
6559
    slp = sfp->product;
 
6560
  } else {
 
6561
    slp = sfp->location;
 
6562
  }
6407
6563
  left = GetOffsetInNearBioseq (slp, bsp, SEQLOC_LEFT_END);
6408
6564
  right = GetOffsetInNearBioseq (slp, bsp, SEQLOC_RIGHT_END);
6409
6565
  /*
6517
6673
      right = swap;
6518
6674
    }
6519
6675
 
 
6676
    bad_order = FALSE;
 
6677
    mixed_strand = FALSE;
 
6678
    CheckForTransSplice (sfp, &bad_order, &mixed_strand, /* (Boolean) (bsp->topology == TOPOLOGY_CIRCULAR) */ FALSE);
 
6679
 
6520
6680
    RecordOneFeature (bspextra, omdp, bsp, exindx, sfp, left,
6521
 
                      right, gop->itemID, gop->subtype, usingLocalBsp, FALSE);
 
6681
                      right, gop->itemID, gop->subtype, usingLocalBsp,
 
6682
                      bad_order, mixed_strand, special_case);
6522
6683
 
6523
6684
    /* record gene, publication, and biosource features twice if spanning the origin */
6524
6685
 
6529
6690
          sfp->idx.subtype == FEATDEF_operon) {
6530
6691
 
6531
6692
        RecordOneFeature (bspextra, omdp, bsp, exindx, sfp, left + bsp->length,
6532
 
                          right + bsp->length, gop->itemID, gop->subtype, usingLocalBsp, TRUE);
 
6693
                          right + bsp->length, gop->itemID, gop->subtype, usingLocalBsp,
 
6694
                          bad_order, mixed_strand, TRUE);
6533
6695
 
6534
6696
      }
6535
6697
    }
6973
7135
    return 1;
6974
7136
  }
6975
7137
 
 
7138
  /* if identical gap ranges, use itemID to put flatfile-generated gap feature last */
 
7139
 
 
7140
  if (sp1->subtype == FEATDEF_gap && sp2->subtype == FEATDEF_gap) {
 
7141
    if (sp1->itemID > sp2->itemID) {
 
7142
      return 1;
 
7143
    } else if (sp1->itemID < sp2->itemID) {
 
7144
      return -1;
 
7145
    }
 
7146
  }
 
7147
 
6976
7148
  /* if identical cds ranges, compare codon_start */
6977
7149
 
6978
7150
  if (sp1->subtype == FEATDEF_CDS && sp2->subtype == FEATDEF_CDS) {
7145
7317
    return 1;
7146
7318
  }
7147
7319
 
 
7320
  /* if identical gap ranges, use itemID to put flatfile-generated gap feature last */
 
7321
 
 
7322
  if (sp1->subtype == FEATDEF_gap && sp2->subtype == FEATDEF_gap) {
 
7323
    if (sp1->itemID > sp2->itemID) {
 
7324
      return 1;
 
7325
    } else if (sp1->itemID < sp2->itemID) {
 
7326
      return -1;
 
7327
    }
 
7328
  }
 
7329
 
7148
7330
  /* if identical cds ranges, compare codon_start */
7149
7331
 
7150
7332
  if (sp1->subtype == FEATDEF_CDS && sp2->subtype == FEATDEF_CDS) {
7281
7463
  BioseqPtr         bsp;
7282
7464
  BioseqExtraPtr    bspextra;
7283
7465
  BioseqSetPtr      bssp;
7284
 
  Int2              i;
7285
 
  Int2              numsegs = 0;
 
7466
  Int4              i;
 
7467
  Int4              numsegs = 0;
7286
7468
  ObjMgrDataPtr     omdp;
7287
7469
  SMSeqIdxPtr PNTR  partsByLoc;
7288
7470
  SMSeqIdxPtr PNTR  partsBySeqId;
7384
7566
*
7385
7567
*****************************************************************************/
7386
7568
 
7387
 
static void IndexRecordedFeatures (SeqEntryPtr sep, Boolean dorevfeats)
 
7569
static void IndexRecordedFeatures (SeqEntryPtr sep, Boolean dorevfeats, Uint4 baseItemID)
7388
7570
 
7389
7571
{
7390
7572
  BioseqPtr           bsp;
7403
7585
  Int4                i;
7404
7586
  Int4                j;
7405
7587
  SMFeatItemPtr       item;
 
7588
  SMFeatItemPtr       last;
7406
7589
  BioseqPtr           nuc;
7407
7590
  Int4                numfeats;
7408
7591
  Int4                numgenes;
7418
7601
    bssp = (BioseqSetPtr) sep->data.ptrvalue;
7419
7602
    if (bssp == NULL) return;
7420
7603
    for (sep = bssp->seq_set; sep != NULL; sep = sep->next) {
7421
 
      IndexRecordedFeatures (sep, dorevfeats);
 
7604
      IndexRecordedFeatures (sep, dorevfeats, baseItemID);
7422
7605
    }
7423
7606
    return;
7424
7607
  }
7493
7676
          }
7494
7677
        }
7495
7678
 
 
7679
        /* gap feature in record overrides flatfile-generated feature */
 
7680
 
 
7681
        if (baseItemID > 0) {
 
7682
          last = featsByPos [0];
 
7683
          for (i = 1; i < numfeats; i++) {
 
7684
            item = featsByPos [i];
 
7685
            if (item != NULL && last != NULL) {
 
7686
              if (last->subtype == FEATDEF_gap && item->subtype == FEATDEF_gap) {
 
7687
                if (last->left == item->left && last->right == item->right) {
 
7688
                  if (item->itemID >= baseItemID) {
 
7689
                    item->ignore = TRUE;
 
7690
                  }
 
7691
                }
 
7692
              }
 
7693
            }
 
7694
            last = item;
 
7695
          }
 
7696
        }
 
7697
 
7496
7698
        /* build arrays of sorted gene, mRNA, CDS, publication, and biosource features for lookup by overlap */
7497
7699
 
7498
7700
        bspextra->genesByPos = SeqMgrBuildFeatureIndex (bsp, &(bspextra->numgenes), 0, FEATDEF_GENE);
8188
8390
{
8189
8391
  AdpBspPtr           abp;
8190
8392
  AnnotDescPtr PNTR   annotDescByID;
 
8393
  Uint4               baseItemID = 0;
8191
8394
  BioseqPtr           bsp;
8192
8395
  BioseqExtraPtr      bspextra;
8193
8396
  Int4                count;
8264
8467
 
8265
8468
  AssignIDsInEntityEx (entityID, 0, NULL, extra);
8266
8469
 
 
8470
  /* get first feature itemID in remote feature tables (including generated gaps) */
 
8471
 
 
8472
  for (vnp = extra; vnp != NULL && baseItemID == 0; vnp = vnp->next) {
 
8473
    bsp = (BioseqPtr) vnp->data.ptrvalue;
 
8474
    if (bsp == NULL) continue;
 
8475
    for (sap = bsp->annot; sap != NULL && baseItemID == 0; sap = sap->next) {
 
8476
      if (sap->type != 1) continue;
 
8477
      for (sfp = (SeqFeatPtr) sap->data; sfp != NULL && baseItemID == 0; sfp = sfp->next) {
 
8478
        baseItemID = sfp->idx.itemID;
 
8479
      }
 
8480
    }
 
8481
  }
 
8482
 
8267
8483
  /* set scope for FindAppropriateBioseq, FindFirstLocalBioseq */
8268
8484
 
8269
8485
  oldscope = SeqEntrySetScope (sep);
8270
8486
 
8271
8487
  /* gather all segmented locations */
8272
8488
 
 
8489
  exind.topsep = sep;
8273
8490
  exind.lastbsp = NULL;
8274
8491
  exind.lastsap = NULL;
8275
8492
  exind.lastbssp = NULL;
8302
8519
  /* now gather to get descriptor itemID counts on each bioseq or bioseq set,
8303
8520
     and record features on the bioseq indicated by the feature location */
8304
8521
 
 
8522
  exind.topsep = sep;
8305
8523
  exind.lastbsp = NULL;
8306
8524
  exind.lastsap = NULL;
8307
8525
  exind.lastbssp = NULL;
8329
8547
 
8330
8548
  /* finish building array of sorted features on each indexed bioseq */
8331
8549
 
8332
 
  IndexRecordedFeatures (sep, dorevfeats);
 
8550
  IndexRecordedFeatures (sep, dorevfeats, baseItemID);
8333
8551
 
8334
8552
  /* set best protein feature for segmented protein bioseqs and their parts */
8335
8553
 
8514
8732
  context->partialL = best->partialL;
8515
8733
  context->partialR = best->partialR;
8516
8734
  context->farloc = best->farloc;
 
8735
  context->bad_order = best->bad_order;
 
8736
  context->mixed_strand = best->mixed_strand;
8517
8737
  context->strand = best->strand;
8518
8738
  if (bst != NULL) {
8519
8739
    context->seqfeattype = bst->data.choice;
8826
9046
    context->partialL = best->partialL;
8827
9047
    context->partialR = best->partialR;
8828
9048
    context->farloc = best->farloc;
 
9049
    context->bad_order = best->bad_order;
 
9050
    context->mixed_strand = best->mixed_strand;
8829
9051
    context->strand = best->strand;
8830
9052
    if (bst != NULL) {
8831
9053
      context->seqfeattype = bst->data.choice;
8841
9063
  }
8842
9064
}
8843
9065
 
8844
 
static SeqFeatPtr SeqMgrGetBestOverlappingFeat (SeqLocPtr slp, Uint2 subtype,
8845
 
                                                SMFeatItemPtr PNTR array,
8846
 
                                                Int4 num, Int4Ptr pos,
8847
 
                                                Int2 overlapType,
8848
 
                                                SeqMgrFeatContext PNTR context,
8849
 
                                                Int2Ptr count,
8850
 
                                                Pointer userdata,
8851
 
                                                SeqMgrFeatExploreProc userfunc)
 
9066
static SeqFeatPtr SeqMgrGetBestOverlappingFeat (
 
9067
  SeqLocPtr slp,
 
9068
  Uint2 subtype,
 
9069
  SMFeatItemPtr PNTR array,
 
9070
  Int4 num,
 
9071
  Int4Ptr pos,
 
9072
  Int2 overlapType,
 
9073
  SeqMgrFeatContext PNTR context,
 
9074
  Int2Ptr count,
 
9075
  Pointer userdata,
 
9076
  SeqMgrFeatExploreProc userfunc,
 
9077
  Boolean special
 
9078
)
8852
9079
 
8853
9080
{
8854
9081
  SMFeatItemPtr   best = NULL;
9028
9255
 
9029
9256
      /* requires feature to be contained within gene, etc. */
9030
9257
 
9031
 
      diff = TestForOverlap (feat, slp, left, right, overlapType, numivals, ivals);
 
9258
      if (special && (feat->bad_order || feat->mixed_strand)) {
 
9259
        diff = TestForOverlap (feat, slp, left, right, LOCATION_SUBSET, numivals, ivals);
 
9260
      } else {
 
9261
        diff = TestForOverlap (feat, slp, left, right, overlapType, numivals, ivals);
 
9262
      }
9032
9263
      if (diff >= 0) {
9033
9264
 
9034
9265
        if (StrandsMatch (feat->strand, strand)) {
9063
9294
    feat = array [hier];
9064
9295
    if (feat != NULL && ((! feat->ignore) || userfunc == NULL)) {
9065
9296
 
9066
 
      diff = TestForOverlap (feat, slp, left, right, overlapType, numivals, ivals);
 
9297
      if (special && (feat->bad_order || feat->mixed_strand)) {
 
9298
        diff = TestForOverlap (feat, slp, left, right, LOCATION_SUBSET, numivals, ivals);
 
9299
      } else {
 
9300
        diff = TestForOverlap (feat, slp, left, right, overlapType, numivals, ivals);
 
9301
      }
9067
9302
      if (diff >= 0) {
9068
9303
 
9069
9304
        if (StrandsMatch (feat->strand, strand)) {
9134
9369
NLM_EXTERN SeqFeatPtr LIBCALL SeqMgrGetOverlappingGene (SeqLocPtr slp, SeqMgrFeatContext PNTR context)
9135
9370
 
9136
9371
{
9137
 
  return SeqMgrGetBestOverlappingFeat (slp, FEATDEF_GENE, NULL, 0, NULL, CONTAINED_WITHIN, context, NULL, NULL, NULL);
 
9372
  return SeqMgrGetBestOverlappingFeat (slp, FEATDEF_GENE, NULL, 0, NULL, CONTAINED_WITHIN, context, NULL, NULL, NULL, TRUE);
9138
9373
}
9139
9374
 
9140
9375
NLM_EXTERN SeqFeatPtr LIBCALL SeqMgrGetOverlappingmRNA (SeqLocPtr slp, SeqMgrFeatContext PNTR context)
9141
9376
 
9142
9377
{
9143
 
  return SeqMgrGetBestOverlappingFeat (slp, FEATDEF_mRNA, NULL, 0, NULL, CONTAINED_WITHIN, context, NULL, NULL, NULL);
 
9378
  return SeqMgrGetBestOverlappingFeat (slp, FEATDEF_mRNA, NULL, 0, NULL, CONTAINED_WITHIN, context, NULL, NULL, NULL, FALSE);
9144
9379
}
9145
9380
 
9146
9381
NLM_EXTERN SeqFeatPtr LIBCALL SeqMgrGetLocationSupersetmRNA (SeqLocPtr slp, SeqMgrFeatContext PNTR context)
9147
9382
 
9148
9383
{
9149
 
  return SeqMgrGetBestOverlappingFeat (slp, FEATDEF_mRNA, NULL, 0, NULL, LOCATION_SUBSET, context, NULL, NULL, NULL);
 
9384
  return SeqMgrGetBestOverlappingFeat (slp, FEATDEF_mRNA, NULL, 0, NULL, LOCATION_SUBSET, context, NULL, NULL, NULL, FALSE);
9150
9385
}
9151
9386
 
9152
9387
NLM_EXTERN SeqFeatPtr LIBCALL SeqMgrGetOverlappingCDS (SeqLocPtr slp, SeqMgrFeatContext PNTR context)
9153
9388
 
9154
9389
{
9155
 
  return SeqMgrGetBestOverlappingFeat (slp, FEATDEF_CDS, NULL, 0, NULL, CONTAINED_WITHIN, context, NULL, NULL, NULL);
 
9390
  return SeqMgrGetBestOverlappingFeat (slp, FEATDEF_CDS, NULL, 0, NULL, CONTAINED_WITHIN, context, NULL, NULL, NULL, FALSE);
9156
9391
}
9157
9392
 
9158
9393
NLM_EXTERN SeqFeatPtr LIBCALL SeqMgrGetOverlappingPub (SeqLocPtr slp, SeqMgrFeatContext PNTR context)
9159
9394
 
9160
9395
{
9161
 
  return SeqMgrGetBestOverlappingFeat (slp, FEATDEF_PUB, NULL, 0, NULL, CONTAINED_WITHIN, context, NULL, NULL, NULL);
 
9396
  return SeqMgrGetBestOverlappingFeat (slp, FEATDEF_PUB, NULL, 0, NULL, CONTAINED_WITHIN, context, NULL, NULL, NULL, FALSE);
9162
9397
}
9163
9398
 
9164
9399
NLM_EXTERN SeqFeatPtr LIBCALL SeqMgrGetOverlappingSource (SeqLocPtr slp, SeqMgrFeatContext PNTR context)
9165
9400
 
9166
9401
{
9167
 
  return SeqMgrGetBestOverlappingFeat (slp, FEATDEF_BIOSRC, NULL, 0, NULL, CONTAINED_WITHIN, context, NULL, NULL, NULL);
 
9402
  return SeqMgrGetBestOverlappingFeat (slp, FEATDEF_BIOSRC, NULL, 0, NULL, CONTAINED_WITHIN, context, NULL, NULL, NULL, FALSE);
9168
9403
}
9169
9404
 
9170
9405
NLM_EXTERN SeqFeatPtr LIBCALL SeqMgrGetOverlappingOperon (SeqLocPtr slp, SeqMgrFeatContext PNTR context)
9171
9406
 
9172
9407
{
9173
 
  return SeqMgrGetBestOverlappingFeat (slp, FEATDEF_operon, NULL, 0, NULL, CONTAINED_WITHIN, context, NULL, NULL, NULL);
 
9408
  return SeqMgrGetBestOverlappingFeat (slp, FEATDEF_operon, NULL, 0, NULL, CONTAINED_WITHIN, context, NULL, NULL, NULL, FALSE);
9174
9409
}
9175
9410
 
9176
9411
/*****************************************************************************
9275
9510
          context->partialL = feat->partialL;
9276
9511
          context->partialR = feat->partialR;
9277
9512
          context->farloc = feat->farloc;
 
9513
          context->bad_order = feat->bad_order;
 
9514
          context->mixed_strand = feat->mixed_strand;
9278
9515
          context->strand = feat->strand;
9279
9516
          context->seqfeattype = seqfeattype;
9280
9517
          context->featdeftype = feat->subtype;
9398
9635
          context->partialL = feat->partialL;
9399
9636
          context->partialR = feat->partialR;
9400
9637
          context->farloc = feat->farloc;
 
9638
          context->bad_order = feat->bad_order;
 
9639
          context->mixed_strand = feat->mixed_strand;
9401
9640
          context->strand = feat->strand;
9402
9641
          context->seqfeattype = sfp->data.choice;;
9403
9642
          context->featdeftype = feat->subtype;
9519
9758
 
9520
9759
{
9521
9760
  return SeqMgrGetBestOverlappingFeat (slp, subtype, (SMFeatItemPtr PNTR) featarray,
9522
 
                                       numfeats, position, overlapType, context, NULL, NULL, NULL);
 
9761
                                       numfeats, position, overlapType, context, NULL, NULL, NULL, FALSE);
9523
9762
}
9524
9763
 
9525
9764
NLM_EXTERN Int2 LIBCALL SeqMgrGetAllOverlappingFeatures (SeqLocPtr slp, Uint2 subtype,
9535
9774
 
9536
9775
  SeqMgrGetBestOverlappingFeat (slp, subtype, (SMFeatItemPtr PNTR) featarray,
9537
9776
                                numfeats, NULL, overlapType, &context, &count,
9538
 
                                userdata, userfunc);
 
9777
                                userdata, userfunc, FALSE);
9539
9778
 
9540
9779
  return count;
9541
9780
}
9579
9818
    context->partialL = item->partialL;
9580
9819
    context->partialR = item->partialR;
9581
9820
    context->farloc = item->farloc;
 
9821
    context->bad_order = item->bad_order;
 
9822
    context->mixed_strand = item->mixed_strand;
9582
9823
    context->strand = item->strand;
9583
9824
    if (curr != NULL) {
9584
9825
      context->seqfeattype = curr->data.choice;
9781
10022
          context->partialL = item->partialL;
9782
10023
          context->partialR = item->partialR;
9783
10024
          context->farloc = item->farloc;
 
10025
          context->bad_order = item->bad_order;
 
10026
          context->mixed_strand = item->mixed_strand;
9784
10027
          context->strand = item->strand;
9785
10028
          context->seqfeattype = seqfeattype;
9786
10029
          context->featdeftype = item->subtype;
10258
10501
        context.partialL = item->partialL;
10259
10502
        context.partialR = item->partialR;
10260
10503
        context.farloc = item->farloc;
 
10504
        context.bad_order = item->bad_order;
 
10505
        context.mixed_strand = item->mixed_strand;
10261
10506
        context.strand = item->strand;
10262
10507
        context.seqfeattype = seqfeattype;
10263
10508
        context.featdeftype = item->subtype;
10421
10666
        context.partialL = item->partialL;
10422
10667
        context.partialR = item->partialR;
10423
10668
        context.farloc = item->farloc;
 
10669
        context.bad_order = item->bad_order;
 
10670
        context.mixed_strand = item->mixed_strand;
10424
10671
        context.strand = item->strand;
10425
10672
        context.seqfeattype = seqfeattype;
10426
10673
        context.featdeftype = item->subtype;
10812
11059
  }
10813
11060
 
10814
11061
  bsp = BioseqLockById (sip);
 
11062
  if (bsp == NULL) return;
10815
11063
  ValNodeAddPointer (vnpp, 0, (Pointer) bsp);
10816
11064
 
10817
11065
  /* now recurse if component is also far delta or seg */
10981
11229
  Boolean products,
10982
11230
  Boolean alignments,
10983
11231
  Boolean history,
 
11232
  Boolean inference,
10984
11233
  Boolean others
10985
11234
)
10986
11235
 
10993
11242
  func = smp->seq_id_precache_func;
10994
11243
  SeqMgrUnlock ();
10995
11244
  if (func == NULL) return 0;
10996
 
  return (*func) (sep, components, locations, products, alignments, history, others);
 
11245
  return (*func) (sep, components, locations, products, alignments, history, inference, others);
10997
11246
}
10998
11247
 
10999
11248
/*****************************************************************************