/*************************************************************************** * * SPI_FindAllNuc is a SeqEntryExplore callback function that puts all * the nucleotide bioseqs in a seqentry into a linked list of SPI_bsinfoPtrs. * ***************************************************************************/ static void SPI_FindAllNuc(SeqEntryPtr sep, Pointer data, Int4 index, Int2 indent) { BioseqPtr bsp; SPI_bsinfoPtr spi; SPI_bsinfoPtr PNTR spim_head; spim_head = (SPI_bsinfoPtr PNTR)data; spi = *spim_head; if (IS_Bioseq(sep)) { bsp = (BioseqPtr)sep->data.ptrvalue; if (ISA_na(bsp->mol)) { if (spi != NULL) { while (spi->next != NULL) { spi = spi->next; } spi->next = (SPI_bsinfoPtr)MemNew(sizeof(SPI_bsinfo)); spi = spi->next; } else spi = *spim_head = (SPI_bsinfoPtr)MemNew(sizeof(SPI_bsinfo)); spi->bsp = bsp; } } }
void FindGenBank (SeqEntryPtr sep, Pointer data, Int4 index, Int2 indent) { BoolPtr ptr; BioseqPtr bsp; ValNodePtr vnp; ptr = (BoolPtr)data; if (*ptr == TRUE) /* already know */ return; if (IS_Bioseq(sep)) { bsp = (BioseqPtr)(sep->data.ptrvalue); /* GenBank is a limited view of the world */ if ( (ISA_na(bsp->mol)) && ( (bsp->repr == Seq_repr_raw) || (bsp->repr == Seq_repr_delta) ) ) { for (vnp = bsp->id; vnp != NULL; vnp = vnp->next) { switch (vnp->choice) { case SEQID_GENBANK: case SEQID_EMBL: case SEQID_DDBJ: *ptr = TRUE; return; default: break; } } } } return; }
static void SeqEntryRawseq(SeqEntryPtr sep, Pointer data, Int4 index, Int2 indent) { FastaPtr tfa; BioseqPtr bsp; if (!IS_Bioseq(sep)) return; bsp = (BioseqPtr)sep->data.ptrvalue; tfa = (FastaPtr) data; BioseqRawToRaw(bsp, tfa->idonly, tfa->whichSeq, tfa->seqnum, tfa->seq, tfa->seqid, tfa->seqlen); }
NLM_EXTERN SeqEntryPtr MakeSeqEntryFromContig (TContigPtr contig) { CharPtr seq_data; SeqIdPtr sip; SeqEntryPtr sep = NULL; BioseqPtr bsp; SeqGraphPtr sgp; SeqAnnotPtr sap; SeqDescrPtr sdp; MolInfoPtr mip; if (contig == NULL) { return NULL; } seq_data = AlignmentStringToSequenceString (contig->consensus_seq, Seq_mol_na); sip = MakeSeqID (contig->consensus_id); sep = SequenceStringToSeqEntry (seq_data, sip, Seq_mol_na); if (sep != NULL && IS_Bioseq (sep)) { bsp = (BioseqPtr) sep->data.ptrvalue; bsp->mol = Seq_mol_rna; /* add molinfo */ sdp = bsp->descr; while (sdp != NULL && sdp->choice != Seq_descr_molinfo) { sdp = sdp->next; } if (sdp == NULL) { sdp = SeqDescrNew (bsp->descr); if (bsp->descr == NULL) { bsp->descr = sdp; } sdp->choice = Seq_descr_molinfo; mip = MolInfoNew (); mip->biomol = MOLECULE_TYPE_MRNA; sdp->data.ptrvalue = mip; } else { mip = (MolInfoPtr) sdp->data.ptrvalue; } mip->tech = MI_TECH_tsa; sgp = SeqGraphFromContig (contig, bsp); if (sgp != NULL) { sap = SeqAnnotNew (); sap->type = 3; sap->data = sgp; sap->next = bsp->annot; bsp->annot = sap; } } return sep; }
NLM_EXTERN SeqEntryPtr MakeSeqEntryFromRead (TContigReadPtr read) { CharPtr seq_data; SeqIdPtr sip; SeqEntryPtr sep = NULL; BioseqPtr bsp; SeqDescrPtr sdp; MolInfoPtr mip; if (read == NULL) { return NULL; } seq_data = AlignmentStringToSequenceString (read->read_seq, Seq_mol_na); sip = MakeSeqID (read->read_id); sep = SequenceStringToSeqEntry (seq_data, sip, Seq_mol_na); if (sep != NULL && IS_Bioseq (sep)) { bsp = (BioseqPtr) sep->data.ptrvalue; bsp->mol = Seq_mol_rna; if (read->is_complement) { BioseqRevComp (bsp); } /* add molinfo */ sdp = bsp->descr; while (sdp != NULL && sdp->choice != Seq_descr_molinfo) { sdp = sdp->next; } if (sdp == NULL) { sdp = SeqDescrNew (bsp->descr); if (bsp->descr == NULL) { bsp->descr = sdp; } sdp->choice = Seq_descr_molinfo; mip = MolInfoNew (); mip->biomol = MOLECULE_TYPE_MRNA; sdp->data.ptrvalue = mip; } else { mip = (MolInfoPtr) sdp->data.ptrvalue; } mip->tech = MI_TECH_tsa; } return sep; }
static void PrintFarQualScores (SeqEntryPtr sep, Pointer data, Int4 index, Int2 indent) { BioseqPtr bsp; FILE *fp; if (IS_Bioseq (sep)) { bsp = (BioseqPtr) sep->data.ptrvalue; /* WARNING: we're assuming here that asn2fast's quality-score output is DNA-centric, thus protein bioseqs can be ignored in the PrintQualScores callback. --MLC, 5/2000 */ if (ISA_aa(bsp->mol)) return; fp = (FILE*) data; if (myargs [17].intvalue) { PrintQualityScoresForContig (bsp, FALSE, fp); } else { PrintQualityScoresForContig (bsp, TRUE, fp); } } }
/***************************************************************************** * * PrintIdDefLine * SeqEntryExplore callback routine that prints the seqids and definition * lines. * *****************************************************************************/ static void PrintIdDefLine (SeqEntryPtr sep, Pointer data, Int4 index, Int2 indent) { BioseqPtr bsp; FILE * fp; Char buf[40]; CharPtr title = NULL; if (IS_Bioseq (sep)) { *buf = '\0'; bsp = (BioseqPtr) sep->data.ptrvalue; fp = (FILE *) data; title = BioseqGetTitle(bsp); /* this does not deal with all cases */ SeqIdPrint(bsp->id, buf, PRINTID_FASTA_LONG); /* print SeqId */ if (pmon != NULL) MonitorStrValue(pmon, buf); fprintf(fp, ">%s", buf); if (title != NULL) fprintf(fp, " %s", title); fprintf(fp, "\n"); } return; }
static void DoRecord (SeqEntryPtr sep, Pointer userdata) { BioseqPtr bsp; SeqEntryPtr nsep; ScanDataPtr sdp; sdp = (ScanDataPtr) userdata; (sdp->recordCount)++; nsep = FindNthBioseq (sep, 1); if (nsep != NULL && IS_Bioseq (nsep)) { bsp = (BioseqPtr) nsep->data.ptrvalue; if (bsp != NULL) { SeqIdWrite (bsp->id, sdp->buf, PRINTID_FASTA_LONG, sizeof (sdp->buf)); } } #ifdef OS_UNIX /* printf ("%s\n", sdp->buf); */ #endif VisitPubdescsInSep (sep, (Pointer) sdp, DoThesis); /* check for 'genomic DNA' in DoTitle suppressed for bulk submissions */ sdp->bulk = FALSE; VisitDescriptorsInSep (sep, (Pointer) sdp, LookForBulk); VisitDescriptorsInSep (sep, (Pointer) sdp, DoTitle); VisitFeaturesInSep (sep, (Pointer) sdp, DoImpCDSandTrna); /* index for pseudo cds, impfeat peptides codon frame */ SeqMgrIndexFeatures (0, sep->data.ptrvalue); VisitFeaturesInSep (sep, (Pointer) sdp, DoPseudoCDS); VisitFeaturesInSep (sep, (Pointer) sdp, DoPeptide); /* now cleanup, index for overlapping peptides */ SeriousSeqEntryCleanup (sep, NULL, NULL); SeqMgrIndexFeatures (0, sep->data.ptrvalue); VisitBioseqsInSep (sep, (Pointer) sdp, DoProteins); /* VisitBioseqsInSep (sep, (Pointer) sdp, DoGraphs); */ #if 0 { Boolean hasUser = FALSE; VisitFeaturesInSep (sep, (Pointer) &hasUser, DoUser); if (hasUser && sdp->aop != NULL && sdp->atp_se != NULL) { SeqEntryAsnWrite (sep, sdp->aop, sdp->atp_se); } } #endif }
static void GetPubFromGenBank (SeqEntryPtr sep, Pointer data, Int4 index, Int2 indent) { BioseqPtr bsp; BioseqContextPtr bcp; SeqFeatPtr sfp; ValNodePtr vnp; FILE * fp; CharPtr accession = NULL; ValNode tpub; TextSeqIdPtr tsip; PubdescPtr pdp; Char buf[40]; if (! IS_Bioseq(sep)) return; fp = (FILE *) data; /* get the output file pointer */ bsp = (BioseqPtr) sep->data.ptrvalue; if (pmon != NULL) { *buf = '\0'; SeqIdPrint(bsp->id, buf, PRINTID_FASTA_LONG); MonitorStrValue(pmon, buf); } for (vnp = bsp->id; ((vnp != NULL) && (accession == NULL)); vnp = vnp->next) { switch (vnp->choice) { case SEQID_GENBANK: case SEQID_EMBL: case SEQID_DDBJ: tsip = (TextSeqIdPtr)(vnp->data.ptrvalue); if (tsip->accession != NULL) accession = tsip->accession; break; default: break; } } if (accession == NULL) return; bcp = BioseqContextNew(bsp); if (bcp == NULL) return; vnp = NULL; tpub.choice = PUB_Equiv; tpub.next = NULL; /* get any pub descriptors */ while ((vnp = BioseqContextGetSeqDescr(bcp, (Int2)Seq_descr_pub, vnp, NULL)) != NULL) { pdp = (PubdescPtr)(vnp->data.ptrvalue); /* it's a Pubdesc */ tpub.data.ptrvalue = pdp->pub; /* make Pub-equiv into a Pub */ PubWrite(accession, &tpub, fp); } sfp = NULL; while ((sfp = BioseqContextGetSeqFeat(bcp, 0, sfp, NULL, 0)) != NULL) { if (sfp->data.choice == 6) /* a pub feature */ { pdp = (PubdescPtr)(sfp->data.value.ptrvalue); tpub.data.ptrvalue = pdp->pub; PubWrite(accession, &tpub, fp); } /* get any feature citations */ if (sfp->cit != NULL) { for (vnp = sfp->cit->data.ptrvalue; vnp != NULL; vnp = vnp->next) PubWrite(accession, vnp, fp); } } BioseqContextFree(bcp); return; }
void BEPrintIds(BEDataPtr pBdata, Uint4 *ids, int count) { Int4 i; SeqEntryPtr sep, sep_all; Boolean retvalue = TRUE; SeqIdPtr sip = NULL; BioseqPtr bsp; BGenBankPtr bgbp; AsnIoPtr aip; Boolean is_na = FALSE; if(pBdata->format == F_GILIST) { for(i = 0; i < count; i++) fprintf(stdout, "%d\n", (int) ids[i]); return; } if(pBdata->database == 0) is_na = TRUE; if(pBdata->format == F_ASN1_GENB) bgbp = BGenBankInit(); for(i = 0; i < count; i++) { sep_all = BESeqEntryGet(ids[i]); if(sep_all == NULL) { ErrPostEx(SEV_ERROR, 88, 67, "Retrieving of blob for the " "gi=%d failed", (int)ids[i]); continue; } if(!pBdata->allset) { ObjMgrRegister(OBJ_SEQENTRY, sep_all); sip = ValNodeNew(NULL); sip->choice = SEQID_GI; sip->data.intvalue = ids[i]; if((bsp = BioseqFind(sip)) == NULL) { ErrPostEx(SEV_ERROR, 88, 67, "Error finding bioseq for gi=%d\n", (int)ids[i]); continue; } sep = SeqEntryNew(); sep->choice = 1; /* Bioseq */ sep->data.ptrvalue = bsp; } else { sep = sep_all; } switch(pBdata->format) { case F_FASTA: /* 1 */ if(!SeqEntryToFasta(sep, stdout, is_na)) { if(!SeqEntryToFasta(sep, stdout, !is_na)) { ErrPostEx(SEV_ERROR, 88, 67, "Printing of FASTA format " "(gi=%d) failed\r\n", (int)ids[i]); } } break; case F_ASN1: /* 2 */ aip = AsnIoNew(ASNIO_TEXT_OUT, stdout, NULL, NULL, NULL); SeqEntryAsnWrite(sep, aip, NULL); AsnIoClose(aip); break; case F_GILIST: /* 3 */ for(i = 0; i < count; i++) fprintf(stdout, "%d\n", (int) ids[i]); break; case F_DLIST: /* 4 */ if (IS_Bioseq(sep)) retvalue = SeqEntrysToDefline(sep, stdout, is_na, 3); else retvalue = SeqEntrysToDefline(sep, stdout, is_na, 0); if(retvalue == FALSE) { if (IS_Bioseq(sep)) retvalue = SeqEntrysToDefline(sep, stdout, !is_na, 3); else retvalue = SeqEntrysToDefline(sep, stdout, !is_na, 0); } break; case F_ASN1_GENB: /* 5 */ retvalue = SeqEntryAsnWrite(sep, bgbp->aip, bgbp->atp); break; default: case F_GEN: /* 0 */ if(!SeqEntryToFlatEx(sep_all, stdout, is_na ? GENBANK_FMT : GENPEPT_FMT, RELEASE_MODE, sip, FF_REGULAR)) { if(!SeqEntryToFlatEx(sep_all, stdout, is_na ? GENPEPT_FMT : GENBANK_FMT, RELEASE_MODE, sip, FF_REGULAR)) { } } break; } SeqEntryFree(sep_all); ValNodeFree(sip); } if(pBdata->format == F_ASN1_GENB) BGenBankClose(bgbp); return; }
SeqEntryPtr LIBCALL MakeBioseqs(BiostrucPtr bsp, BiostrucResidueGraphSetPtr stdDictionary) { ValNodePtr vnp, seq_set, hetval, pvnThePoints; BiostrucHistoryPtr bhp; BiostrucSourcePtr bssp; BiostrucGraphPtr bsgp; BiostrucModelPtr bsmp; BiostrucFeatureSetPtr bsfsp; BiostrucFeaturePtr bsfp; ChemGraphPntrsPtr cgpp; ResiduePtr rs; ResidueGraphPtr rgp; ResiduePntrsPtr rpp; ResidueIntervalPntrPtr ripp; ResidueExplicitPntrsPtr rpp1=NULL, rpp2=NULL; MoleculeGraphPtr bp, het, currenthet, currentbp, mgp; InterResidueBondPtr currentabp, abp; DbtagPtr dtp; SeqEntryPtr pdb_entry; BioseqSetPtr biossp; BioseqPtr bioseqs[MAXNUM], current_bioseq; Int4 DomainNum, molId1, resId1, atmId1, molId2, resId2, atmId2; Int4 nbp, nhet, num_chain, index = 0, chnidx, bpchnidx, bpresidx, hetidx, rescount, bioseq_idx; Int4 ssresidx1, ssresidx2, ssmolidx1, ssmolidx2; CharPtr feature_name, rname; Boolean interchain, bonds, found1, found2; SeqAnnotPtr sap = NULL; SeqIdPtr sip; if (!bsp) { return NULL; } vnp = ValNodeFindNext(bsp->descr, NULL, BiostrucDescr_history); if (vnp) { bhp = (BiostrucHistoryPtr) vnp->data.ptrvalue; bssp = bhp->data_source; } bsgp = bsp->chemical_graph; bsmp = bsp->model; nbp = NumberOfBioChains(bsgp->molecule_graphs); bp = MakeBioGraphPtr(bsgp->molecule_graphs); nhet = NumberOfHetChains(bsgp->molecule_graphs, bp); het = MakeHetGraphPtr(bsgp->molecule_graphs, bp); pdb_entry = CreateSeqEntry(bssp, bsgp, bsmp, bsp->descr, nbp); if (IS_Bioseq(pdb_entry)) { vnp = ValNodeFindNext(pdb_entry, NULL, 1); bioseqs[index] = (BioseqPtr) vnp->data.ptrvalue; } else { vnp = ValNodeFindNext(pdb_entry, NULL, 2); biossp = (BioseqSetPtr) vnp->data.ptrvalue; seq_set = biossp->seq_set; for (num_chain = 0; num_chain < nbp, seq_set; seq_set = seq_set->next, num_chain++, index++) bioseqs[index] = (BioseqPtr) seq_set->data.ptrvalue; } dtp = (DbtagPtr)bssp->database_entry_id->data.ptrvalue; for (index = 0, currentbp = bp; index < nbp, currentbp != NULL; currentbp = currentbp->next, index++) { current_bioseq = bioseqs[index]; if (currentbp->seq_id->choice == '\f') { current_bioseq->id = MakePDBId(bssp, currentbp, dtp); sip = ValNodeNew(NULL); sip->choice = SEQID_GI; sip->data.intvalue = currentbp->seq_id->data.intvalue; current_bioseq->id->next = sip; } else if (currentbp->seq_id->choice == SEQID_LOCAL) current_bioseq->id = MakeLocalID(-99999, currentbp, dtp); current_bioseq->descr = MakeBioseqDescr(currentbp, current_bioseq->descr); current_bioseq->mol = MakeBioseqMol(currentbp); current_bioseq->length = CountNumOfResidues(currentbp); if (current_bioseq->mol == Seq_mol_aa) current_bioseq->seq_data_type = Seq_code_iupacaa; else current_bioseq->seq_data_type = Seq_code_iupacna; current_bioseq->seq_data = AddSeqData(currentbp, current_bioseq->mol, current_bioseq->length, bsgp, stdDictionary); current_bioseq->annot = AddNstdSeqAnnot(currentbp, current_bioseq->id, bsgp); } /* Add information about Secondary Structure and Domains */ for (bsfsp = bsp->features, DomainNum = 0; bsfsp; bsfsp = bsfsp->next) { if (vnp = ValNodeFindNext(bsfsp->descr, NULL, BiostrucFeatureSetDescr_name)) feature_name = vnp->data.ptrvalue; if ((!StringICmp("NCBI assigned secondary structure", feature_name)) || (!StringICmp("NCBI Domains", feature_name))) { for (bsfp = bsfsp->features; bsfp; bsfp = bsfp->next) { cgpp = (ChemGraphPntrsPtr)bsfp->Location_location->data.ptrvalue; rpp = (ResiduePntrsPtr)cgpp->data.ptrvalue; ripp = (ResidueIntervalPntrPtr)rpp->data.ptrvalue; chnidx = findChnidx(ripp->molecule_id, nbp, bp); current_bioseq = bioseqs[chnidx-1]; if (!StringICmp("NCBI Domains", feature_name)) DomainNum++; if (current_bioseq->annot) current_bioseq->annot = AddSecDomToSeqAnnot(bsfp, feature_name, current_bioseq->annot, current_bioseq->id, DomainNum); else current_bioseq->annot = AddSecDomToSeqAnnot(bsfp, feature_name, NULL, current_bioseq->id, DomainNum); } } } for (index = 0, currenthet = het; index < nhet, currenthet; currenthet = currenthet->next, index++) { hetval = MakeHetValNode(currenthet, stdDictionary, bsgp->residue_graphs); bioseq_idx = 0; interchain = FALSE; for (abp = bsgp->inter_molecule_bonds, bonds = FALSE, rescount = 0; abp; abp = abp->next) { molId1 = abp->atom_id_1->molecule_id; molId2 = abp->atom_id_2->molecule_id; resId1 = abp->atom_id_1->residue_id; resId2 = abp->atom_id_2->residue_id; atmId1 = abp->atom_id_1->atom_id; atmId2 = abp->atom_id_2->atom_id; if (isBiopoly(molId1, bp) && isHet(molId2, het)) { bpchnidx = molId1 - 1; bpresidx = resId1 - 1; hetidx = getHetIdx(molId2, het); bonds = TRUE; } else if (isBiopoly(molId2, bp) && isHet(molId1, het)) { bpchnidx = molId2 - 1; bpresidx = resId2 - 1; hetidx = getHetIdx(molId1, het); bonds = TRUE; } if (bonds) { if (hetidx == index) { if (!rescount) pvnThePoints = NULL; ValNodeAddInt(&pvnThePoints, 0, bpresidx); rescount++; if (bioseq_idx >= 0) { if (bioseq_idx != bpchnidx) interchain = TRUE; } bioseq_idx = bpchnidx; } } } if (rescount) { if (!interchain) { current_bioseq = bioseqs[bioseq_idx]; if (current_bioseq->annot) current_bioseq->annot = AddHetToSeqAnnot(current_bioseq->annot, current_bioseq->id, hetval, pvnThePoints, rescount); else current_bioseq->annot = AddHetToSeqAnnot(NULL, current_bioseq->id, hetval, pvnThePoints, rescount); } if (interchain) { if (IS_Bioseq(pdb_entry)) sap = ((BioseqPtr)(pdb_entry->data.ptrvalue))->annot; else sap = ((BioseqSetPtr)(pdb_entry->data.ptrvalue))->annot; if (sap == NULL) { sap = SeqAnnotNew(); sap->type = 1; if (IS_Bioseq(pdb_entry)) ((BioseqPtr)(pdb_entry->data.ptrvalue))->annot = sap; else ((BioseqSetPtr)(pdb_entry->data.ptrvalue))->annot = sap; } sap = AddHetToSeqAnnot(sap, bioseqs[bioseq_idx]->id, hetval, pvnThePoints, rescount); } } else { current_bioseq = bioseqs[bioseq_idx]; vnp = current_bioseq->descr; if (vnp != NULL) { while (vnp->next != NULL) vnp = vnp->next; vnp->next = hetval; } else current_bioseq->descr = hetval; } } mgp = bsgp->molecule_graphs; abp = bsgp->inter_molecule_bonds; while(1) { if (mgp != NULL) { currentabp = mgp->inter_residue_bonds; mgp = mgp->next; } while (currentabp != NULL) { molId1 = currentabp->atom_id_1->molecule_id; molId2 = currentabp->atom_id_2->molecule_id; resId1 = currentabp->atom_id_1->residue_id; resId2 = currentabp->atom_id_2->residue_id; atmId1 = currentabp->atom_id_1->atom_id; atmId2 = currentabp->atom_id_2->atom_id; interchain = FALSE; found1 = FALSE; found2 = FALSE; if ((getAtomElementIdx(molId1, resId1, atmId1, bsgp, stdDictionary)==16) && (getAtomElementIdx(molId2, resId2, atmId2, bsgp, stdDictionary)==16)) { /* Found possible disulfide bonds. */ if (isBiopoly(molId1, bp) && isBiopoly(molId2, bp)) { currentbp = bp; for (index=0; index<findChnidx(molId1, nbp, bp)-1; index++) currentbp = currentbp->next; rs = currentbp->residue_sequence; while (rs) { if (rs->id == resId1) { rgp = getResGraph(rs->residue_graph, bsgp, stdDictionary); break; } rs = rs->next; } if (vnp = ValNodeFindNext(rgp->descr, NULL, BiomolDescr_name)) rname = vnp->data.ptrvalue; if (!StringICmp(rname, "CYS")) found1 = TRUE; currentbp = bp; for (index = 0; index < findChnidx(molId2, nbp, bp)-1; index++) currentbp = currentbp->next; rs = currentbp->residue_sequence; while (rs) { if (rs->id == resId2) { rgp = getResGraph(rs->residue_graph, bsgp, stdDictionary); break; } rs = rs->next; } if (vnp = ValNodeFindNext(rgp->descr, NULL, BiomolDescr_name)) rname = vnp->data.ptrvalue; if (!StringICmp(rname, "CYS")) found2 = TRUE; if (found1 && found2) { ssresidx1 = resId1 - 1; ssresidx2 = resId2 - 1; ssmolidx1 = molId1 - 1; ssmolidx2 = molId2 - 1; chnidx = findChnidx(molId1, nbp, bp); if (ssmolidx1 == ssmolidx2) { current_bioseq = bioseqs[chnidx - 1]; if (current_bioseq->annot) current_bioseq->annot = AddDisulToSeqAnnot(current_bioseq->annot, ssresidx1, ssresidx2, current_bioseq->id, current_bioseq->id); else current_bioseq->annot = AddDisulToSeqAnnot(NULL, ssresidx1, ssresidx2, current_bioseq->id, current_bioseq->id); } else { if (IS_Bioseq(pdb_entry)) sap = ((BioseqPtr)(pdb_entry->data.ptrvalue))->annot; else sap = ((BioseqSetPtr)(pdb_entry->data.ptrvalue))->annot; if (sap == NULL) { sap = SeqAnnotNew(); sap->type = 1; if (IS_Bioseq(pdb_entry)) ((BioseqPtr)(pdb_entry->data.ptrvalue))->annot = sap; else ((BioseqSetPtr)(pdb_entry->data.ptrvalue))->annot = sap; } sap = AddDisulToSeqAnnot(sap, ssresidx1, ssresidx2, bioseqs[ssmolidx1]->id, bioseqs[ssmolidx2]->id); } } } } currentabp = currentabp->next; } if ((currentabp == NULL) && (mgp == NULL) && (abp == NULL)) break; else if((currentabp == NULL) && (mgp == NULL) && (abp != NULL)) { currentabp = abp; abp = NULL; } } return pdb_entry; }