Exemplo n.º 1
0
void funcInputData()
{
	/* Example of Input files :
	* numberofInputs (not existing now)
	* NameofRNA 
	* ProteinSequence
	* ... * numberofInputs
	*
	* CDSforA
	* 455 1000
	* (string of sequences~)
	* ... * numberofInputs
	*/
	pFONTElementRef->ToElement()->SetAttribute("face",  "consolas");
	structRna xRna[4]; // Assume there is only 4 input.
	int iNumberofInput ; // Fix variable for now, but made for If there are more inputs
	//Deal with Proteins
	std::ifstream fileToRead("data.txt");
	fileToRead >> iNumberofInput;
	{ 
		std::string tmpFlush;
		getline(fileToRead, tmpFlush);
	}
	for(int xIterator = 0 ; xIterator < iNumberofInput ; ++xIterator )
	{
		getline( fileToRead, xRna[xIterator].sName );
		getline( fileToRead, xRna[xIterator].sProteinSequence );
	}
	funcCompare(xRna, iNumberofInput);
		//Deal with Sequences
	for(int xIterator = 0 ; xIterator < iNumberofInput ; ++xIterator )
	{
		int tmpCDSstarts;
		int tmpCDSends;
		std::string tmpString;
		fileToRead >> tmpCDSstarts >> tmpCDSends;
		fileToRead >> tmpString;
		for(int xCurrentPos = tmpCDSstarts-1 ; xCurrentPos < tmpCDSends ; ++xCurrentPos){
			xRna[xIterator].sSequenceBetweenCDS.push_back(tmpString[xCurrentPos]);
		} // inner for
	} // outer for
	funcSequenceCompare(xRna, iNumberofInput);
}
Exemplo n.º 2
0
/**
 * Merge left and right lists into a new list.
 */
static listnode_t *mergeLists(listnode_t *left, listnode_t *right,
                              comparefunc funcCompare)
{
    listnode_t tmp, *np;

    np = &tmp;
    tmp.next = np;
    while(left != NULL && right != NULL)
    {
        if(funcCompare(left->data, right->data) <= 0)
        {
            np->next = left;
            np = left;

            left = left->next;
        }
        else
        {
            np->next = right;
            np = right;

            right = right->next;
        }
    }

    // At least one of these lists is now empty.
    if(left)
        np->next = left;
    if(right)
        np->next = right;

    // Is the list empty?
    if(tmp.next == &tmp)
        return NULL;

    return tmp.next;
}