Example #1
0
/* output a particular species sequence to the file stream */
void writeOutSpecies(FILE *f, char *dbName, struct speciesInfo *si, 
    struct exonInfo *giList)
{
if (inExons)
    {
    if (noTrans)
	outSpeciesExonsNoTrans(f, dbName, si, giList);
    else
	outSpeciesExons(f, dbName, si, giList);
    return;
    }

struct exonInfo *lastGi;
//int start = giList->chromStart + 1;

for(lastGi = giList; lastGi->next ; lastGi = lastGi->next)
    ;
//int end = lastGi->chromEnd;

if (noTrans)
    {
    for(; si ; si = si->next)
	{
	if (!allDashes(si->nucSequence))
	    {
	    //fprintf(f, ">%s_%s %d %s.%s:%d-%d %c",
	    fprintf(f, ">%s_%s %d %s",
		giList->name, si->name, si->size, allPos(si));
		//dbName,
		//giList->frame->chrom, start, end, giList->frame->strand[0]);

	    maybePrintGeneName(giList->name, f);
	    fprintf(f, "\n%s\n", si->nucSequence);
	    }
	}
    fprintf(f, "\n\n");
    }
else
    {
    for(; si ; si = si->next)
	{
	translateProtein(si);
	if (!allDashes(si->aaSequence))
	    {
	    //fprintf(f, ">%s_%s %d %s.%s:%d-%d %c",
	    fprintf(f, ">%s_%s %d %s",
		giList->name, si->name, si->aaSize, allPos(si));

		//dbName,
		//giList->frame->chrom, start, end, giList->frame->strand[0]);

	    maybePrintGeneName(giList->name, f);

	    fprintf(f, "\n%s\n", si->aaSequence);
	    }
	}
    fprintf(f, "\n\n");
    }
}
Example #2
0
std::vector<int> Controller::calculatePositions(double t)
{   
    double angle, offset, amp, wav;
    vector<int> allPos(d->getNumMotors(),-1);

    for (unsigned int i = 0; i < d->getNumMotors(); i++) {

        if (i%2==0) // n odd (n = i + 1, since i is 0-indexed)
        {
            offset = p->manualoffset ? p->offset[i] : p->masteroffsetOdd;
            amp = p->manualamplitude ? p->amplitude[i] : p->amplitudeOdd;
            wav = p->wavelengthOdd;
            if (p->wavelengthOdd == 0)
                wav = 1;
            angle = (offset + amp*sin(2*PI*(p->frequencyOdd*t + i/wav)))*PI;
        }
        else
        {
            offset = p->manualoffset ? p->offset[i] : p->masteroffsetEven;
            amp = p->manualamplitude ? p->amplitude[i] : p->amplitudeEven;
            wav = p->wavelengthEven;
            if (p->wavelengthEven == 0)
                wav = 1;
            angle = (offset + amp*sin(PI*(2*(p->frequencyEven*t + i/wav) + (p->phaseEven-p->phaseOdd))))*PI;
        }
        if (angle > PI/2)
            angle = PI/2;
        else if (angle < -PI/2)
            angle = -PI/2;
        allPos[i] = angle2Position(angle,d->getModel(i),true);
    }
    return allPos;
}
Example #3
0
Aggregate ET::anything(Aggregate s,AggregateOrdered positions){
	Word n=positions.elements();
	return n==0 ? allPos(s,n) : allPos(s,positions[0]);
}
Example #4
0
/* output a particular species sequence to the file stream */
static void writeOutSpecies(FILE *f, char *dbName, struct speciesInfo *si, 
    struct exonInfo *giList, unsigned options, int numCols)
{
boolean inExons = options & MAFGENE_EXONS;
boolean noTrans = options & MAFGENE_NOTRANS;
boolean doBlank = options & MAFGENE_OUTBLANK;
boolean doTable = options & MAFGENE_OUTTABLE;

if (inExons)
    {
    if (noTrans)
	outSpeciesExonsNoTrans(f, dbName, si, giList, doBlank, 
	    doTable, numCols);
    else
	outSpeciesExons(f, dbName, si, giList, doBlank, doTable, numCols);
    return;
    }

struct exonInfo *lastGi;

for(lastGi = giList; lastGi->next ; lastGi = lastGi->next)
    ;

if (noTrans)
    {
    for(; si ; si = si->next)
	{
	if (doBlank || !allDashes(si->nucSequence))
	    {
	    char buffer[10 * 1024];

	    safef(buffer, sizeof buffer, "%s_%s %d %s",
		giList->name, si->name, si->size, allPos(si));

	    if (doTable)
		{
		if (numCols == -1)
		    fprintf(f, "%s ", buffer);
		else
		    {
		    if (strlen(buffer) > numCols)
			buffer[numCols] = 0;
		    fprintf(f, "%-*s ", numCols, buffer);
		    }
		}
	    else
		fprintf(f, ">%s\n", buffer);

	    fprintf(f, "%s\n", si->nucSequence);
	    }
	}
    fprintf(f, "\n\n");
    }
else
    {
    for(; si ; si = si->next)
	{
	translateProtein(si);

	char buffer[10 * 1024];

	safef(buffer, sizeof buffer, "%s_%s %d %s",
	    giList->name, si->name, si->aaSize, allPos(si));

	if (doBlank || !allDashes(si->aaSequence))
	    {
	    if (doTable)
		{
		if (numCols == -1)
		    fprintf(f, "%s ", buffer);
		else
		    {
		    if (strlen(buffer) > numCols)
			buffer[numCols] = 0;
		    fprintf(f, "%-*s ", numCols, buffer);
		    }
		}
	    else
		fprintf(f, ">%s\n", buffer);

	    fprintf(f, "%s\n", si->aaSequence);
	    }
	}
    fprintf(f, "\n\n");
    }
}