~ubuntu-branches/ubuntu/quantal/ncbi-tools6/quantal

« back to all changes in this revision

Viewing changes to api/sequtil.c

Tags: upstream-6.1.20081116a
ImportĀ upstreamĀ versionĀ 6.1.20081116a

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
*   
30
30
* Version Creation Date: 4/1/91
31
31
*
32
 
* $Revision: 6.241 $
 
32
* $Revision: 6.259 $
33
33
*
34
34
* File Description:  Sequence Utilities for objseq and objsset
35
35
*
2448
2448
    60,  /* 15 = pdb */
2449
2449
    60,  /* 16 = tpg */
2450
2450
    60,  /* 17 = tpe */
2451
 
    62,  /* 18 = tpd */
2452
 
    68   /* 19 = gpp */
 
2451
    60,  /* 18 = tpd */
 
2452
    68,  /* 19 = gpp */
 
2453
    69   /* 20 = nat */
2453
2454
    };
2454
2455
 
2455
2456
    if (buf == NULL) return NUM_SEQID;
2591
2592
        "tpg",      /* tpg = tpg|accession|name */
2592
2593
        "tpe",      /* tpe = tpe|accession|name */
2593
2594
        "tpd",      /* tpd = tpd|accession|name */
2594
 
        "gpp"};     /* gpp = gpp|accession|name */
 
2595
        "gpp",      /* gpp = gpp|accession|name */
 
2596
        "nat"};     /* nat = nat|accession|name */
2595
2597
 
2596
2598
/*****************************************************************************
2597
2599
*
2674
2676
    10,  /* 16 = tpg */
2675
2677
    10,  /* 17 = tpe */
2676
2678
    10,  /* 18 = tpd */
2677
 
    15   /* 19 = gpp */
 
2679
    15,  /* 19 = gpp */
 
2680
    15   /* 20 = nat */
2678
2681
    };
2679
2682
    static Uint1 tmsmart_order[NUM_SEQID] = {  /* order for other id FASTA_LONG */
2680
2683
     33, /* 0 = not set */
2696
2699
    10,  /* 16 = tpg */
2697
2700
    10,  /* 17 = tpe */
2698
2701
    10,  /* 18 = tpd */
2699
 
    15   /* 19 = gpp */
 
2702
    15,  /* 19 = gpp */
 
2703
    15   /* 20 = nat */
2700
2704
    };
2701
2705
    static Uint1 general_order[NUM_SEQID] = {  /* order for other id FASTA_LONG */
2702
2706
     33, /* 0 = not set */
2718
2722
    10,  /* 16 = tpg */
2719
2723
    10,  /* 17 = tpe */
2720
2724
    10,  /* 18 = tpd */
2721
 
    15   /* 19 = gpp */
 
2725
    15,  /* 19 = gpp */
 
2726
    15   /* 20 = nat */
2722
2727
    };
2723
2728
    Boolean useGeneral = FALSE;
2724
2729
    TextSeqIdPtr tsip;
2880
2885
            case SEQID_TPE:
2881
2886
            case SEQID_TPD:
2882
2887
            case SEQID_GPIPE:
 
2888
            case SEQID_NAMED_ANNOT_TRACK:
2883
2889
                tsip = (TextSeqIdPtr)sip->data.ptrvalue;
2884
2890
                release = tsip->release;
