73 const list< CRef< CAnnotdesc > > descrs = annot.
GetDesc().
Get();
74 list< CRef< CAnnotdesc > >::const_iterator cit = descrs.begin();
76 while ( cit != descrs.end() ) {
79 if ( ! pDesc->IsUser() ) {
82 if ( ! pDesc->GetUser().IsSetType() ) {
85 if ( ! pDesc->GetUser().GetType().IsStr() ) {
88 if ( pDesc->GetUser().GetType().GetStr() ==
"vcf-meta-info" ) {
124 annot->
Assign(orig_annot);
182 if ( !pVcfMetaInfo || !pVcfMetaInfo->
HasField(
"genotype-headers") ) {
198 if ( !pVcfMetaInfo ) {
204 for (CUser_field::C_Data::TStrs::const_iterator cit = directives.begin();
205 cit != directives.end(); ++cit ) {
206 m_Os <<
"##" << *cit <<
'\n';
220 cit != desc.
Get().end(); ++cit )
222 if ( (*cit)->IsCreate_date() ) {
223 const CDate& date = (*cit)->GetCreate_date();
224 if ( date.
IsStd() ) {
225 date.
GetDate( &datestr,
"%4Y%2M%2D" );
231 m_Os <<
"##fileformat=VCFv4.1"
233 if ( ! datestr.empty() ) {
234 m_Os <<
"##filedate=" << datestr <<
'\n';
236 m_Os <<
"##INFO=<ID=DB,Number=0,Type=Flag,Description=\"dbSNP Membership\">"
238 m_Os <<
"##INFO=<ID=H2,Number=0,Type=Flag,Description=\"Hapmap2 Membership\">"
240 m_Os <<
"##INFO=<ID=H3,Number=0,Type=Flag,Description=\"Hapmap3 Membership\">"
242 m_Os <<
"##INFO=<ID=RL,Number=1,Type=String,Description=\"Resource Link\">"
244 m_Os <<
"##INFO=<ID=FBV,Number=1,Type=String,Description=\"Frequency Based Validation\">"
246 m_Os <<
"##INFO=<ID=GTP,Number=1,Type=String,Description=\"Genotype\">"
248 m_Os <<
"##INFO=<ID=QC,Number=1,Type=String,Description=\"Quality Check\">"
258 m_Os <<
"#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO";
268 m_Os <<
'\t' << *cit;
287 if (
range.IsWhole()) {
315 int current_type = inst.
GetType();
317 rtype = current_type;
319 && inst.
GetDelta().front()->GetSeq().IsLiteral()
320 && inst.
GetDelta().front()->GetSeq().GetLiteral().IsSetSeq_data()
321 && inst.
GetDelta().front()->GetSeq().GetLiteral().GetSeq_data().IsIupacna())
323 string a = inst.
GetDelta().front()->GetSeq().GetLiteral().GetSeq_data().GetIupacna().Get();
339 alt_types.push_back(current_type);
368 "Processing terminated by user");
384 if ( (*inst)->IsSetData() && (*inst)->GetData().IsInstance() ) {
407 if (loc.IsSetStrand())
408 strand = loc.GetStrand();
409 const CSeq_id *seq_id = loc.GetId();
436 if (anchor.empty()) {
437 string msg =
"Missing sequence data";
489 for (CSeq_feat::TExts::const_iterator uo = mf.
GetExts().begin(); uo != mf.
GetExts().end(); ++uo)
491 if ((*uo)->IsSetType() && (*uo)->GetType().IsStr() && (*uo)->GetType().GetStr() ==
"VCF_COLUMN_1_ID"
492 && (*uo)->IsSetData() && !(*uo)->GetData().empty() && (*uo)->GetData().front()->IsSetData() && (*uo)->GetData().front()->GetData().IsStr())
494 id = (*uo)->GetData().front()->GetData().GetStr();
579 const unsigned int start,
581 const string &anchor,
593 m_Os << anchor << ref;
595 m_Os << ref << anchor;
615 const unsigned int start,
617 const string &anchor,
618 const list<int>& alt_types,
619 const vector<string> &alt
628 for (
auto alt_type : alt_types) {
634 const string alt_string = alt[index++];
639 m_Os << anchor << alt_string;
641 m_Os << alt_string << anchor;
651 if (!anchor.empty()) {
694 vector<string> filters;
705 if ( ! filters.empty() ) {
723 vector<string> infos;
730 infos.push_back(
"DB");
732 if (db ==
"hapmap2") {
733 infos.push_back(
"H2");
735 if (db ==
"hapmap3") {
736 infos.push_back(
"H3");
741 const vector<CRef<CDbtag> >& refs = mf.
GetDbxref();
743 for ( vector<
CRef<CDbtag> >::const_iterator cit = refs.begin();
744 cit != refs.end(); ++cit)
746 const CDbtag& ref = **cit;
748 if (!pmids.empty()) {
755 if (!pmids.empty()) {
757 infos.push_back(
string(
"PMID=")+pmids);
764 infos.push_back(
string(
"AF=") +
769 if (rl & VP::eResource_link_preserved) {
770 infos.push_back(
"PM");
772 if (rl & VP::eResource_link_provisional) {
773 infos.push_back(
"TPA");
775 if (rl & VP::eResource_link_has3D) {
776 infos.push_back(
"S3D");
778 if (rl & VP::eResource_link_submitterLinkout) {
779 infos.push_back(
"SLO");
781 if (rl & VP::eResource_link_clinical) {
782 infos.push_back(
"CLN");
784 if (rl & VP::eResource_link_genotypeKit) {
785 infos.push_back(
"HD");
790 if (gl & VP::eGene_location_near_gene_5) {
791 infos.push_back(
"R5");
793 if (gl & VP::eGene_location_near_gene_3) {
794 infos.push_back(
"R3");
796 if (gl & VP::eGene_location_intron) {
797 infos.push_back(
"INT");
799 if (gl & VP::eGene_location_donor) {
800 infos.push_back(
"DSS");
802 if (gl & VP::eGene_location_acceptor) {
803 infos.push_back(
"ASS");
805 if (gl & VP::eGene_location_utr_5) {
806 infos.push_back(
"U5");
808 if (gl & VP::eGene_location_utr_3) {
809 infos.push_back(
"U3");
815 if (effect & VP::eEffect_synonymous) {
816 infos.push_back(
"SYN");
818 if (effect & VP::eEffect_stop_gain) {
819 infos.push_back(
"NSN");
821 if (effect & VP::eEffect_missense) {
822 infos.push_back(
"NSM");
824 if (effect & VP::eEffect_frameshift) {
825 infos.push_back(
"NSF");
831 if (fbv & VP::eFrequency_based_validation_is_mutation) {
832 infos.push_back(
"MUT");
834 if (fbv & VP::eFrequency_based_validation_above_5pct_all) {
835 infos.push_back(
"G3");
837 if (fbv & VP::eFrequency_based_validation_above_5pct_1plus) {
838 infos.push_back(
"G5");
840 if (fbv & VP::eFrequency_based_validation_validated) {
841 infos.push_back(
"VLD");
852 if (
gt & VP::eGenotype_has_genotypes) {
853 infos.push_back(
"GNO");
859 if (qc & VP::eQuality_check_contig_allele_missing) {
860 infos.push_back(
"NOC");
862 if (qc & VP::eQuality_check_withdrawn_by_submitter) {
863 infos.push_back(
"WTD");
865 if (qc & VP::eQuality_check_non_overlapping_alleles) {
866 infos.push_back(
"NOV");
868 if (qc & VP::eQuality_check_genotype_conflict) {
869 infos.push_back(
"GCF");
875 list<CRef<CDbtag> >::const_iterator cit;
876 for (cit = oids.begin(); cit != oids.end(); ++cit) {
877 const CDbtag& dbtag = **cit;
889 infos.push_back(
"PH3");
891 else if (
id == 28889) {
892 infos.push_back(
"KGPhase1");
905 vector<string> extraInfos;
908 for (vector<string>::const_iterator cit = extraInfos.begin();
909 cit != extraInfos.end();
912 vector<string>::iterator fit =
913 std::find(infos.begin(), infos.end(),
value);
914 if (fit == infos.end()) {
915 infos.push_back(
value);
951 m_Os <<
"\t" << values;
static CRef< CScope > m_Scope
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
@ eExtreme_Positional
numerical value
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
void GetDate(string *label, bool year_only=false) const
Append a standardized string representation of the date to the label.
EDbtagType GetType(void) const
static CGenbankIdResolve & Get()
bool GetBestId(CSeq_id_Handle, CScope &, string &)
CConstRef< CUser_field > GetFieldRef(const string &str, const string &delim=".", NStr::ECase use_case=NStr::eCase) const
bool HasField(const string &str, const string &delim=".", NStr::ECase use_case=NStr::eCase) const
Verify that a named field exists.
const CUser_field & GetField(const string &str, const string &delim=".", NStr::ECase use_case=NStr::eCase) const
Access a named field in this user object.
static void NormalizeVariation(CVariation &var, ETargetContext target_ctxt, CScope &scope)
bool x_WriteFeaturePos(const CMappedFeat &, unsigned int start, const int type)
bool x_WriteHeader(const CSeq_annot &)
bool x_WriteData(const CSeq_annot &)
bool x_WriteFeatureAlt(const unsigned int start, const int type, const string &anchor, const list< int > &alt_types, const vector< string > &alt)
vector< string > m_GenotypeHeaders
virtual SAnnotSelector & SetAnnotSelector(void) override
bool x_WriteFeatureQual(const CMappedFeat &)
bool x_WriteFeatureGenotypeData(const CMappedFeat &)
bool x_WriteInit(const CSeq_annot &)
bool xWriteFeature(CFeat_CI feat_it) override
bool x_WriteFeatureRef(const unsigned int start, const int type, const string &anchor, const string &ref)
bool WriteAnnot(const CSeq_annot &, const string &="", const string &="") override
Write a raw Seq-annot to the internal output stream.
bool x_WriteFeature(const CMappedFeat &)
bool x_WriteFeatureId(const CMappedFeat &)
bool x_WriteFeatureFilter(const CMappedFeat &)
bool x_WriteFeatureChrom(const CMappedFeat &)
bool x_WriteFeatureInfo(const CMappedFeat &)
void x_GetTypeRefAlt(const CVariation_inst &inst, int &rtype, string &ref, list< int > &alt_types, vector< string > &alt)
bool x_WriteMeta(const CSeq_annot &)
bool x_WriteMetaCreateNew(const CSeq_annot &)
CVcfWriter(CScope &, CNcbiOstream &, TFlags=fNormal)
Defines and provides stubs for a general interface to a variety of file formatters.
virtual const CRange< TSeqPos > & GetRange(void) const
unique_ptr< SAnnotSelector > m_Selector
virtual SAnnotSelector & SetAnnotSelector(void)
Include a standard set of the NCBI C++ Toolkit most basic headers.
static const column_t columns[]
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
void Error(CExceptionArgs_Base &args)
#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)
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
void GetLabel(string *label, ELabelType type=eDefault, TLabelFlags flags=fLabel_Default) const
Append a label for this Seq-id to the supplied string.
string GetLabel(const CSeq_id &id)
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
CSeq_annot_Handle AddSeq_annot(CSeq_annot &annot, TPriority pri=kPriority_Default, EExist action=eExist_Throw)
Add Seq-annot, return its CSeq_annot_Handle.
CSeq_annot_Handle GetSeq_annotHandle(const CSeq_annot &annot, EMissing action=eMissing_Default)
const CSeq_feat::TExts & GetExts(void) const
bool IsSetDbxref(void) const
const CSeqFeatData & GetData(void) const
const CUser_object & GetExt(void) const
bool IsSetExts(void) const
CConstRef< CSeq_feat > GetOriginalSeq_feat(void) const
const CSeq_feat::TDbxref & GetDbxref(void) const
void Replace(const CSeq_feat &new_feat) const
Replace the feature with new Seq-feat object.
bool IsSetExt(void) const
CSeqVector GetSeqVector(EVectorCoding coding, ENa_strand strand=eNa_strand_plus) const
Get sequence: Iupacna or Iupacaa if use_iupac_coding is true.
@ eCoding_Iupac
Set coding to printable coding (Iupacna or Iupacaa)
const CSeq_loc & GetLocation(void) const
TRange GetTotalRange(void) const
const CSeq_feat_Handle & GetSeq_feat_Handle(void) const
Get original feature handle.
SAnnotSelector & SetSortOrder(ESortOrder sort_order)
Set sort order of annotations.
@ eSortOrder_None
do not sort annotations for faster retrieval
void GetSeqData(TSeqPos start, TSeqPos stop, string &buffer) const
Fill the buffer string with the sequence data for the interval [start, stop).
bool NotEmpty(void) const
TThisType IntersectionWith(const TThisType &r) const
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
static string DoubleToString(double value, int precision=-1, TNumToStringFlags flags=0)
Convert double to string.
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.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
static string Join(const TContainer &arr, const CTempString &delim)
Join strings using the specified delimiter.
static string UIntToString(unsigned int value, TNumToStringFlags flags=0, int base=10)
Convert UInt to string.
static string & ToLower(string &str)
Convert string to lower case – string& version.
@ fSplit_MergeDelimiters
Merge adjacent delimiters.
static const char label[]
const TStr & GetStr(void) const
Get the variant data.
bool IsStr(void) const
Check if variant Str is selected.
bool IsSetDb(void) const
name of database or system Check if a value has been assigned to Db data member.
bool IsSetType(void) const
type of object within class Check if a value has been assigned to Type data member.
bool IsStd(void) const
Check if variant Std is selected.
const TTag & GetTag(void) const
Get the Tag member data.
const TStrs & GetStrs(void) const
Get the variant data.
bool IsId(void) const
Check if variant Id is selected.
const TData & GetData(void) const
Get the Data member data.
bool CanGetTag(void) const
Check if it is safe to call GetTag method.
bool IsSetTag(void) const
appropriate tag Check if a value has been assigned to Tag data member.
const TFields & GetFields(void) const
Get the variant data.
const TDb & GetDb(void) const
Get the Db member data.
const TStr & GetStr(void) const
Get the variant data.
TReal GetReal(void) const
Get the variant data.
const TType & GetType(void) const
Get the Type member data.
vector< CStringUTF8 > TStrs
TId GetId(void) const
Get the variant data.
const TVariation & GetVariation(void) const
Get the variant data.
ENa_strand
strand of nucleic acid
const Tdata & Get(void) const
Get the member data.
const TDesc & GetDesc(void) const
Get the Desc member data.
bool IsSetDesc(void) const
used only for stand alone Seq-annots Check if a value has been assigned to Desc data member.
bool IsSet(void) const
Check if a value has been assigned to data member.
TType GetType(void) const
Get the Type member data.
const TInstance & GetInstance(void) const
Get the variant data.
bool IsSetFrequency_based_validation(void) const
Check if a value has been assigned to Frequency_based_validation data member.
const TVariant_prop & GetVariant_prop(void) const
Get the Variant_prop member data.
bool IsSetResource_link(void) const
Check if a value has been assigned to Resource_link data member.
TFrequency_based_validation GetFrequency_based_validation(void) const
Get the Frequency_based_validation member data.
E_Choice Which(void) const
Which variant is currently selected.
TGenotype GetGenotype(void) const
Get the Genotype member data.
const TSet & GetSet(void) const
Get the variant data.
bool IsSetDelta(void) const
Sequence that replaces the location, in biological order.
bool IsSetVariant_prop(void) const
variant properties bit fields Check if a value has been assigned to Variant_prop data member.
bool IsSetOther_ids(void) const
Check if a value has been assigned to Other_ids data member.
TEffect GetEffect(void) const
Get the Effect member data.
const TId & GetId(void) const
Get the Id member data.
const TDelta & GetDelta(void) const
Get the Delta member data.
const TData & GetData(void) const
Get the Data member data.
TResource_link GetResource_link(void) const
Get the Resource_link member data.
bool IsSetId(void) const
ids (i.e., SNP rsid / ssid, dbVar nsv/nssv) expected values include 'dbSNP|rs12334',...
TAllele_frequency GetAllele_frequency(void) const
Get the Allele_frequency member data.
TQuality_check GetQuality_check(void) const
Get the Quality_check member data.
bool IsSetEffect(void) const
Check if a value has been assigned to Effect data member.
bool IsSetGenotype(void) const
Check if a value has been assigned to Genotype data member.
const TOther_ids & GetOther_ids(void) const
Get the Other_ids member data.
bool IsSetQuality_check(void) const
Check if a value has been assigned to Quality_check data member.
bool IsSetAllele_frequency(void) const
NOTE: 'allele-frequency' here refers to the minor allele frequency of the default population Check if...
TGene_location GetGene_location(void) const
Get the Gene_location member data.
bool IsSetGene_location(void) const
Check if a value has been assigned to Gene_location data member.
const TVariations & GetVariations(void) const
Get the Variations member data.
@ eType_snv
delta=[morph of length 1] NOTE: this is snV not snP; the latter requires frequency-based validation t...
@ eType_mnp
delta=[morph of length >1]
@ eType_delins
delta=[del, ins]
@ e_Instance
actual sequence-edit at feat.location
range(_Ty, _Ty) -> range< _Ty >
constexpr bool empty(list< Ts... >) noexcept
const GenericPointer< typename T::ValueType > T2 value
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
CConstRef< CUser_object > s_GetVcfMetaInfo(const CSeq_annot &annot)