63
63
#include <util/creaders/alnread.h>
64
64
#include <pmfapi.h>
65
65
#include <tax3api.h>
66
#ifdef INTERNAL_NCBI_TBL2ASN
67
#include <accpubseq.h>
67
#define TBL2ASN_APP_VER "5.3"
70
#define TBL2ASN_APP_VER "5.9"
69
72
CharPtr TBL2ASN_APPLICATION = TBL2ASN_APP_VER;
2456
static SeqEntryPtr MakeUnk100GapSep (void)
2462
sep = SeqEntryNew ();
2463
if (sep == NULL) return NULL;
2465
if (bsp == NULL) return NULL;
2466
bsp->repr = Seq_repr_virtual;
2467
bsp->mol = Seq_mol_na;
2469
bsp->id = SeqIdParse ("lcl|unk100");
2471
sep->data.ptrvalue = bsp;
2472
SeqMgrSeqEntry (SM_BIOSEQ, (Pointer) bsp, sep);
2451
2476
static Uint2 ProcessDeltaSet (
2453
2478
BioSourcePtr src,
2461
2486
BioseqPtr bsp, deltabsp;
2462
2487
BioseqSetPtr bssp;
2463
2488
Uint2 entityID;
2464
SeqEntryPtr firstsep, lastsep, nextsep, sep, topsep;
2489
SeqEntryPtr firstsep, lastsep, nextsep, sep, tmp, topsep;
2465
2490
IntFuzzPtr ifp;
2466
2491
Boolean is_unk100;
2467
2492
ObjectIdPtr oip;
2491
2516
if (firstsep == NULL) {
2492
2517
firstsep = sep;
2519
if (tbl->implicitgaps && lastsep != NULL) {
2520
tmp = MakeUnk100GapSep ();
2522
ValNodeLink (&lastsep, tmp);
2494
2526
if (lastsep != NULL) {
2495
2527
ValNodeLink (&lastsep, sep);
4030
4062
center = (CharPtr) userdata;
4031
4063
if (StringHasNoText (center)) return;
4033
for (sip = bsp->id; sip != NULL; sip = sip->next) {
4034
if (sip->choice != SEQID_LOCAL) continue;
4035
oip = (ObjectIdPtr) sip->data.ptrvalue;
4036
if (oip == NULL) continue;
4037
if (StringDoesHaveText (oip->str)) {
4065
for (sip = bsp->id; sip != NULL && sip->choice != SEQID_LOCAL; sip = sip->next) continue;
4066
if (sip == NULL) return;
4067
oip = (ObjectIdPtr) sip->data.ptrvalue;
4068
if (oip == NULL) return;
4041
4070
if (StringHasNoText (accn)) return;
4043
4072
dbt = DbtagNew ();
4048
4077
dbt->db = StringSave (center);
4049
4078
dbt->tag = oip;
4080
sip->data.ptrvalue = ObjectIdFree ((ObjectIdPtr) sip->data.ptrvalue);
4081
sip->data.ptrvalue = (Pointer) dbt;
4082
sip->choice = SEQID_GENERAL;
4051
4084
ValNodeAddPointer (&(bsp->id), SEQID_GENERAL, (Pointer) dbt);
4052
4086
SeqMgrReplaceInBioseqIndex (bsp);
4892
4929
/* Args structure contains command-line arguments */
4894
#define p_argInputPath 0
4895
#define r_argOutputPath 1
4896
#define i_argInputFile 2
4897
#define o_argOutputFile 3
4898
#define x_argSuffix 4
4899
#define t_argTemplate 5
4900
#define s_argFastaSet 6
4901
#define w_argWhichClass 7
4902
#define d_argDeltaSet 8
4903
#define l_argAlignment 9
4904
#define z_argGapped 10
4905
#define e_argPhrapAce 11
4906
#define g_argGenProdSet 12
4907
#define a_argAccession 13
4908
#define C_argCenter 14
4909
#define n_argOrgName 15
4910
#define j_argSrcQuals 16
4911
#define y_argComment 17
4912
#define Y_argCommentFile 18
4913
#define c_argFindOrf 19
4914
#define m_argAltStart 20
4915
#define k_argConflict 21
4916
#define v_argValidate 22
4917
#define b_argGenBank 23
4918
#define q_argFileID 24
4919
#define u_argUndoGPS 25
4920
#define h_argGnlToNote 26
4921
#define B_argBegGap 27
4922
#define E_argEndGap 28
4923
#define G_argMidGap 29
4924
#define X_argMissing 30
4925
#define M_argMatch 31
4926
#define P_argIsProt 32
4927
#define R_argRemote 33
4928
#define S_argSmartFeats 34
4929
#define Q_argSmartTitle 35
4930
#define U_argUnnecXref 36
4931
#define L_argLocalID 37
4932
#define T_argTaxLookup 38
4931
#define p_argInputPath 0
4932
#define r_argOutputPath 1
4933
#define i_argInputFile 2
4934
#define o_argOutputFile 3
4935
#define x_argSuffix 4
4936
#define t_argTemplate 5
4937
#define s_argFastaSet 6
4938
#define w_argWhichClass 7
4939
#define d_argDeltaSet 8
4940
#define l_argAlignment 9
4941
#define z_argGapped 10
4942
#define e_argPhrapAce 11
4943
#define g_argGenProdSet 12
4944
#define F_argFeatIdLinks 13
4945
#define H_argImplicitGaps 14
4946
#define a_argAccession 15
4947
#define C_argCenter 16
4948
#define n_argOrgName 17
4949
#define j_argSrcQuals 18
4950
#define y_argComment 19
4951
#define Y_argCommentFile 20
4952
#define c_argFindOrf 21
4953
#define m_argAltStart 22
4954
#define k_argConflict 23
4955
#define v_argValidate 24
4956
#define b_argGenBank 25
4957
#define q_argFileID 26
4958
#define u_argUndoGPS 27
4959
#define h_argGnlToNote 28
4960
#define B_argBegGap 29
4961
#define E_argEndGap 30
4962
#define G_argMidGap 31
4963
#define X_argMissing 32
4964
#define M_argMatch 33
4965
#define P_argIsProt 34
4966
#define R_argRemote 35
4967
#define S_argSmartFeats 36
4968
#define Q_argSmartTitle 37
4969
#define U_argUnnecXref 38
4970
#define L_argLocalID 39
4971
#define T_argTaxLookup 40
4934
4973
Args myargs [] = {
4935
4974
{"Path to files", NULL, NULL, NULL,
4958
4997
TRUE, 'e', ARG_BOOLEAN, 0.0, 0, NULL},
4959
4998
{"Genomic Product Set", "F", NULL, NULL,
4960
4999
TRUE, 'g', ARG_BOOLEAN, 0.0, 0, NULL},
5000
{"Feature ID Links", "F", NULL, NULL,
5001
TRUE, 'F', ARG_BOOLEAN, 0.0, 0, NULL},
5002
{"Implicit Gaps", "F", NULL, NULL,
5003
TRUE, 'H', ARG_BOOLEAN, 0.0, 0, NULL},
4961
5004
{"Accession", NULL, NULL, NULL,
4962
5005
TRUE, 'a', ARG_STRING, 0.0, 0, NULL},
4963
5006
{"Genome center tag", NULL, NULL, NULL,
5092
5135
outfile = (CharPtr) myargs [o_argOutputFile].strvalue;
5093
5136
tmplate = (CharPtr) myargs [t_argTemplate].strvalue;
5138
if (StringHasNoText(directory) && StringHasNoText(base)) {
5139
Message (MSG_FATAL, "You must supply either an input file (-i) or an input directory (-p).\nUse -p . to specify the current directory.\n\n");
5095
5142
remote = (Boolean) myargs [R_argRemote].intvalue;
5097
5144
tbl.fastaset = (Boolean) myargs [s_argFastaSet].intvalue;
5101
5148
tbl.gapped = (Boolean) myargs [z_argGapped].intvalue;
5102
5149
tbl.phrapace = (Boolean) myargs [e_argPhrapAce].intvalue;
5103
5150
tbl.genprodset = (Boolean) myargs [g_argGenProdSet].intvalue;
5151
tbl.makelinks = (Boolean) myargs [F_argFeatIdLinks].intvalue;
5152
tbl.implicitgaps = (Boolean) myargs [H_argImplicitGaps].intvalue;
5104
5153
tbl.forcelocalid = (Boolean) myargs [L_argLocalID].intvalue;
5105
5154
tbl.gpstonps = (Boolean) myargs [u_argUndoGPS].intvalue;
5106
5155
tbl.gnltonote = (Boolean) myargs [h_argGnlToNote].intvalue;
5258
5307
/* register fetch function */
5310
#ifdef INTERNAL_NCBI_TBL2ASN
5311
if (! PUBSEQBioseqFetchEnable ("tbl2asn", FALSE)) {
5312
Message (MSG_POSTERR, "PUBSEQBioseqFetchEnable failed");
5261
5316
PubSeqFetchEnable ();
5264
5320
/* process one or more records */