CALLS_UNTIL_CANCELLED = 25;
86 if(0 == ++mNumCalls % 100) {
87cerr <<
"Iterations until cancelled: " 88<< (CALLS_UNTIL_CANCELLED - mNumCalls) <<
"\n";
90 return(mNumCalls > CALLS_UNTIL_CANCELLED);
92 static unsigned intmNumCalls;
94 unsigned intTestCanceler::mNumCalls = 0;
107 const auto* pWriterMessage =
dynamic_cast<const CWriterMessage*
>(&message);
108 if(!pWriterMessage) {
111 if(pWriterMessage->GetSeverity() ==
eDiag_Fatal) {
112 throw(*pWriterMessage);
121ostr << message.
GetText() << endl;
134 void Init()
override;
135 int Run()
override;
151 const string&
id,
boolskipHeaders);
190 const CArgs& args)
const;
193 const CArgs& args)
const;
222arg_desc->SetUsageContext(
"",
"Convert ASN.1 to alternative file formats");
226arg_desc->AddOptionalKey(
"i",
"InputFile",
228arg_desc->AddOptionalKey(
"id",
"InputID",
230arg_desc->AddOptionalKey(
"ids",
"InputIDs",
231 "Comma separated list of Input IDs (accession or GI number)",
237arg_desc->AddDefaultKey(
243arg_desc->SetConstraint(
259arg_desc->AddDefaultKey(
262 "Assembly name to include in GFF3 pragma",
265arg_desc->AddDefaultKey(
268 "Assembly accession to include in GFF3 pragma",
271arg_desc->AddDefaultKey(
274 "Default term to use in GFF3 column 2",
282arg_desc->AddOptionalKey(
"o",
"OutputFile",
284arg_desc->AddOptionalKey(
"from",
"From",
286arg_desc->AddOptionalKey(
"to",
"To",
292arg_desc->AddDefaultKey(
298arg_desc->SetConstraint(
309 "throw-exception-on-unresolved-gi",
310 "throw if a gi cannot be converted to accession.version",
314 "produce formally invalid output that is easy to read",
318 "limit attributes to inter feature relationships",
321 "skip-gene-features",
322 "GTF only: Do not emit gene features (for GTF 2.2 compliancy)",
325 "skip-exon-numbers",
326 "GTF only: For exon features, do not emit exon numbers",
330 "GFF dialects: Do not generate GFF headers",
334 "GFF dialects: Inherit annots from components, unless prohibited",
338 "GFF dialects: Restore original GFF type and attributes, if possible",
341 "generate-missing-transcripts",
342 "GFF dialects: Generate artificial transcript features for CDS features without one",
346 "GFF3 only: Use Flybase interpretation of the GFF3 spec",
350 "GFF3 alignments only: Do not sort alignments when fetching from ID",
354 "GFF3 only: Incorporate micro introns",
358 "input file is binary ASN.1",
362arg_desc->AddFlag(
"nocleanup",
363 "Do not perform data cleanup prior to formatting GTF and GFF3");
376 auto format= args[
"format"].AsString();
393 if(args[
"throw-exception-on-unresolved-gi"].AsBoolean()) {
396 #if defined(CANCELER_CODE) 400 if(args[
"from"]) {
441 return&args[
"o"].AsOutputFile();
445 "annotwriter: Unable to open output stream ["+
466 const string&
id,
boolskipHeaders)
470pScope->AddDefaults();
494 if(!args[
"ids"]) {
497vector<string> inputIds;
498 NStr::Split(args[
"ids"].AsString(),
",", inputIds);
499 const boolskipHeaders = args[
"skip-headers"];
500 for(
const auto& inputId: inputIds) {
521 while(!instr.EndOfData()) {
522 if(genbankType ==
"Seq-entry") {
528 if(genbankType ==
"Seq-annot") {
534 if(genbankType ==
"Bioseq") {
540 if(genbankType ==
"Bioseq-set") {
546 if(genbankType ==
"Seq-align") {
552 if(genbankType ==
"Seq-align-set") {
558 if(genbankType ==
"Seq-submit") {
580 "annotwriter: Unable to extract object from input stream ["+
593 if(
data.IsEntrys()) {
594 if(!
GetArgs()[
"skip-headers"]) {
597 for(
autopEntry :
data.SetEntrys()) {
603 if(
data.IsAnnots()) {
604 if(!
GetArgs()[
"skip-headers"]) {
607 for(
autopAnnot :
data.SetAnnots()) {
610 cleanup.BasicCleanup(*pAnnot);
660 if(!
GetArgs()[
"skip-headers"]) {
682 CBioseq& bioseq,
boolskipHeaders)
732 if(!
GetArgs()[
"skip-headers"]) {
747 if(!
GetArgs()[
"skip-headers"]) {
771 boolbDeleteOnClose =
false;
773 const char*
infile= args[
"i"].AsString().c_str();
775bDeleteOnClose =
true;
788 "annotwriter: Unsupported input format",
eDiag_Fatal);
801 "annotwriter: Unable to open input file",
eDiag_Fatal);
813 if(args[
"structibutes"]) {
816 if(args[
"skip-gene-features"]) {
819 if( args[
"skip-exon-numbers"] ) {
822 if( args[
"use-extra-quals"] ) {
825 if(args[
"micro-introns"]) {
828 autoviewType = args[
"view"].AsString();
829 if(viewType ==
"all") {
832 if(viewType ==
"prots-only") {
836 if(args[
"generate-missing-transcripts"]) {
844 const CArgs& args)
const 847 if(args[
"from"]) {
848 return static_cast<TSeqPos>(args[
"from"].AsInteger()-1);
857 const CArgs& args)
const 861 return static_cast<TSeqPos>(args[
"to"].AsInteger()-1);
876 "annotwriter: Format writer object needs valid scope and output stream",
880 const stringstrFormat = args[
"format"].AsString();
881 if(strFormat ==
"gff3") {
882 const boolsortAlignments = args[
"no-sort"] ?
false:
true;
883 if(args[
"flybase"]) {
890 if(args[
"default-method"]) {
895 if(strFormat ==
"gtf") {
901 if(strFormat ==
"gvf") {
906 if(strFormat ==
"wiggle"|| strFormat ==
"wig") {
909 if(strFormat ==
"bed") {
912 if(strFormat ==
"bedgraph") {
915 if(strFormat ==
"vcf") {
918 if(strFormat ==
"aln") {
921 if(strFormat ==
"psl") {
922 unsigned int flags= 0;
923 if(args[
"debug-output"].AsBoolean()) {
931 "annotwriter: No suitable writer for format \""+ strFormat +
"\"",
939 return GetArgs()[
"assembly-name"].AsString();
946 return GetArgs()[
"assembly-accn"].AsString();
955 if(args[
"full-annots"]) {
970 int main(
intargc,
const char** argv)
User-defined methods of the data storage class.
int main(int argc, const char **argv)
static const CDataLoadersUtil::TLoaders default_loaders
string xAssemblyName() const
bool xTryProcessInputId(const CArgs &)
bool xProcessInputObject(CSeq_entry &)
CRef< CWriterBase > m_pWriter
void Init() override
Initialize the application.
TSeqPos xGetTo(const CArgs &args) const
string xAssemblyAccession() const
CWriterBase * xInitWriter(const CArgs &, CNcbiOstream *)
CNcbiOstream * xInitOutputStream(const CArgs &)
int Run() override
Run the application.
bool xProcessBioseqHandle(CBioseq_Handle &bsh, bool skipHeaders)
bool xTryProcessInputIdList(const CArgs &)
bool xTryProcessInputFile(const CArgs &)
CRef< CObjectManager > m_pObjMngr
unsigned int xGffFlags(const CArgs &)
CObjectIStream * xInitInputStream(const CArgs &args, CFileContentInfo &contentInfo)
unique_ptr< CAnnotWriterLogger > m_pErrorHandler
void xTweakAnnotSelector(const CArgs &, SAnnotSelector &)
TSeqPos xGetFrom(const CArgs &args) const
static void xReadObject(CObjectIStream &istr, CSerialObject &object)
bool PutMessage(const IObjtoolsMessage &message)
static void DumpMessage(const CWriterMessage &message, ostream &ostr)
CAnnotWriterLogger()=default
CWriterBase implementation that will render given Genbank objects in the BED file format (http://http...
CWriterBase implementation that will render given Genbank objects in the BED file format (http://http...
static void SetupObjectManager(const CArgs &args, objects::CObjectManager &obj_mgr, TLoaders loaders=fDefault)
Set up the standard object manager data loaders according to the arguments provided above.
static void AddArgumentDescriptions(CArgDescriptions &arg_desc, TLoaders loaders=fDefault)
Add a standard set of arguments used to configure the object manager.
static void CreateMicroIntrons(objects::CScope &scope, objects::CBioseq_Handle bsh, const string &annot_name="", TSeqRange *range=NULL, bool ignore_errors=false)
Wraps CFormatGuess, and if CFormatGuess's result is Unknown, it tries every file reader until one wor...
CFormatGuess::EFormat GuessFormatAndContent(CFileContentInfo &contentInfo)
CFormatGuess::CFormatHints & GetFormatHints(void)
Get format hints.
CFormatHints & AddPreferredFormat(TFormat fmt)
Mark the format as preferred.
CFormatHints & DisableAllNonpreferred(void)
Disable all formats not marked as preferred.
EFormat
The formats are checked in the same order as declared here.
@ eBinaryASN
Binary ASN.1.
void SetThrowOnUnresolvedGi(bool doThrow)
@ fGenerateMissingTranscripts
void SetDefaultMethod(const string &defaultMethod)
void SetCanceler(ICanceled *pCanceller)
Base class for all serializable objects.
Defines and provides stubs for a general interface to a variety of file formatters.
virtual bool WriteAnnot(const CSeq_annot &, const string &="", const string &="")
Write a raw Seq-annot to the internal output stream.
virtual bool WriteFooter()
Write a file trailer.
void SetMessageListener(CWriterListener *pMessageListener)
virtual bool WriteAlign(const CSeq_align &, const string &="", const string &="")
Write a raw Seq-align to the internal output stream.
virtual bool WriteBioseqHandle(CBioseq_Handle, const string &="", const string &="")
Write a Bioseq handle to the internal output stream.
virtual bool WriteHeader()
Write a file header.
virtual SAnnotSelector & SetAnnotSelector(void)
CGenbankIdResolve & SetIdResolve(void)
virtual bool WriteSeqEntryHandle(CSeq_entry_Handle, const string &="", const string &="")
Write a Seq-entry handle to the internal output stream.
virtual CRange< TSeqPos > & SetRange(void)
Interface for testing cancellation request in a long lasting operation.
static void cleanup(void)
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
const CNcbiRegistry & GetConfig(void) const
Get the application's cached configuration parameters (read-only).
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.
void SetVersion(const CVersionInfo &version)
Set the version number for the program.
@ eTakeOwnership
An object can take ownership of another.
@ eNoOwnership
No ownership is assumed.
@ eInputFile
Name of file (must exist and be readable)
@ eString
An arbitrary string.
@ eOutputFile
Name of file (must be writable)
@ eInteger
Convertible into an integer number (int or Int8)
static const char * SeverityName(EDiagSev sev)
Get a common symbolic name for the severity levels.
@ eDiag_Fatal
Fatal error â guarantees exit(or abort)
const string & GetMsg(void) const
Get message string.
ESerialDataFormat
Data file format.
@ eSerial_AsnText
ASN.1 text.
@ eSerial_AsnBinary
ASN.1 binary.
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
static CObjectIStream * Open(ESerialDataFormat format, CNcbiIstream &inStream, bool deleteInStream)
Create serial object reader and attach it to an input stream.
CBioseq_Handle AddBioseq(CBioseq &bioseq, TPriority pri=kPriority_Default, EExist action=eExist_Throw)
Add bioseq, return bioseq handle.
static CRef< CObjectManager > GetInstance(void)
Return the existing object manager or create one.
CSeq_entry_Handle AddTopLevelSeqEntry(CSeq_entry &top_entry, TPriority pri=kPriority_Default, EExist action=eExist_Default)
Add seq_entry, default priority is higher than for defaults or loaders Add object to the score with p...
void RemoveBioseq(const CBioseq_Handle &seq)
Revoke Bioseq previously added using AddBioseq().
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
void AddDefaults(TPriority pri=kPriority_Default)
Add default data loaders from object manager.
void RemoveEntry(CSeq_entry &entry)
CConstRef< CSeq_entry > GetCompleteSeq_entry(void) const
Complete and get const reference to the seq-entry.
CSeq_entry_Handle GetTopLevelEntry(void) const
Get top level Seq-entry handle.
SAnnotSelector & SetExactDepth(bool value=true)
SetExactDepth() specifies that annotations will be searched on the segment level specified by SetReso...
SAnnotSelector & SetResolveAll(void)
SetResolveAll() is equivalent to SetResolveMethod(eResolve_All).
SAnnotSelector & SetAdaptiveDepth(bool value=true)
SetAdaptiveDepth() requests to restrict subsegment resolution depending on annotations found on lower...
SAnnotSelector & SetResolveDepth(int depth)
SetResolveDepth sets the limit of subsegment resolution in searching annotations.
CRef< C > Ref(C *object)
Helper functions to get CRef<> and CConstRef<> objects.
void Reset(void)
Reset reference object.
static position_type GetWholeFrom(void)
static position_type GetWholeTo(void)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
void CONNECT_Init(const IRWRegistry *reg=0, CRWLock *lock=0, TConnectInitFlags flag=eConnectInit_OwnNothing, FSSLSetup ssl=0)
Init [X]CONNECT library with the specified "reg" and "lock" (ownership for either or both can be deta...
void SetFrom(TFrom value)
Assign a value to From data member.
void SetTo(TTo value)
Assign a value to To data member.
list< CRef< CSeq_align > > Tdata
const Tdata & Get(void) const
Get the member data.
TSet & SetSet(void)
Select the variant.
void SetData(TData &value)
Assign a value to Data data member.
The blob sat and sat key Both must be positive integers</td > n< td > Non empty string The interpretation of the blob id depends on a processor Cassandra n processor expects the following format
#define NCBI_SC_VERSION_PROXY
#define NCBI_TEAMCITY_BUILD_NUMBER_PROXY
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
CFileContentInfoGenbank mInfoGenbank
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