当前位置: 首页>>代码示例>>C++>>正文


C++ Allele::seq方法代码示例

本文整理汇总了C++中Allele::seq方法的典型用法代码示例。如果您正苦于以下问题:C++ Allele::seq方法的具体用法?C++ Allele::seq怎么用?C++ Allele::seq使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Allele的用法示例。


在下文中一共展示了Allele::seq方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: alleleAttributes

    AlleleAttributes alleleAttributes(Allele & main_allele, Allele & reference_allele) {

        assert(!(main_allele.seq().empty()));
        assert(!(reference_allele.seq().empty()));

        assert(!(reference_allele.isMissing()));

    	if (main_allele.isMissing()) {

    		return AlleleAttributes(Type::Missing, 0, 0, 0);
    	}

    	if (main_allele == reference_allele) {

    		return AlleleAttributes(Type::Reference, main_allele.seq().size(), count(main_allele.seq().begin(), main_allele.seq().end(), 'N'), 0);
    	}

    	Allele trimmed_main_allele = main_allele;
    	Allele trimmed_reference_allele = reference_allele;

    	fullTrimAllelePair(&trimmed_main_allele, &trimmed_reference_allele);
        assert(!(trimmed_main_allele.seq().empty()) or !(trimmed_reference_allele.seq().empty()));

        uint trimmed_main_allele_length = trimmed_main_allele.seq().size();
        uint trimmed_reference_allele_length = trimmed_reference_allele.seq().size();

        uint trimmed_main_allele_num_ambiguous = count(trimmed_main_allele.seq().begin(), trimmed_main_allele.seq().end(), 'N');

    	if (trimmed_main_allele_length == trimmed_reference_allele_length) {

            auto allele_type = Type::Complex;

    		if (trimmed_main_allele_length == 1) {

	    		allele_type = Type::SNP;

    		} else if (isInversion(trimmed_main_allele, trimmed_reference_allele, 0.95, 10)) {

                allele_type = Type::Inversion;
    		} 

	    	return AlleleAttributes(allele_type, trimmed_main_allele_length, trimmed_main_allele_num_ambiguous, 0);

    	} else {

            auto allele_type = Type::Complex;

            if (trimmed_main_allele_length == 0) {

                allele_type = Type::Deletion;

            } else if (trimmed_reference_allele_length == 0) {

                allele_type = Type::Insertion;
            } 

            return AlleleAttributes(allele_type, trimmed_main_allele_length, trimmed_main_allele_num_ambiguous, trimmed_main_allele_length - trimmed_reference_allele_length);          
        }
    }
开发者ID:bioinformatics-centre,项目名称:BayesTyper,代码行数:59,代码来源:Auxiliaries.cpp

示例2: hasAmbiguous

    bool hasAmbiguous(Allele & allele) {

        if (allele.seq().find_first_of("N") != string::npos) {

            return true;
        
        } else {

            return false;
        }
    }
开发者ID:bioinformatics-centre,项目名称:BayesTyper,代码行数:11,代码来源:Auxiliaries.cpp

示例3: isInversion

    bool isInversion(Allele & main_allele, Allele & reference_allele, const float min_match_fraction, const uint min_size) {

    	if (main_allele.seq().size() != reference_allele.seq().size()) {

    		return false;
    	}

        if (main_allele.seq().size() < min_size) {

            return false;
        }

        string main_allele_rv = reverseComplementSequence(main_allele.seq());
        assert(main_allele_rv.size() == reference_allele.seq().size());

    	auto main_rv_it = main_allele_rv.begin();
    	auto reference_rit = reference_allele.seq().begin();

    	uint num_correct_bases = 0;

    	while (main_rv_it != main_allele_rv.end()) {

            if ((*main_rv_it == *reference_rit) and (*main_rv_it != 'N')) {

                num_correct_bases++;                
            }

    		main_rv_it++;
    		reference_rit++;
    	}

    	assert(num_correct_bases <= main_allele_rv.size());
    	assert(reference_rit == reference_allele.seq().end());

    	if ((static_cast<float>(num_correct_bases)/main_allele_rv.size()) < min_match_fraction) {

    		return false;

    	} else {

    		return true;
    	}
    }
开发者ID:bioinformatics-centre,项目名称:BayesTyper,代码行数:43,代码来源:Auxiliaries.cpp


注:本文中的Allele::seq方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。