(
void)
const;
98m_BufferSize(32*1024),
99m_Buffer(new char[m_BufferSize]),
100m_Pos(m_Buffer.get()),
138 char* start =
m_Pos;
140 for(
char* p = start; p < end; ++p ) {
152 else if( *p ==
'\r') {
185 char* start =
m_Pos;
191 for(
char* p = start; p < end; ++p ) {
193 if( c ==
'\r'|| c ==
'\n') {
202 if( p < end && c ==
'\r'&& *p ==
'\n') {
209 if( c ==
'\r'&& *p ==
'\n') {
220 m_String.append(start, end - start);
237 for(
boolflag =
true; flag; ) {
284 virtual void Init(
void);
285 virtual int Run(
void);
297 double EstimateSize(
size_trows,
boolfixed_span)
const;
433arg_desc->SetUsageContext
435 "Object serialization demo program: Seq-entry translator");
438arg_desc->AddDefaultKey
439(
"input",
"InputFile",
440 "name of file to read from (standard input by default)",
443arg_desc->AddDefaultKey
444(
"output",
"OutputFile",
445 "name of file to write to (standard output by default)",
447arg_desc->AddDefaultKey(
"outfmt",
"OutputFormat",
"format of output file",
449arg_desc->SetConstraint(
"outfmt",
452arg_desc->AddOptionalKey(
"mapfile",
"MapFile",
453 "IdMapper config filename",
455arg_desc->AddDefaultKey(
"genome",
"Genome",
456 "UCSC build number",
459arg_desc->AddFlag(
"as-graph",
460 "Generate Seq-graph");
461arg_desc->AddFlag(
"single-annot",
462 "Put all Seq-graphs in a single Seq-annot");
463arg_desc->AddFlag(
"as-byte",
464 "Convert data in byte range");
465arg_desc->AddFlag(
"omit-zeros",
466 "Omit zero values");
467arg_desc->AddFlag(
"join-same",
468 "Join equal sequential values");
469arg_desc->AddFlag(
"keep-integer",
470 "Keep integer as is if they fit in an output range");
471arg_desc->AddDefaultKey(
"gap-value",
"GapValue",
472 "Assumed value in gaps",
475arg_desc->AddOptionalKey(
"name",
"Name",
476 "Track name or graph title",
486 if(name ==
"asn") {
488}
else if(name ==
"asnb") {
490}
else if(name ==
"xml") {
494 THROW1_TRACE(runtime_error,
"Bad serial format name "+ name);
522 for(
size_t i= 1;
i<
size; ++
i) {
538 for(
size_t i= 1;
i<
size; ++
i) {
549 const intrange = 255;
562 for(
size_t i= 1;
i<
size; ++
i) {
563 if(
m_Values[
i].m_Pos == nv.back().GetEnd() &&
564 m_Values[
i].m_Value == nv.back().m_Value ) {
565nv.back().m_Span +=
m_Values[
i].m_Span;
571 if( nv.size() !=
size) {
609interval.
SetId(chrom_id);
620 table->SetFeat_type(0);
627 table->SetColumns().push_back(col_id);
628col_id->
SetHeader().SetField_name(
"Seq-table location");
634 table->SetColumns().push_back(col_id);
641 table->SetColumns().push_back(col_pos);
656 table->SetColumns().push_back(col_span);
657col_span->
SetHeader().SetField_name(
"span");
662span_ptr = &col_span->
SetData().SetInt();
663span_ptr->reserve(
size);
669 table->SetColumns().push_back(col_step);
670col_step->
SetHeader().SetField_name(
"value_gap");
676 table->SetColumns().push_back(col_min);
677col_min->
SetHeader().SetField_name(
"value_min");
681 table->SetColumns().push_back(col_step);
682col_step->
SetHeader().SetField_name(
"value_step");
686 table->SetColumns().push_back(col_val);
687col_val->
SetHeader().SetField_name(
"values");
691values->reserve(
size);
693pos.push_back(it->m_Pos);
695span_ptr->push_back(it->m_Span);
697values->push_back(stat.
AsByte(it->m_Value));
703values.reserve(
size);
706pos.push_back(it->m_Pos);
708span_ptr->push_back(it->m_Span);
710values.push_back(stat.
AsByte(it->m_Value));
716 table->SetColumns().push_back(col_val);
717col_val->
SetHeader().SetField_name(
"values");
719values.reserve(
size);
722pos.push_back(it->m_Pos);
724span_ptr->push_back(it->m_Span);
726values.push_back(it->m_Value);
740graph->
SetLoc(*graph_loc);
770 TSeqPospos = it->m_Pos - start;
774 size_t i= pos / stat.
m_Span;
775 intv = stat.
AsByte(it->m_Value);
776 for( ; span > 0; span -= stat.
m_Span, ++
i) {
791annot->
SetDesc().Set().push_back(desc);
796annot->
SetDesc().Set().push_back(desc);
803annot->
SetDesc().Set().push_back(desc);
805user.
SetType().SetStr(
"Track Data");
808field->
SetLabel().SetStr(it->first);
809field->
SetData().SetStr(it->second);
810user.
SetData().push_back(field);
853 if( c !=
' '&& c !=
'\t') {
876 if( c ==
' '|| c ==
'\t') {
881 x_Error(
"Identifier expected");
900 if( c ==
' '|| c ==
'\t') {
913 if(
len&& *ptr ==
'"') {
915 for( ; pos <
len; ++pos ) {
933 for(
size_tskip = 0; ; ++skip ) {
935 if( c >=
'0'&& c <=
'9') {
936ret = ret*10 + (c-
'0');
938 else if( (c ==
' '|| c ==
'\t'|| c ==
'\0') && skip ) {
945 x_Error(
"Integer value expected");
956 boolnegate =
false, digits =
false;
968 if( c >=
'0'&& c <=
'9') {
970ret = ret*10 + (c-
'0');
972 else if( c ==
'.') {
976 else if( c ==
'\0') {
992 doubledigit_mul = 1;
995 if( c >=
'0'&& c <=
'9') {
998ret += (c-
'0')*digit_mul;
1000 else if( (c ==
' '|| c ==
'\t'|| c ==
'\0') && digits ) {
1023v = strtod(ptr, &endptr);
1024 if( endptr == ptr ) {
1028 x_Error(
"extra text in line");
1039 if( c < '0' || c >
'9') {
1050 x_Error(
"Floating point value expected");
1132 if( name ==
"type") {
1134 if(
value==
"wiggle_0") {
1137 else if(
value==
"bedGraph") {
1141 x_Error(
"Invalid track type");
1144 else if( name ==
"name") {
1147 else if( name ==
"description") {
1155 x_Error(
"Unknown track type");
1164 x_Error(
"Track type=wiggle_0 is required");
1173 if( name ==
"chrom") {
1176 else if( name ==
"start") {
1179 else if( name ==
"step") {
1182 else if( name ==
"span") {
1200 value.m_Pos = start-1;
1201 value.m_Span = span;
1208 value.m_Pos += step;
1217 x_Error(
"Track type=wiggle_0 is required");
1224 if( name ==
"chrom") {
1227 else if( name ==
"span") {
1238 value.m_Span = span;
1256 x_Error(
"Track type=bedGraph is required");
1277 if( args[
"mapfile"] ) {
1279args[
"genome"].AsString(),
1282 else if( !args[
"genome"].AsString().
empty() ) {
1283 LOG_POST(
"Genome: "<<args[
"genome"].AsString());
1298 "The option -omit_zeros is ignored for Seq-graph");
1303 "The option -join_same is ignored for Seq-graph");
1310 "The option -single-annot is ignored for Seq-table");
1319args[
"output"].AsOutputFile()));
1321 if( args[
"name"] ) {
1333 if( s ==
"browser") {
1336 else if( s ==
"track") {
1339 else if( s ==
"fixedStep") {
1342 else if( s ==
"variableStep") {
1364 int main(
intargc,
const char* argv[])
User-defined methods of the data storage class.
User-defined methods of the data storage class.
IdMapper implementation using hardcoded values.
IdMapper implementation using an external configuration file.
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
void ReadBedLine(CTempString chrom)
void x_GetPos(TSeqPos &v)
bool x_TryGetDouble(double &v)
CTempString x_GetParamValue(void)
string m_TrackDescription
CTempString x_GetWord(void)
CRef< CSeq_annot > MakeGraphAnnot(void)
vector< SValueInfo > TValues
void ResetChromValues(void)
CRef< CSeq_annot > m_Annot
bool x_CommentLine(void) const
void SetChrom(CTempString chrom)
bool x_TryGetPos(TSeqPos &v)
void x_SetTotalLoc(CSeq_loc &loc, CSeq_id &chrom_id)
AutoPtr< IIdMapper > m_IdMapper
void x_GetDouble(double &v)
TTrackParams m_TrackParams
CTempString x_GetParamName(void)
CRef< CSeq_annot > MakeTableAnnot(void)
virtual int Run(void)
Run the application.
AutoPtr< CObjectOStream > m_Output
void ReadVariableStep(void)
CRef< CSeq_graph > MakeGraph(void)
void x_Error(const char *msg)
SStat x_PreprocessValues(void)
void DumpChromValues(void)
virtual void Init(void)
Initialize the application.
void AddValue(const SValueInfo &value)
double EstimateSize(size_t rows, bool fixed_span) const
bool x_TryGetDoubleSimple(double &v)
CRef< CSeq_table > MakeTable(void)
map< string, string > TTrackParams
AutoPtr< CWigBufferedLineReader > m_Input
CRef< CSeq_id > x_MakeChromId(void)
CRef< CSeq_annot > MakeAnnot(void)
AutoPtr< IReader > m_Reader
Uint8 GetLineNumber(void) const
CWigBufferedLineReader & operator++(void)
CWigBufferedLineReader(const string &filename)
read from the file, "-" (but not "./-") means standard input
CT_POS_TYPE GetPosition(void) const
virtual ~CWigBufferedLineReader()
AutoArray< char > m_Buffer
CTempStringEx operator*(void) const
virtual void MapObject(CSerialObject &)=0
Map all embedded IDs in a given object at once.
void reset(element_type *p=0, EOwnership ownership=eTakeOwnership)
Reset will delete the old pointer (if owned), set content to the new value, and assume the ownership ...
unsigned int TSeqPos
Type for sequence locations and lengths.
virtual const CArgs & GetArgs(void) const
Get parsed command line arguments.
int AppMain(int argc, const char *const *argv, const char *const *envp=0, EAppDiagStream diag=eDS_Default, const char *conf=NcbiEmptyCStr, const string &name=NcbiEmptyString)
Main function (entry point) for the NCBI application.
virtual void SetupArgDescriptions(CArgDescriptions *arg_desc)
Setup the command line argument descriptions.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
element_type * get(void) const
Get pointer.
const CNcbiArguments & GetArguments(void) const
Get the application's cached unprocessed command-line arguments.
element_type * release(void)
Release will release ownership of pointer to caller.
@ fPreOpen
Open file right away; for eInputFile, eOutputFile, eIOFile.
@ eInputFile
Name of file (must exist and be readable)
@ eDouble
Convertible into a floating point number (double)
@ eString
An arbitrary string.
@ eOutputFile
Name of file (must be writable)
#define ERR_FATAL(message)
Posting fatal error and abort.
EDiagSev SetDiagPostLevel(EDiagSev post_sev=eDiag_Error)
Set the threshold severity for posting the messages.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
@ eDiag_Warning
Warning message.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
void Warning(CExceptionArgs_Base &args)
#define THROW1_TRACE(exception_class, exception_arg)
Throw trace.
ESerialDataFormat
Data file format.
@ eSerial_AsnText
ASN.1 text.
@ eSerial_AsnBinary
ASN.1 binary.
static CObjectOStream * Open(ESerialDataFormat format, CNcbiOstream &outStream, bool deleteOutStream)
Create serial object writer and attach it to an output stream.
uint64_t Uint8
8-byte (64-bit) unsigned integer
ERW_Result
Result codes for I/O operations.
virtual ERW_Result Read(void *buf, size_t count, size_t *bytes_read=0)=0
Read as many as "count" bytes into a buffer pointed to by the "buf" argument.
@ eRW_NotImplemented
Action / information is not available.
@ eRW_Eof
End of data, should be considered permanent.
@ eRW_Error
Unrecoverable error, no retry possible.
@ eRW_Timeout
Timeout expired, try again later.
@ eRW_Success
Everything is okay, I/O completed.
CTempStringEx substr(size_type pos) const
Obtain a substring from this string, beginning at a given offset.
const char * data(void) const
Return a pointer to the array represented.
bool empty(void) const
Return true if the represented string is empty (i.e., the length is zero)
void clear(void)
Clear value to an empty string.
static unsigned int StringToUInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to unsigned int.
bool HasZeroAtEnd(void) const
CTempStringEx & assign(const char *str, size_type len)
Assign new values to the content of the a string.
size_type size(void) const
Return the length of the represented array.
const_iterator begin() const
Return an iterator to the string's starting position.
TData & SetData(void)
Assign a value to Data data member.
void SetLabel(TLabel &value)
Assign a value to Label data member.
void SetType(TType &value)
Assign a value to Type data member.
void SetData(TData &value)
Assign a value to Data data member.
void SetHeader(THeader &value)
Assign a value to Header data member.
void SetData(TData &value)
Assign a value to Data data member.
void SetDefault(TDefault &value)
Assign a value to Default data member.
@ eField_id_location_id
location Seq-id
@ eField_id_location_from
interval from
void SetTo(TTo value)
Assign a value to To data member.
void SetId(TId &value)
Assign a value to Id data member.
void SetFrom(TFrom value)
Assign a value to From data member.
void SetA(TA value)
Assign a value to A data member.
void SetMin(TMin value)
Assign a value to Min data member.
void SetTitle(const TTitle &value)
Assign a value to Title data member.
void SetNumval(TNumval value)
Assign a value to Numval data member.
void SetComp(TComp value)
Assign a value to Comp data member.
TValues & SetValues(void)
Assign a value to Values data member.
void SetGraph(TGraph &value)
Assign a value to Graph data member.
void SetB(TB value)
Assign a value to B data member.
void SetMax(TMax value)
Assign a value to Max data member.
void SetLoc(TLoc &value)
Assign a value to Loc data member.
void SetAxis(TAxis value)
Assign a value to Axis data member.
TTitle & SetTitle(void)
Select the variant.
void SetData(TData &value)
Assign a value to Data data member.
void SetDesc(TDesc &value)
Assign a value to Desc data member.
TName & SetName(void)
Select the variant.
TUser & SetUser(void)
Select the variant.
unsigned int
A callback function used to compare two keys in a database.
<!DOCTYPE HTML >< html > n< header > n< title > PubSeq Gateway Help Page</title > n< style > n table
constexpr auto sort(_Init &&init)
constexpr bool empty(list< Ts... >) noexcept
const struct ncbi::grid::netcache::search::fields::SIZE size
Magic spell ;-) needed for some weird compilers... very empiric.
const GenericPointer< typename T::ValueType > T2 value
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
Defines command line argument related classes.
Defines unified interface to application:
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
void SetFirstValue(double v)
void AddSpan(TSeqPos span)
void SetFirstSpan(TSeqPos span)
int AsByte(double v) const
bool operator<(const SValueInfo &v) const
TSeqPos GetEnd(void) const
int main(int argc, const char *argv[])
static ESerialDataFormat s_GetFormat(const string &name)
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