Example #1
0
// extract from each line different columns
// and give them to further processing
int processLine(stringList columns, int qualThreshold, int covThreshold, int &seqCount) 
{
    string transcriptID, pos, refbase, reads, baseQuals;
    int cov;
    if (columns.size() == 6) 
    {
        cov = atoi(columns[3].c_str());
        refbase = columns[2];
        if (cov > covThreshold)
        { 
            transcriptID = columns[0];
            pos = columns[1];
            reads = columns[4];
            baseQuals = columns[5];
            assert (baseQuals.length() == cov) ;
			extractMismatches(reads,baseQuals,cov, transcriptID,pos,refbase, qualThreshold, seqCount);
        }
    }
    return 0;
}
Example #2
0
	//Get all Name in order
	bool PWM::_getOrderedPositionNames(stringList& pos, stringList& names){
        
		for(size_t i=0;i<pos.size();i++){
            size_t nameHeader=pos[i].find("NAME:");
			if (nameHeader == std::string::npos){
				continue;
			}
            size_t nameLineEnding=pos[i].find_first_of("\n",nameHeader);
            std::string name = pos[i].substr(nameHeader+5,nameLineEnding-(nameHeader+5));
            clear_whitespace(name, " \t\n");
            if (names.contains(name)){
                std::cerr << "Position with name of: " << name << " is defined twice in the model\n";
                return false;
            }
            else{
                names.push_back(name);
            }
        }
        return true;
    }
Example #3
0
// extract from each line different columns
// and give them to further processing
void processLine( stringList columns, int qualThreshold, int coverageThreshold) 
{
    if (columns[2] != "N" && columns[2] != "." && columns[2] != "_" )
    {
        string transcriptID, pos, ref, reads, baseQuals;
        int cov;
        if (columns.size() == 6) 
        {
            cov = atoi(columns[3].c_str());
            if (cov > coverageThreshold)
            { 
                transcriptID = columns[0];
                pos = columns[1];
                ref = columns[2];
                reads = columns[4];
                baseQuals = columns[5];
                assert ( baseQuals.length() == cov ) ;
				extractMismatches(reads, baseQuals, cov, transcriptID, 
								pos, ref, qualThreshold, coverageThreshold);
            }
        }
    }
}
//define extra field
int findField(stringList columns,string &XGfield, 
                string &NMfield, string &MDfield)
{
    int i;
    string field;
    for (i = 10 ; i < columns.size(); i++)
    {
        field = columns[i];
        if (field.substr(0,2) == "XG")
        {
            XGfield = field;
        }
        else if (field.substr(0,2) == "NM")
        {
            NMfield = field;
        }
        else if (field.substr(0,2) == "MD")
        {
            MDfield = field;
        }
    }
    return 0;
}