isNull = (!params);
113 unsigned int len, nSeq = 1;
131 if(fastaFile.size() == 0) {
179 if(bs.
SetDescr().Set().size() == 0) {
180cerr <<
"sequence "<< nSeq <<
": resetting description field due to no entries"<< endl;
185 if(!bs.
SetDescr().Set().front()->IsTitle())
continue;
193 _TRACE(
"Description of seq "<< nSeq <<
" has "<<
len<<
" characters;");
194 _TRACE(
" the last one is not a printable char; truncating it!\n");
195bs.
SetDescr().Set().front()->SetTitle().resize(
len-1);
238 const chargap =
'-';
242 unsigned int row= 0, nNoSuchColumn = 0;
245 for(;
row< nRead; ++
row) {
247 if(
column< rowSequence.length()) {
256 if(nNoSuchColumn == nRead) {
272 const chargap =
'-';
273 static const char* letters(
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
276 stringrowSequence, columnString;
277 unsigned intnColumns, col;
278 unsigned int row= 0, nNoSuchColumn = 0;
285 for(;
row< nRead; ++
row) {
291nColumns = activeSequences[0].length();
292 for(col = 0; col < nColumns; ++col) {
294columnString.
erase();
296 if(col < activeSequences[
row].length()) {
297columnString += activeSequences[
row][col];
304 if(nNoSuchColumn == nRead) {
305columnString.
erase();
308 if(skipGappedColumns) {
309nonLetterPosition = columnString.find_first_not_of(letters);
310 if(nonLetterPosition !=
NPOS) {
312columnString.erase();
316 if(columnString.length() > 0) {
326 boolfoundExisting =
false;
327 bool result= (sourceId.length() > 0);
328CCdd_descr_set::Tdata::iterator
i;
333GID->SetAccession(sourceId);
340 if((*i)->IsSource_id()) {
342(*i)->SetSource_id().
Reset();
343(*i)->SetSource_id().Set().push_back(ID);
344foundExisting =
true;
351 if(
result&& !foundExisting) {
354setOfIds->
Set().push_back(ID);
355descr->SetSource_id(*setOfIds);
364 static const char* cdExt =
".cn3";
366 stringcdOutFile, cdOutExt, err;
368cdOutFile = (outputFile.size() > 0) ? outputFile :
"fastaCd";
372 if(cdOutFile.length() > 0 && cdOutExt != cdExt) {
376 if(!
WriteASNToFile(cdOutFile.c_str(), *
this,
false, &err)) {
378cerr <<
"Error writing cd to file "<< cdOutFile << endl << err << endl;
Concrete implementations of the CFastaIOWrapper virtual class.
void SetFastaFlags(TReadFastaFlags flagsToSet)
bool AddCddDescr(CRef< CCdd_descr > &descr)
void SetAccession(string Accession, int Version)
string GetColumnReadFromFile(unsigned int column) const
void InitializeParameters(const Fasta2CdParams *params=NULL)
string GetDeflineReadFromFile(unsigned int index) const
unsigned int m_initialMasterSequenceIndex
void ResetInitialMasterSequenceIndex()
bool UpdateSourceId(const string &sourceId, int version=0)
bool WriteToFile(const string &outputFile) const
unsigned int GetColumnsReadFromFile(map< unsigned int, string > &columns, bool skipGappedColumns) const
string GetSequenceReadFromFile(unsigned int index) const
bool ImportAlignmentData(const string &fastaFile, bool cleanUp=false)
unsigned int GetAllColumnsReadFromFile(map< unsigned int, string > &columns) const
unsigned int GetGaplessColumnsReadFromFile(map< unsigned int, string > &gaplessColumns) const
CBasicFastaWrapper * m_fastaIO
string m_fastaInputErrorMsg
Fasta2CdParams m_parameters
const CRef< CSeq_entry > & GetSeqEntry() const
virtual unsigned int GetNumRead() const
virtual string GetActiveSequence(unsigned int index, bool removeWhitespace=true) const
virtual string GetActiveDefline(unsigned int index) const
static bool PurgeNonAlphaFromSequence(CBioseq &bioseq)
@ eMostAlignedAndFewestGaps
const CRef< CSeq_annot > & GetSeqAnnot() const
unsigned int GetMasterIndex() const
virtual bool MakeSeqAnnotFromFasta(CNcbiIstream &is, CFastaIOWrapper &fastaIO, MasteringMethod masterMethod, unsigned int masterIndex=(unsigned int) eUnassignedMaster)
static bool WriteASNToFile(const char *filename, const ASNClass &ASNobject, bool isBinary, std::string *err, ncbi::EFixNonPrint fixNonPrint=ncbi::eFNP_Default)
#define test(a, b, c, d, e)
static const char * column
static const column_t columns[]
static void SplitPath(const string &path, string *dir=0, string *base=0, string *ext=0)
Split a path string into its basic components.
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
CFastaReader::TFlags TReadFastaFlags
@ fNoParseID
Generate an ID (whole defline -> title)
@ fForceType
Force specified type regardless of accession.
@ fAssumeProt
Assume prots unless accns indicate otherwise.
bool GoodVisibleChar(char c)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
NCBI_NS_STD::string::size_type SIZE_TYPE
bool IsSetDescription(void) const
status, references, etc.
TGid & SetGid(void)
Select the variant.
TSequences & SetSequences(void)
Assign a value to Sequences data member.
Tdata & Set(void)
Assign a value to data member.
TSeqannot & SetSeqannot(void)
Assign a value to Seqannot data member.
Tdata & Set(void)
Assign a value to data member.
TDescription & SetDescription(void)
Assign a value to Description data member.
TName & SetName(void)
Assign a value to Name data member.
virtual void Reset(void)
Reset the whole object.
TSet & SetSet(void)
Select the variant.
TSeq_set & SetSeq_set(void)
Assign a value to Seq_set data member.
void ResetDescr(void)
Reset Descr data member.
bool IsSetDescr(void) const
descriptors Check if a value has been assigned to Descr data member.
void SetDescr(TDescr &value)
Assign a value to Descr data member.
unsigned int
A callback function used to compare two keys in a database.
const string version
version string
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
std::istream & in(std::istream &in_, double &x_)
#define row(bind, expected)
TMasterMethod masterMethod
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4