diff options
author | Aaron M. Ucko <ucko@debian.org> | 2006-03-13 15:18:51 +0000 |
---|---|---|
committer | Aaron M. Ucko <ucko@debian.org> | 2006-03-13 15:18:51 +0000 |
commit | 047f9550aeffa40eb05ad53427718889f660e0f4 (patch) | |
tree | c491506658b86eb5b9b4145a178f7bf64fe4a543 /network | |
parent | 4b1edc60532e16ec7d0255e1c3552c2e6a33737e (diff) |
Load /tmp/.../ncbi-tools6-6.1.20060301 into
branches/upstream/current.
Diffstat (limited to 'network')
-rw-r--r-- | network/id2arch/id2.asn | 7 | ||||
-rw-r--r-- | network/wwwblast/Src/Makefile.wblast2_cs | 50 | ||||
-rw-r--r-- | network/wwwblast/Src/showalignwrap.cpp | 204 | ||||
-rw-r--r-- | network/wwwblast/Src/showalignwrap.h | 77 | ||||
-rwxr-xr-x | network/wwwblast/Src/test/run.pl | 2 | ||||
-rw-r--r-- | network/wwwblast/Src/viewgif.c | 49 | ||||
-rw-r--r-- | network/wwwblast/Src/wblast2.c | 189 |
7 files changed, 527 insertions, 51 deletions
diff --git a/network/id2arch/id2.asn b/network/id2arch/id2.asn index 00c6c411..b367e57b 100644 --- a/network/id2arch/id2.asn +++ b/network/id2arch/id2.asn @@ -1,4 +1,4 @@ ---$Revision: 1.17 $ +--$Revision: 1.18 $ --******************************************************************** -- -- Network Id server network access @@ -316,7 +316,10 @@ ID2-Reply-Get-Blob-Id ::= SEQUENCE { annot-info SEQUENCE OF ID2S-Seq-annot-Info OPTIONAL, -- this Blob-id is the last one in the request - end-of-reply NULL OPTIONAL + end-of-reply NULL OPTIONAL, + + -- state of the blob + blob-state ID2-Blob-State OPTIONAL } diff --git a/network/wwwblast/Src/Makefile.wblast2_cs b/network/wwwblast/Src/Makefile.wblast2_cs new file mode 100644 index 00000000..2f0571d4 --- /dev/null +++ b/network/wwwblast/Src/Makefile.wblast2_cs @@ -0,0 +1,50 @@ +#This is makefile for web blast2 that uses c++ showalign API +builddir = $(NCBI)/c++.metastable/DebugMT/build +builddir = $(NCBI)/c++.metastable/ReleaseMT/build + +### DEFAULT COMPILATION FLAGS -- DON'T EDIT OR MOVE THESE 4 LINES !!! ### +include $(builddir)/Makefile.mk + + +LOCAL_CPPFLAGS += -I. -I/netopt/ncbi_tools/include -I../../../../internal/blast/SplitDB -DNCBI_ENTREZ_CLIENT -DNCBI_CLIENT_SERVER -DNCBI_INTERNAL_NEW_FORMATTER + +srcdir = . +BINCOPY = @: + + +APP = wblast2_cs.REAL + +SRC = wblast2 showalignwrap + +LIB = xblastformat xblast xnetblast scoremat xalntool xalnmgr blastxml xobjread ncbi_xloader_blastdb xobjutil $(OBJMGR_LIBS:=-static) xhtml xcgi seqdb blastdb + + + +CPPFLAGS = $(ORIG_CPPFLAGS) $(NCBI_C_INCLUDE) + +LIB += $(SD_DBAPI) + + +LIBS = $(NCBI_C_LIBPATH) \ + -lbob -lsplitdbasn\ + -lncbitxc2 -lnetblast -lncbiid1 -lncbidesk -lblastapi -lncbitool -lblastcompadj \ + -lnetentr -lncbiNacc -lnetentr -lnetcli \ + -lvibgif -lncbidesk -lncbi -lvibrant -lncbicdr -lncbiobj -lncbi \ + $(NCBI_OTHERLIBS) $(CMPRS_LIBS) $(NETWORK_PURE_LIBS) $(ORIG_LIBS) \ + -lresolv -lconnext -lxncbi -ldl -lblast + +CFLAGS = $(ORIG_CFLAGS) +CXXFLAGS = $(ORIG_CXXFLAGS) +LDFLAGS = $(ORIG_LDFLAGS) \ + -L../../../../internal/blast/SplitDB/lib + +# ### +############################################################################# + + +### APPLICATION BUILD RULES -- DON'T EDIT OR MOVE THIS LINE !!! ### + +include $(builddir)/Makefile.app +MAKEFILE = Makefile.light_getreq_app + +### PUT YOUR OWN ADDITIONAL TARGETS (MAKE COMMANDS/RULES) BELOW HERE ###
\ No newline at end of file diff --git a/network/wwwblast/Src/showalignwrap.cpp b/network/wwwblast/Src/showalignwrap.cpp new file mode 100644 index 00000000..e9ab1c87 --- /dev/null +++ b/network/wwwblast/Src/showalignwrap.cpp @@ -0,0 +1,204 @@ +/* $Id: showalignwrap.cpp,v 1.1 2006/01/05 17:28:57 jianye Exp $ + * =========================================================================== + * + * PUBLIC DOMAIN NOTICE + * National Center for Biotechnology Information + * + * This software/database is a "United States Government Work" under the + * terms of the United States Copyright Act. It was written as part of + * the author's official duties as a United States Government employee and + * thus cannot be copyrighted. This software/database is freely available + * to the public for use. The National Library of Medicine and the U.S. + * Government have not placed any restriction on its use or reproduction. + * + * Although all reasonable efforts have been taken to ensure the accuracy + * and reliability of the software and data, the NLM and the U.S. + * Government do not and cannot warrant the performance or results that + * may be obtained by using this software or data. The NLM and the U.S. + * Government disclaim all warranties, express or implied, including + * warranties of performance, merchantability or fitness for any particular + * purpose. + * + * Please cite the author in any work or product based on this material. + * + * =========================================================================== + * + * Author: Jian Ye + * + * File Description: + * c adaptor to showalign.cpp + * + */ + + +#include <corelib/ncbiapp.hpp> +#include <corelib/ncbiargs.hpp> +#include <corelib/ncbienv.hpp> +#include <corelib/ncbistre.hpp> +#include <serial/iterator.hpp> +#include <serial/objistr.hpp> +#include <serial/objostr.hpp> +#include <serial/serial.hpp> +#include <objtools/blast_format/showalign.hpp> +#include <showalignwrap.h> +#include <ctools/asn_converter.hpp> +#include <objtools/data_loaders/blastdb/bdbloader.hpp> +#include <objmgr/object_manager.hpp> +#include <objmgr/gbloader.hpp> +#include <algo/blast/api/blast_aux.hpp> + + + +USING_SCOPE(ncbi); +USING_SCOPE(objects); + + +static void +s_BlastFormat_ConvertToCppLoc(list <CRef<blast::CSeqLocInfo> >& target_mask, + ValNodePtr source_mask) +{ + DECLARE_ASN_CONVERTER(CSeq_loc, SeqLoc, convertor_feat); + ValNodePtr mask_temp = source_mask; + while(mask_temp){ + int frame(0); + switch(mask_temp->choice) { + case Blast_mask_frame_minus1: frame = -1; break; + case Blast_mask_frame_minus2: frame = -2; break; + case Blast_mask_frame_minus3: frame = -3; break; + case Blast_mask_frame_plus1: frame = 1; break; + case Blast_mask_frame_plus2: frame = 2; break; + case Blast_mask_frame_plus3: frame = 3; break; + default: frame = 0; break; + } + + + SeqLocPtr slp = (SeqLocPtr) mask_temp->data.ptrvalue; + + if (slp->choice == SEQLOC_PACKED_INT){ + for (ValNodePtr vnpTemp2 = (ValNodePtr) slp->data.ptrvalue; vnpTemp2; vnpTemp2 = vnpTemp2->next){ + CRef<CSeq_loc> seqloc(new CSeq_loc()); + convertor_feat.FromC((SeqLocPtr)vnpTemp2, &*seqloc); + CSeq_interval* interval = &seqloc->SetInt(); + CRef<blast::CSeqLocInfo> seqlocinfo + (new blast::CSeqLocInfo(interval, frame)); + + target_mask.push_back(seqlocinfo); + } + } else if (slp->choice == SEQLOC_INT) { + CRef<CSeq_loc> seqloc(new CSeq_loc()); + convertor_feat.FromC(slp, &*seqloc); + CRef<blast::CSeqLocInfo> seqlocinfo + (new blast::CSeqLocInfo(&seqloc->SetInt(), frame)); + target_mask.push_back(seqlocinfo); + } + mask_temp=mask_temp->next; + + } +} + +void DisplayAlign(SeqAlignPtr align, Int4 line_len, BioseqPtr query, + BioseqPtr subject, CharPtr program, Int4Ptr PNTR matrix, + ValNodePtr mask, Int4 mask_char, Int4 mask_color, + Boolean cds_translation, Int4 view, FILE *fp) +{ + + CSeq_align_set seqalignSet; + DECLARE_ASN_CONVERTER(CSeq_align, SeqAlign, convertor_seqalign); + + for (SeqAlignPtr salpTemp = align; salpTemp; salpTemp = salpTemp->next){ + CRef<CSeq_align> csal(new CSeq_align()); + convertor_seqalign.FromC(salpTemp, &*csal); + seqalignSet.Set().push_back(csal); + } + + CRef<CObjectManager> obj; + obj = CObjectManager::GetInstance(); + CGBDataLoader::RegisterInObjectManager(*obj); + CRef<CScope> scope (new CScope(*obj)); + scope->AddDefaults(); + + + DECLARE_ASN_CONVERTER(CBioseq, Bioseq, convertor2); + + CRef<CBioseq> cbsp(new CBioseq()); + convertor2.FromC(subject, &*cbsp); + CRef<CSeq_entry> entry(new CSeq_entry()); + entry->SetSeq(*cbsp); + scope->AddTopLevelSeqEntry(*entry); + + DECLARE_ASN_CONVERTER(CBioseq, Bioseq, convertor3); + CRef<CBioseq> cbsp2(new CBioseq()); + convertor3.FromC(query, &*cbsp2); + CRef<CSeq_entry> entry2(new CSeq_entry()); + entry2->SetSeq(*cbsp2); + scope->AddTopLevelSeqEntry(*entry2); + //auto_ptr<CObjectOStream> out2(CObjectOStream::Open(eSerial_AsnText, cout)); + //*out2 << seqalignSet; + int option = 0; + + list <CRef<blast::CSeqLocInfo> > mask_loc; + + s_BlastFormat_ConvertToCppLoc(mask_loc, mask); + + int the_matrix[CDisplaySeqalign::ePMatrixSize][CDisplaySeqalign::ePMatrixSize]; + if(matrix){ + for(int i = 0; i < CDisplaySeqalign::ePMatrixSize; i ++){ + for(int j = 0; j < CDisplaySeqalign::ePMatrixSize; j ++){ + the_matrix[i][j] = matrix[i][j]; + } + } + } + CDisplaySeqalign cds(seqalignSet, *scope, &mask_loc, NULL, + matrix ? the_matrix : NULL); + CNcbiOstrstream oss; + if(strcmp(program, "tblastx") == 0){ + option += CDisplaySeqalign::eTranslateNucToNucAlignment; + } + option += CDisplaySeqalign::eShowBlastStyleId; + if (cds_translation) { + option += CDisplaySeqalign::eShowCdsFeature; + } + option += CDisplaySeqalign::eShowBlastInfo; + option += CDisplaySeqalign::eShowNoDeflineInfo; + option += CDisplaySeqalign::eHtml; + if (view == 2){ + option += CDisplaySeqalign::eColorDifferentBases; + option += CDisplaySeqalign::eShowIdentity; + } else { + option += CDisplaySeqalign::eShowMiddleLine; + } + + if (mask_char == 2){ + cds.SetSeqLocChar(CDisplaySeqalign::eLowerCase); + } + + if (mask_color == 2){ + cds.SetSeqLocColor(CDisplaySeqalign::eGrey); + } else if (mask_color == 3){ + cds.SetSeqLocColor(CDisplaySeqalign::eRed); + } + + if(strcmp(program, "blastn") == 0){//blastn + cds.SetMiddleLineStyle (CDisplaySeqalign::eBar); + cds.SetAlignType(CDisplaySeqalign::eNuc); + } else { + cds.SetMiddleLineStyle (CDisplaySeqalign::eChar); + cds.SetAlignType(CDisplaySeqalign::eProt); + } + + cds.SetAlignOption(option); + cds.DisplaySeqalign(oss); + string output = (string)(CNcbiOstrstreamToString(oss)); + fprintf(fp, "%s", output.c_str()); + +} + + +/* +*============================================================ +*$Log: showalignwrap.cpp,v $ +*Revision 1.1 2006/01/05 17:28:57 jianye +*for wblast2 to use new formatter +* + +*/ diff --git a/network/wwwblast/Src/showalignwrap.h b/network/wwwblast/Src/showalignwrap.h new file mode 100644 index 00000000..fcd068d2 --- /dev/null +++ b/network/wwwblast/Src/showalignwrap.h @@ -0,0 +1,77 @@ +/* $Id: showalignwrap.h,v 1.1 2006/01/05 17:28:57 jianye Exp $ + * =========================================================================== + * + * PUBLIC DOMAIN NOTICE + * National Center for Biotechnology Information + * + * This software/database is a "United States Government Work" under the + * terms of the United States Copyright Act. It was written as part of + * the author's official duties as a United States Government employee and + * thus cannot be copyrighted. This software/database is freely available + * to the public for use. The National Library of Medicine and the U.S. + * Government have not placed any restriction on its use or reproduction. + * + * Although all reasonable efforts have been taken to ensure the accuracy + * and reliability of the software and data, the NLM and the U.S. + * Government do not and cannot warrant the performance or results that + * may be obtained by using this software or data. The NLM and the U.S. + * Government disclaim all warranties, express or implied, including + * warranties of performance, merchantability or fitness for any particular + * purpose. + * + * Please cite the author in any work or product based on this material. + * + * =========================================================================== + * + * Author: Jian Ye + * + * File Description: + * c adaptor to showalign.hpp + * + */ + +#ifndef SHOWALIGN_WRAP_H +#define SHOWALIGN_WRAP_H + +#include <ncbi.h> +#include <objseq.h> +#include <objsset.h> +#include <sequtil.h> +#include <seqport.h> +#include <tofasta.h> +#include <blast.h> +#include <blastpri.h> + +#include <gapxdrop.h> +#include <salsap.h> +#include <objalign.h> +#include <accentr.h> +#include <objblst3.h> + + + +#ifdef __cplusplus +extern "C" { +#endif +void DisplayAlign(SeqAlignPtr align, Int4 line_len, BioseqPtr query, + BioseqPtr subject, CharPtr program, + Int4Ptr PNTR matrix, + ValNodePtr mask, Int4 mask_char, Int4 mask_color, + Boolean cds_translation, Int4 view, FILE *fp); + + +#ifdef __cplusplus +} +#endif + +#endif + + +/* +*============================================================ +*$Log: showalignwrap.h,v $ +*Revision 1.1 2006/01/05 17:28:57 jianye +*for wblast2 to use new formatter +* + +*/ diff --git a/network/wwwblast/Src/test/run.pl b/network/wwwblast/Src/test/run.pl index 052f7379..99e488b5 100755 --- a/network/wwwblast/Src/test/run.pl +++ b/network/wwwblast/Src/test/run.pl @@ -59,6 +59,8 @@ if ($app eq "wblast2.REAL" or $app eq "wblast2_cs.REAL") { $Tests{'short-subject-discmb'} = "\"PROGRAM=blastn&ONE=AE003820&SSEQ=aggacctcatcagcctcaaa&WORD=11&EXPECT=10000&MEGABLAST=yes\""; $Tests{'short-subject-blastn'} = "\"PROGRAM=blastn&ONE=AE003820&SSEQ=aggacctcatcagcctcaaa&WORD=11&EXPECT=10000\""; $Tests{'bare-fasta'} = "\"PROGRAM=blastn&SEQ=agcctggtaggctgcagtccatggggtcacacagagtcggacatgactgagcgacttcac&SSEQ=agcctggtaggctgcaatccatggggtcgctagagtcggacacgactgagcgacttcac&PROGRAM=blastn&FILTER=1\""; + $Tests{'cds_feature_plus'} = "\"ONE=48869482&TWO=60844&FROM=&TO=&FFROM=&TTO=&STRAND=1&FILTER=1&PROGRAM=blastn&cds_translation=on\""; + $Tests{'maks_color'} = "\"page=2&match=1&msmatch=-2&gopen=5&gext=2&dropoff=50&expect=10.000000&word=11&Filter=1&view=1&mask_char=2&mask_color=3&cds_translation=on&program=blastn&matrix=0&seq=u93236+&sseq=u93237&from=1&to=2772&ffrom=1&tto=9180\""; } else { if ($app eq "blast_cs.REAL") { diff --git a/network/wwwblast/Src/viewgif.c b/network/wwwblast/Src/viewgif.c index 5319b6c3..8a885ada 100644 --- a/network/wwwblast/Src/viewgif.c +++ b/network/wwwblast/Src/viewgif.c @@ -1,13 +1,58 @@ +/* $Id: viewgif.c,v 1.7 2005/12/28 20:56:14 merezhuk Exp $ +* =========================================================================== +* +* PUBLIC DOMAIN NOTICE +* National Center for Biotechnology Information +* +* This software/database is a "United States Government Work" under the +* terms of the United States Copyright Act. It was written as part of +* the author's official duties as a United States Government employee and +* thus cannot be copyrighted. This software/database is freely available +* to the public for use. The National Library of Medicine and the U.S. +* Government have not placed any restriction on its use or reproduction. +* +* Although all reasonable efforts have been taken to ensure the accuracy +* and reliability of the software and data, the NLM and the U.S. +* Government do not and cannot warrant the performance or results that +* may be obtained by using this software or data. The NLM and the U.S. +* Government disclaim all warranties, express or implied, including +* warranties of performance, merchantability or fitness for any particular +* purpose. +* +* Please cite the author in any work or product based on this material. +* +* =========================================================================== +* +* File Name: $RCSfile: viewgif.c,v $ +* +* Author: Ilya Dondoshansky +* +* Initial Creation Date: 2002/12/02 +* +* $Revision: 1.7 $ +* +* File Description: +* CGI program, part of standalone WWW Blast package, pipes graphic overview image back to user. +* +* $Log: viewgif.c,v $ +* Revision 1.7 2005/12/28 20:56:14 merezhuk +* fix for broken gif; +* +* +*/ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include <signal.h> #include <fcntl.h> -#include <stdio.h> + static void SigAlrmHandler(int); static void SigTermHandler(int); static char FileName[128]; -main(void) +int main(void) { FILE *pp; char tmp_buff[1024]; diff --git a/network/wwwblast/Src/wblast2.c b/network/wwwblast/Src/wblast2.c index 9db717d0..298b6534 100644 --- a/network/wwwblast/Src/wblast2.c +++ b/network/wwwblast/Src/wblast2.c @@ -1,4 +1,4 @@ -/* $Id: wblast2.c,v 1.30 2005/12/05 16:14:48 coulouri Exp $ +/* $Id: wblast2.c,v 1.32 2006/01/17 21:47:28 madden Exp $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -27,12 +27,18 @@ * * Initial Creation Date: 10/23/2000 * -* $Revision: 1.30 $ +* $Revision: 1.32 $ * * File Description: * BLAST 2 Sequences CGI program * * $Log: wblast2.c,v $ +* Revision 1.32 2006/01/17 21:47:28 madden +* Adjust to change in BLAST_TwoSeqLocSets prototype +* +* Revision 1.31 2006/01/05 17:28:07 jianye +* use new formatter for internal use +* * Revision 1.30 2005/12/05 16:14:48 coulouri * c99 variable declaration breaks irix and solaris compilers * @@ -254,7 +260,9 @@ #include <poll.h> #endif #include <time.h> - +#ifdef NCBI_INTERNAL_NEW_FORMATTER +#include <showalignwrap.h> +#endif #include <blastpat.h> #ifndef BL2SEQ_STANDALONE #include <Liburlapi/qblastnet.h> @@ -744,7 +752,25 @@ static void Blast2SeqMainPage(CharPtr warning, CharPtr seq1, CharPtr seq2, CharP printf("<option value=3 SELECTED> Both strands\n"); printf("<option value=1> Forward strand\n"); printf("<option value=2> Reverse strand\n"); - printf("</select><HR>\n"); + printf("</select> "); +#ifdef NCBI_INTERNAL_NEW_FORMATTER + printf("View option <select name=\"view\">\n"); + printf("<option value=1 SELECTED> Standard\n"); + printf("<option value=2> Mismatch-highlighting\n"); + printf("</select> \n"); + printf("<BR>Masking character option <select name=\"mask_char\">\n"); + printf("<option value=1 SELECTED> X for protein, n for nucleotide\n"); + printf("<option value=2> Lower case\n"); + printf("</select> \n"); + + printf("Masking color option <select name=\"mask_color\">\n"); + printf("<option value=1 SELECTED> Black\n"); + printf("<option value=2> Grey\n"); + printf("<option value=3> Red\n"); + printf("</select> \n"); + printf("<BR><INPUT type=checkbox NAME=cds_translation>Show CDS translation\n"); +#endif + printf("<HR>\n"); printf("Open gap\n"); printf("<INPUT type=text size=4 name=\"gopen\" value=5>\n"); @@ -1523,7 +1549,7 @@ static void BLASTOptionValidateHTML(BLAST_OptionsBlkPtr options, CharPtr prognam { Int2 status; ValNodePtr error_return=NULL; - + status = BLASTOptionValidateEx(options, progname, &error_return); if (status != 0) { Blast2SeqMainPage(NULL, seq1, seq2, one, two, error_return, is_prot, options, mtrx, from, to, ffrom, tto, filter, pagecount); @@ -1531,13 +1557,13 @@ static void BLASTOptionValidateHTML(BLAST_OptionsBlkPtr options, CharPtr prognam return; } -static void PrintParam(Boolean is_prot, Int2 mtrx, Int2 ma, Int2 ms, BLAST_OptionsBlkPtr options, CharPtr seq_2, CharPtr seq_1, CharPtr one, CharPtr two, BioseqPtr query_bsp, BioseqPtr subject_bsp, Int4 len1, Int4 len2, Int4 from, Int4 to, Int4 ffrom, Int4 tto, Int2 pagecount) +static void PrintParam(Boolean is_prot, Int2 mtrx, Int2 ma, Int2 ms, BLAST_OptionsBlkPtr options, CharPtr seq_2, CharPtr seq_1, CharPtr one, CharPtr two, BioseqPtr query_bsp, BioseqPtr subject_bsp, Int4 len1, Int4 len2, Int4 from, Int4 to, Int4 ffrom, Int4 tto, Int2 pagecount, Int4 view, Int4 mask_char, Int4 mask_color, Boolean cds_translation) { ValNodePtr vnp; CharPtr s; static Char buf[41]; Int4 gi; - + CharPtr defline = NULL; printf("<FORM NAME= bl2 method=\"POST\" action=" #if defined (BL2SEQ_STANDALONE) && defined (NCBI_ENTREZ_CLIENT) "\"wblast2_cs.cgi" @@ -1583,6 +1609,27 @@ static void PrintParam(Boolean is_prot, Int2 mtrx, Int2 ma, Int2 ms, BLAST_Optio } else { printf(">\n"); } +#ifdef NCBI_INTERNAL_NEW_FORMATTER + printf("View option <select name=\"view\">\n"); + printf("<option value=1 %s> Standard\n", view == 1 ? "SELECTED" : ""); + printf("<option value=2 %s> Mismatch-highlighting\n", view == 2 ? "SELECTED" : ""); + printf("</select> \n"); + printf("<BR>Masking character option <select name=\"mask_char\">\n"); + printf("<option value=1 %s> X for protein, n for nucleotide\n", mask_char == 1 ? "SELECTED" : "" ); + printf("<option value=2 %s> Lower case\n", mask_char == 2 ? "SELECTED" : ""); + printf("</select> \n"); + + printf("Masking color option <select name=\"mask_color\">\n"); + printf("<option value=1 %s> Black\n", mask_color == 1 ? "SELECTED" : ""); + printf("<option value=2 %s> Grey\n", mask_color == 2 ? "SELECTED" : ""); + printf("<option value=3 %s> Red\n", mask_color == 3 ? "SELECTED" : ""); + printf("</select> \n"); + printf("<BR><INPUT type=checkbox NAME=cds_translation"); + if (cds_translation) { + printf(" CHECKED"); + } + printf(">Show CDS translation\n"); +#endif printf("<INPUT TYPE=hidden name=\"program\" value=\"%s\">\n", options->program_name); @@ -1619,50 +1666,49 @@ static void PrintParam(Boolean is_prot, Int2 mtrx, Int2 ma, Int2 ms, BLAST_Optio printf("<INPUT TYPE=hidden name=\"to\" value=\"%d\">\n", to); printf("<INPUT TYPE=hidden name=\"ffrom\" value=\"%d\">\n", ffrom); printf("<INPUT TYPE=hidden name=\"tto\" value=\"%d\">\n", tto); - printf("<TABLE>\n"); - printf("<TR><TD><strong> Sequence 1</strong></TD>\n"); + + printf("<BR><strong> Sequence 1</strong>: "); if ((gi = GetGIForSeqId(SeqIdFindBest(query_bsp->id, SEQID_GI))) != 0) { - printf("<TD>gi<A HREF=http://www.ncbi.nlm.nih.gov/entrez/viewer.fcgi?val=%ld> %ld</A></TD>", gi, gi); + SeqIdWrite(query_bsp->id, buf, PRINTID_FASTA_SHORT, 30); + printf("<A HREF=http://www.ncbi.nlm.nih.gov/entrez/viewer.fcgi?val=%ld>gi|%ld|%s</A>", gi, gi, buf); } else { SeqIdWrite(query_bsp->id, buf, PRINTID_FASTA_LONG, 40); - printf("<TD>%s</TD>", buf); + printf("%s", buf); } - for (vnp=query_bsp->descr; vnp; vnp=vnp->next) { - if (vnp->choice == Seq_descr_title) { - printf("<TD>%s</TD>", vnp->data.ptrvalue); - break; - } - } - if (vnp == NULL) { - printf("<TD></TD>"); - } - printf("<TD><strong>Length</strong></TD><TD>%ld</TD>\n", len1); + + defline = BioseqGetTitle(query_bsp); + if(defline) { + printf("%s", defline); + } + + printf("<BR>"); + + printf("Length = %ld\n", len1); if (from != 0 || to != 0) { - printf("<TD>(%ld .. %ld)</TD>\n", from, to); + printf("(%ld .. %ld)\n", from, to); } - printf("</TR><TR>\n"); - printf("<TR><TD><strong> Sequence 2</strong></TD>\n"); + printf("<BR><BR>\n"); + printf("<strong> Sequence 2</strong>: "); if ((gi = GetGIForSeqId(SeqIdFindBest(subject_bsp->id, SEQID_GI))) != 0) { - printf("<TD>gi <A HREF=http://www.ncbi.nlm.nih.gov/entrez/viewer.fcgi?val=%ld>%ld</A></TD>", gi, gi); + SeqIdWrite(subject_bsp->id, buf, PRINTID_FASTA_SHORT, 30); + printf("<A HREF=http://www.ncbi.nlm.nih.gov/entrez/viewer.fcgi?val=%ld>gi|%ld|%s</A>", gi, gi, buf); } else { SeqIdWrite(subject_bsp->id, buf, PRINTID_FASTA_LONG, 40); - printf("<TD>%s</TD>", buf); + printf("%s", buf); } - for (vnp=subject_bsp->descr; vnp; vnp=vnp->next) { - if (vnp->choice == Seq_descr_title) { - printf("<TD>%s</TD>", vnp->data.ptrvalue); - break; - } - } - if (vnp == NULL) { - printf("<TD></TD>"); - } - printf("<TD><strong>Length</strong></TD><TD>%ld</TD>\n", len2); + + defline = BioseqGetTitle(subject_bsp); + if(defline) { + printf("%s", defline); + } + printf("<BR>\n"); + + printf("Length = %ld\n", len2); if (ffrom != 0 || tto != 0) { - printf("<TD>(%ld .. %ld)</TD>\n", ffrom, tto); + printf("(%ld .. %ld)\n", ffrom, tto); } - printf("</TR></TABLE>\n"); - + printf("<BR><BR><BR>\n"); + return; } @@ -1971,6 +2017,7 @@ Int2 Main(void) Int2 mtrx = 0, color=1; SeqAlignPtr seqalign = NULL, sap, sapnext; SeqAnnotPtr hsat= NULL, sat, satnext; + SBlastSeqalignArray* seqalign_arr=NULL; FloatHi expect; Boolean is_prot=FALSE, is_aa1=FALSE, is_aa2=FALSE, is_na1=TRUE, is_na2=TRUE; CharPtr seq_1=NULL, seq_2=NULL, chptr; @@ -2015,6 +2062,9 @@ Int2 Main(void) CharPtr rid = NULL, database = NULL; sigset_t sigset; struct sigaction sa; + Int4 mask_color =1, mask_char = 1, view = 1; + Boolean cds_translation = FALSE; + CharPtr value_holder = NULL; #ifndef BL2SEQ_STANDALONE TNlmThread connection_thread = NULL; void *thrstat; @@ -2086,6 +2136,23 @@ Int2 Main(void) fprintf(fd, "%s", ((WWWInfoDataPtr)theInfo->info)->query); FileClose(fd); } + + value_holder = WWWGetValueByName(theInfo->info, "mask_color"); + if(value_holder) { + mask_color = atoi (value_holder); + } + value_holder = WWWGetValueByName(theInfo->info, "mask_char"); + if(value_holder) { + mask_char = atoi (value_holder); + } + value_holder = WWWGetValueByName(theInfo->info, "view"); + if(value_holder) { + view = atoi (value_holder); + } + + if (WWWGetValueByName(theInfo->info, "cds_translation") != NULL) { + cds_translation = TRUE; + } if((chptr = WWWGetValueByName(theInfo->info, "PROGRAM")) != NULL) theInfo->program = StringSave(chptr); @@ -2447,13 +2514,24 @@ Int2 Main(void) fake_bsp = BlastMakeFakeBioseq(query_bsp, NULL); if (from == 0 && to == 0) { +#ifdef NCBI_INTERNAL_NEW_FORMATTER + ValNodeAddPointer(&slp1, SEQLOC_WHOLE, SeqIdDup(query_bsp->id)); + len1 = query_bsp->length; +#else ValNodeAddPointer(&slp1, SEQLOC_WHOLE, SeqIdDup(fake_bsp->id)); len1 = fake_bsp->length; +#endif + } else { sip1 = SeqIntNew(); sip1->from = (from > 0) ? from-1 : 0; - sip1->to = (to < fake_bsp->length) ? to-1 : fake_bsp->length-1; +#ifdef NCBI_INTERNAL_NEW_FORMATTER + sip1->to = (to < query_bsp->length) ? to-1 : query_bsp->length-1; + sip1->id = (SeqIdPtr) SeqIdDup (query_bsp->id); +#else + sip1->to = (to < fake_bsp->length) ? to-1 : query_bsp->length-1; sip1->id = (SeqIdPtr) SeqIdDup (fake_bsp->id); +#endif sip1->strand = options->strand_option; ValNodeAddPointer(&slp1, SEQLOC_INT, sip1); len1 = SeqLocLen(slp1); @@ -2510,16 +2588,23 @@ Int2 Main(void) #ifndef USE_OLD_BLAST BLAST_SummaryOptionsInit(&s_options); BLASTOptions2SummaryOptions(options, progname, s_options); - BLAST_TwoSeqLocSets(s_options, slp1, slp2, NULL, &seqalign, &mask, &mask_at_hash, + BLAST_TwoSeqLocSets(s_options, slp1, slp2, NULL, &seqalign_arr, &mask, &mask_at_hash, &s_return); + if (seqalign_arr && seqalign_arr->array) + { + seqalign = seqalign_arr->array[0]; + seqalign_arr->array[0] = NULL; + seqalign_arr = SBlastSeqalignArrayFree(seqalign_arr); + } + if (s_return->error) {
/* Print the error message. */
Blast2SeqMainPage(s_return->error->message, seq1EntryData, seq2EntryData, NULL, NULL, NULL,
is_prot, options, mtrx, from, to, ffrom, tto, filter,
pagecount);
}
-
+ if (mask_at_hash) { /* If masking was done for lookup table only, do not use mask locations for formatting. */ @@ -2553,7 +2638,7 @@ Int2 Main(void) len1, len2, progname); PrintParam(is_prot, mtrx, ma, ms, options, seq2EntryData, seq1EntryData, NULL, NULL, - query_bsp, subject_bsp, len1, len2, from, to, ffrom, tto, pagecount); + query_bsp, subject_bsp, len1, len2, from, to, ffrom, tto, pagecount, view, mask_char, mask_color, cds_translation); printf("<strong><font color=#0000EE>No significant similarity was found</font></strong>\n"); goto cleanup; @@ -2597,7 +2682,7 @@ Int2 Main(void) ValNodeFree(other_returns); #endif - to = (to >0) ? to : fake_bsp->length; + to = (to >0) ? to : query_bsp->length; tto = (tto >0) ? tto : subject_bsp->length; from = (from >0) ? from : 1; ffrom = (ffrom >0) ? ffrom : 1; @@ -2606,7 +2691,7 @@ Int2 Main(void) from, to, ffrom, tto, len1, len2, progname); PrintParam(is_prot, mtrx, ma, ms, options, seq2EntryData, seq1EntryData, NULL, NULL, - query_bsp, subject_bsp, len1, len2, from, to, ffrom, tto, pagecount); + query_bsp, subject_bsp, len1, len2, from, to, ffrom, tto, pagecount, view, mask_char, mask_color, cds_translation); align_type = BlastGetProgramNumber(progname); @@ -2881,7 +2966,10 @@ Int2 Main(void) color = 2; } printf("<a name=%d>\n", index); + +#ifndef NCBI_INTERNAL_NEW_FORMATTER PrintOutScore(sap, is_prot, NULL, mask); +#endif if (sap->segtype == SAS_DENDIAG) { for (ddp = sap->segs, index1=0; ddp; ddp= ddp->next, index1++); } else if (sap->segtype == SAS_DENSEG) { @@ -2918,9 +3006,16 @@ Int2 Main(void) txoption += TXALIGN_HTML; AddAlignInfoToSeqAnnot(sat, align_type); - +#ifdef NCBI_INTERNAL_NEW_FORMATTER + fprintf(stdout, "<pre>"); + DisplayAlign((SeqAlignPtr)sat->data, 60, query_bsp, subject_bsp, + progname, txmatrix, mask, mask_char, mask_color, + cds_translation, view, stdout); + fprintf(stdout, "</pre>"); +#else ShowTextAlignFromAnnot(sat, 60, stdout, NULL, NULL, - txoption, txmatrix, mask, NULL); + txoption, txmatrix, mask, NULL); +#endif } cleanup: |