2885
2891
                if (sip->choice == SEQID_SWISSPROT) {
2894
2900
                    return tmp;
2895
2901
                } else if ((format == PRINTID_TEXTID_ACC_VER) 
2896
2902
                    && (tsip->accession != NULL)) {
2897
 
                    if (tsip->version > 0 && release == NULL) {
 
2903
                    if (tsip->version > 0 && release == NULL && sip->choice != SEQID_GPIPE) {
2898
2904
                        sprintf(localbuf, "%s.%d", tsip->accession,
2899
2905
                            (int)(tsip->version));
2900
2906
                    } else {
2956
2962
        case SEQID_TPE:
2957
2963
        case SEQID_TPD:
2958
2964
        case SEQID_GPIPE:
 
2965
        case SEQID_NAMED_ANNOT_TRACK:
2959
2966
        case SEQID_SWISSPROT:
2960
2967
           tsip = (TextSeqIdPtr)(sip->data.ptrvalue);
2961
2968
            release = tsip->release;
2962
2969
            if (sip->choice == SEQID_SWISSPROT) {
2963
2970
              release = NULL;
2964
2971
            }
2965
 
           if (((tsip->version > 0) && (release == NULL)) && SHOWVERSION)
 
2972
           if (((tsip->version > 0) && (release == NULL) &&
 
2973
                sip->choice != SEQID_GPIPE) && SHOWVERSION)
2966
2974
             version = tsip->version;  /* show versions */
2967
2975
           sprintf(versionbuf, ".%d", (int)version);
2968
2976
        case SEQID_PIR:
3115
3123
   case SEQID_TPE:
3116
3124
   case SEQID_TPD:
3117
3125
   case SEQID_GPIPE:
 
3126
   case SEQID_NAMED_ANNOT_TRACK:
3118
3127
      textsip = (TextSeqIdPtr)sip->data.ptrvalue;
3119
3128
      if (textsip->accession) {
3120
3129
         if (get_version && textsip->version > 0) {
3208
3217
    2,  /* 16 = tpg */
3209
3218
    2,  /* 17 = tpe */
3210
3219
    2,  /* 18 = tpd */
3211
 
    2   /* 19 = gpp */
 
3220
    2,  /* 19 = gpp */
 
3221
    2,  /* 20 = nat */
3212
3222
    };
3213
3223
 
3214
3224
    if ((buf == NULL) || (*buf == '\0'))
3276
3286
                    else if ((type == SEQID_GENBANK || type == SEQID_EMBL ||
3277
3287
                            type == SEQID_DDBJ || type == SEQID_TPG ||
3278
3288
                            type == SEQID_TPE || type == SEQID_TPD ||
3279
 
                            type == SEQID_GPIPE) && numtoken == 1)
 
3289
                            type == SEQID_GPIPE || type == SEQID_NAMED_ANNOT_TRACK) &&
 
3290
                            numtoken == 1)
3280
3291
                        done = TRUE;
3281
3292
                    else if (numtoken < (Int2)(expect_tokens[type]))
3282
3293
                        goto erret;
3346
3357
            case SEQID_TPE:
3347
3358
            case SEQID_TPD:
3348
3359
            case SEQID_GPIPE:
 
3360
            case SEQID_NAMED_ANNOT_TRACK:
3349
3361
                if ((*tokens[0] == '\0') && (*tokens[1] == '\0'))
3350
3362
                    goto erret;
3351
3363
                tsip = TextSeqIdNew();
3551
3563
            case SEQID_TPE:
3552
3564
            case SEQID_TPD:
3553
3565
            case SEQID_GPIPE:
 
3566
            case SEQID_NAMED_ANNOT_TRACK:
3554
3567
                switch (b->choice)
3555
3568
                {
3556
3569
                    case SEQID_GENBANK:   /* its ok */
3560
3573
                    case SEQID_TPE:
3561
3574
                    case SEQID_TPD:
3562
3575
                    case SEQID_GPIPE:
 
3576
                    case SEQID_NAMED_ANNOT_TRACK:
3563
3577
                        break;  
3564
3578
                    default:
3565
3579
                        return SIC_DIFF;
3634
3648
        case SEQID_TPE:
3635
3649
        case SEQID_TPD:
3636
3650
        case SEQID_GPIPE:
 
3651
        case SEQID_NAMED_ANNOT_TRACK:
3637
3652
 
3638
3653
            at = (TextSeqIdPtr)a->data.ptrvalue;
3639
3654
            bt = (TextSeqIdPtr)b->data.ptrvalue;
8677
8692
          (StringICmp(temp,"EY") == 0) || 
8678
8693
          (StringICmp(temp,"FC") == 0) || 
8679
8694
          (StringICmp(temp,"FD") == 0) || 
8680
 
          (StringICmp(temp,"FE") == 0) ) {                /* NCBI EST */
 
8695
          (StringICmp(temp,"FE") == 0) || 
 
8696
          (StringICmp(temp,"FF") == 0) || 
 
8697
          (StringICmp(temp,"FG") == 0) || 
 
8698
          (StringICmp(temp,"FK") == 0) || 
 
8699
          (StringICmp(temp,"FL") == 0) || 
 
8700
          (StringICmp(temp,"GD") == 0) || 
 
8701
          (StringICmp(temp,"GE") == 0) ) {                /* NCBI EST */
8681
8702
              retcode = ACCN_NCBI_EST;
8682
 
          } else if ((StringICmp(temp,"BV") == 0)) {      /* NCBI STS */
 
8703
          } else if ((StringICmp(temp,"BV") == 0) ||
 
8704
                     (StringICmp(temp,"GF") == 0)) {      /* NCBI STS */
8683
8705
              retcode = ACCN_NCBI_STS;
8684
8706
          } else if ((StringICmp(temp,"AC") == 0) ||
8685
8707
                     (StringICmp(temp,"DP") == 0)) {      /* NCBI HTGS */
8688
8710
                     (StringICmp(temp,"AY") == 0) ||
8689
8711
                     (StringICmp(temp,"DQ") == 0) ||
8690
8712
                     (StringICmp(temp,"EF") == 0) ||
8691
 
                     (StringICmp(temp,"EU") == 0)) {      /* NCBI direct submission */
 
8713
                     (StringICmp(temp,"EU") == 0) ||
 
8714
                     (StringICmp(temp,"FJ") == 0)) {      /* NCBI direct submission */
8692
8715
              retcode = ACCN_NCBI_DIRSUB;
8693
8716
          } else if ((StringICmp(temp,"AE") == 0) ||
8694
8717
                     (StringICmp(temp,"CP") == 0) ||
8703
8726
                     (StringICmp(temp,"EN") == 0) ||
8704
8727
                     (StringICmp(temp,"EP") == 0) ||
8705
8728
                     (StringICmp(temp,"EQ") == 0) ||
8706
 
                     (StringICmp(temp,"FA") == 0)) {      /* NCBI segmented set header Bioseq */
 
8729
                     (StringICmp(temp,"FA") == 0) ||
 
8730
                     (StringICmp(temp,"GG") == 0)) {      /* NCBI segmented set header Bioseq */
8707
8731
              retcode = ACCN_NCBI_SEGSET;
8708
8732
          } else if ((StringICmp(temp,"AS") == 0)) {      /* NCBI "other" */
8709
8733
              retcode = ACCN_NCBI_OTHER;
8726
8750
                     (StringICmp(temp,"EJ") == 0) ||
8727
8751
                     (StringICmp(temp,"EK") == 0) ||
8728
8752
                     (StringICmp(temp,"ER") == 0) ||
8729
 
                     (StringICmp(temp,"ET") == 0) )  {     /* NCBI GSS */
 
8753
                     (StringICmp(temp,"ET") == 0) ||
 
8754
                     (StringICmp(temp,"FH") == 0) ||
 
8755
                     (StringICmp(temp,"FI") == 0) )  {     /* NCBI GSS */
8730
8756
              retcode = ACCN_NCBI_GSS;
8731
8757
          } else if ((StringICmp(temp,"AR") == 0) ||
8732
8758
                     (StringICmp(temp,"DZ") == 0) ||
8733
 
                     (StringICmp(temp,"EA") == 0)) {      /* NCBI patent */
 
8759
                     (StringICmp(temp,"EA") == 0) ||
 
8760
                     (StringICmp(temp,"GC") == 0)) {      /* NCBI patent */
8734
8761
              retcode = ACCN_NCBI_PATENT;
8735
8762
          } else if((StringICmp(temp,"BC")==0)) {         /* NCBI long cDNA project : MGC */
8736
8763
              retcode = ACCN_NCBI_cDNA;
8774
8801
                     (StringICmp(temp,"CJ") == 0) ||
8775
8802
                     (StringICmp(temp,"DA") == 0) ||
8776
8803
                     (StringICmp(temp,"DB") == 0) ||
8777
 
                     (StringICmp(temp,"DC") == 0)) {      /* DDBJ EST's */
 
8804
                     (StringICmp(temp,"DC") == 0) ||
 
8805
                     (StringICmp(temp,"DK") == 0)) {      /* DDBJ EST's */
8778
8806
              retcode = ACCN_DDBJ_EST;
8779
8807
          } else if ((StringICmp(temp,"AB") == 0)) {      /* DDBJ direct submission */
8780
8808
              retcode = ACCN_DDBJ_DIRSUB;
8791
8819
          } else if ((StringICmp(temp,"BD") == 0) ||
8792
8820
                     (StringICmp(temp,"DD") == 0) || 
8793
8821
                     (StringICmp(temp,"DI") == 0) || 
8794
 
                     (StringICmp(temp,"DJ") == 0)) {      /* DDBJ patent division */
 
8822
                     (StringICmp(temp,"DJ") == 0) || 
 
8823
                     (StringICmp(temp,"DL") == 0)) {      /* DDBJ patent division */
8795
8824
              retcode = ACCN_DDBJ_PATENT;
8796
8825
          } else if ((StringICmp(temp,"DE") == 0) ||
8797
8826
                     (StringICmp(temp,"DH") == 0)) {      /* DDBJ GSS */
8798
8827
              retcode = ACCN_DDBJ_GSS;
 
8828
          } else if ((StringICmp(temp,"FS") == 0) ||
 
8829
                     (StringICmp(temp,"FT") == 0) || 
 
8830
                     (StringICmp(temp,"FU") == 0) || 
 
8831
                     (StringICmp(temp,"FV") == 0) || 
 
8832
                     (StringICmp(temp,"FW") == 0) || 
 
8833
                     (StringICmp(temp,"FX") == 0) || 
 
8834
                     (StringICmp(temp,"FY") == 0) || 
 
8835
                     (StringICmp(temp,"FZ") == 0) || 
 
8836
                     (StringICmp(temp,"GA") == 0) || 
 
8837
                     (StringICmp(temp,"GB") == 0)) {      /* DDBJ unassigned */
 
8838
              retcode = ACCN_DDBJ_OTHER;
8799
8839
          } else {
8800
8840
              retcode = ACCN_IS_NT;
8801
8841
              break;