1 /* $Id: cuCdUpdateParameters.cpp 607023 2020-04-29 18:39:50Z lanczyck $
2  * ===========================================================================
3  *
4  *                            PUBLIC DOMAIN NOTICE
5  *               National Center for Biotechnology Information
6  *
7  *  This software/database is a "United States Government Work" under the
8  *  terms of the United States Copyright Act.  It was written as part of
9  *  the author's official duties as a United States Government employee and
10  *  thus cannot be copyrighted.  This software/database is freely available
11  *  to the public for use. The National Library of Medicine and the U.S.
12  *  Government have not placed any restriction on its use or reproduction.
13  *
14  *  Although all reasonable efforts have been taken to ensure the accuracy
15  *  and reliability of the software and data, the NLM and the U.S.
16  *  Government do not and cannot warrant the performance or results that
17  *  may be obtained by using this software or data. The NLM and the U.S.
18  *  Government disclaim all warranties, express or implied, including
19  *  warranties of performance, merchantability or fitness for any particular
20  *  purpose.
21  *
22  *  Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Author:  Charlie Liu
27  *
28  * File Description:
29  *
30  *
31  * ===========================================================================
32  */
33 
34 #include <ncbi_pch.hpp>
35 #include <algo/structure/cd_utils/cuCdUpdateParameters.hpp>
36 #include <stdio.h>
37 
38 BEGIN_NCBI_SCOPE
39 BEGIN_SCOPE(cd_utils)
40 
41 string BlastTypeNames[] = {
42     "blast",
43     "psi-blast"
44 };
45 
46 string BlastDatabaseNames[] = {
47     "nr",
48     "swissprot",
49     "pdb",
50     "pat",
51     "Yeast",
52     "ecoli",
53     "Drosophila genome",
54     "month",
55     "SMARTBLAST/landmark",
56     "CDSEARCH_TEST/nr_v4",
57     "CDSEARCH_TEST/pdb_v5",
58     "CDSEARCH/CDDupdate"
59 };
60 
61 string OrganismNames[] = {
62     "All organisms",
63     "Cellular organisms",
64     "Viruses",
65     "Archaea",
66     "Bacteria",
67     "Eukaryota",
68     "Viridiplantae",
69     "Fungi",
70     "Metazoa",
71     "Arthropoda",
72     "Vertebrata",
73     "Mammalia",
74     "Rodentia",
75     "Primates"
76 };
77 
78 string EnvironmentalTaxNames[] = {
79     "unclassified",
80     "environmental samples",
81     "environmental sequence"
82 };
83 
84 
CdUpdateParameters()85 CdUpdateParameters::CdUpdateParameters()
86     : blastType(ePSI_BLAST),
87     database(eNR),
88     organism(eAll_organisms),
89     entrezQuery(),
90     numHits(0),
91     evalue(0.01),
92     timeToCheck(100000),
93     missingResidueThreshold(1),
94     excludingTaxNodes(true),
95     nonRedundify(false),
96     refresh(false),
97     useNRPrefs(false),
98 	noFilter(false),
99 	replaceOldAcc(true),
100 	identityThreshold(-1),
101 	allowedOverlapWithCDRow(0)
102 {
103 }
104 
105 
~CdUpdateParameters()106 CdUpdateParameters::~CdUpdateParameters()
107 {
108 }
109 
toString()110 string CdUpdateParameters::toString()
111 {
112     string result("CD-Updating parameters:");
113     result += getBlastTypeName(blastType);
114     result += ',';
115     result += getBlastDatabaseName(database);
116     result += ',';
117     result += getOrganismName(organism);
118     result += ',';
119     result += entrezQuery;
120     result += ',';
121 
122     char evalueStr[100];
123     sprintf(evalueStr,"e-value:%.2e", evalue);
124     result += evalueStr;
125     return result;
126 }
127 
getBlastTypeName(enum BlastType bt)128 string CdUpdateParameters::getBlastTypeName(enum BlastType bt)
129 {
130     if (bt >= eBlastTypeEnd)
131         return "";
132     else
133         return BlastTypeNames[bt];
134 }
135 
getBlastDatabaseName(BlastDatabase db)136 string CdUpdateParameters::getBlastDatabaseName(BlastDatabase db)
137 {
138     if (db >= eBlastDatabaseEnd)
139         return "";
140     else
141         return BlastDatabaseNames[db];
142 }
143 
getOrganismName(Organism org)144 string CdUpdateParameters::getOrganismName(Organism org)
145 {
146     if (org >= eOrganismEnd)
147         return "";
148     else
149         return OrganismNames[org];
150 }
151 
getEnvironmentalTaxName(EnvironmentalTax et)152 string CdUpdateParameters::getEnvironmentalTaxName(EnvironmentalTax et)
153 {
154     if (et >= eEnvironmentalTaxEnd)
155         return "";
156     else
157         return EnvironmentalTaxNames[et];
158 }
159 
160 END_SCOPE(cd_utils)
161 END_NCBI_SCOPE
162