コード例 #1
0
ファイル: dtpcadmin.c プロジェクト: brnrc/ion-dtn
static void	infoProfile(int tokenCount, char **tokens)
{
	DtpcVdb		*vdb = getDtpcVdb();
	Profile		*vprofile;
	PsmAddress	elt;
	PsmPartition	wm = getIonwm();
	unsigned int	profileID;

	if (tokenCount != 3)
	{
		SYNTAX_ERROR;
		return;
	}
	
	profileID = atoi(tokens[2]);
	for (elt = sm_list_first(wm, vdb->profiles); elt;
			elt = sm_list_next(wm, elt))
	{
		vprofile = (Profile *) psp(wm, sm_list_data(wm, elt));
		if (vprofile->profileID == profileID)
		{
			break;
		}
	}

	if (elt == 0)
	{
		printText("Unknown profile.");
		return;
	}

	printProfile(vprofile);
}
コード例 #2
0
ファイル: AssemblyInstructions.hpp プロジェクト: ice799/lldb
int stepWithAssembly (A& addressSpace, uint64_t pc, RemoteUnwindProfile* profile, R& registers) {
    R newRegisters(registers);
    RemoteProcInfo *procinfo = addressSpace.getRemoteProcInfo();
    if (pc > profile->fEnd)
        ABORT("stepWithAssembly called with pc not in RemoteUnwindProfile's bounds");

    if (procinfo && (procinfo->getDebugLoggingLevel() & UNW_LOG_LEVEL_DEBUG))
        printProfile (addressSpace, pc, profile, registers);

    std::map<uint64_t, RemoteUnwindProfile::CFALocation>::iterator i = profile->cfa.lower_bound (pc);
    if (i == profile->cfa.begin() && i == profile->cfa.end())
        return UNW_EINVAL;
    if (i == profile->cfa.end()) {
        --i;
    } else {
        if (i != profile->cfa.begin() && i->first != pc)
          --i;
    }

    uint64_t cfa = registers.getRegister (i->second.regno) + i->second.offset;
    
    std::map<uint64_t, std::vector<RemoteUnwindProfile::SavedReg> >::iterator j;

    for (j = profile->saved_registers.begin(); j != profile->saved_registers.end() && j->first <= pc; ++j) {
        std::vector<RemoteUnwindProfile::SavedReg>::iterator k = j->second.begin();
        for (; k != j->second.end(); ++k) {
            RemoteUnwindProfile::SavedReg sr = *k;
            if (sr.type == RemoteUnwindProfile::kGeneralPurposeRegister) {
                uint64_t result;
                int err = 0;
                switch (sr.location) {
                    case RemoteUnwindProfile::kRegisterOffsetFromCFA: 
                        result = addressSpace.getP(cfa + sr.value, err);
                        break;
                    case RemoteUnwindProfile::kRegisterIsCFA:
                            result = cfa;
                        break;
                    default:
                        ABORT("Unknown saved register location in stepWithAssembly.");
                }
                // If we failed to read remote memory, stop unwinding.
                if (err)
                    return UNW_STEP_END;
                newRegisters.setRegister (sr.regno, result);
            }
        }
    }
    newRegisters.setSP(cfa);
    uint64_t ip = addressSpace.getP(cfa + profile->returnAddress.value);
    if (ip == 0) 
      return UNW_STEP_END;
    newRegisters.setIP(ip);
    registers = newRegisters;
    return UNW_STEP_SUCCESS;
}
コード例 #3
0
ファイル: dtpcadmin.c プロジェクト: brnrc/ion-dtn
static void	listProfiles(int tokenCount, char **tokens)
{
	PsmPartition	wm = getIonwm();
	PsmAddress	elt;
	Profile		*vprofile;

	if (tokenCount != 2)
	{
		SYNTAX_ERROR;
		return;
	}	

	for (elt = sm_list_first(wm, (getDtpcVdb())->profiles); elt;
			elt = sm_list_next(wm, elt))
	{
		vprofile = (Profile *) psp(wm, sm_list_data(wm, elt));
		printProfile(vprofile);
	}
}
コード例 #4
0
ファイル: print_results.c プロジェクト: NickPanyushev/R_stuff
static
void printCountmatAndSites(Profile *countmat, int *sites, double *scorePerSite, Dataset *data)
{
	updateCountmatFromSites(countmat, sites, data);
	Profile *profile = initProfile(countmat->span, countmat->maxspan);
	copyProfile(profile, countmat);

	//normalize "profile"
	for(int x = 0; x < countmat->span; x++) {
		if( !profile->isgap[x]) {
			double sum = 0.0;
			for(int y = 0; y < NUMALPHAS; y++) {
				sum += profile->mat[x][y];
			}
			for(int y = 0; y < NUMALPHAS; y++) {
				profile->mat[x][y] /= sum;
			}
		}
	}

	/* print profile */
	printf("Motif profile generated from sites:\n"); 
	printProfile(stdout, profile);

	printf("Flanking regions:\n"); 
	printFlankingRegionProfile(stdout, sites, countmat->span, data);


	/* NOW, PRINT CONSENSUS MOTIF */
	printf("Motif span: %d\n", profile->span);
	printf("Motif weight/width: %d\n", profile->cols);
	printf("Consensus motif: ");
	for(int x=0; x< profile->span; x++) {
		if(!profile->isgap[x]) {
			if(profile->mat[x][0] > 0.5) 
				printf("A");
			else if(profile->mat[x][1] > 0.5) 
				printf("C");
			else if(profile->mat[x][2] > 0.5) 
				printf("G");
			else if(profile->mat[x][3] > 0.5) 
				printf("T");
			else 
				printf("N");
		}
		else {
			printf("_");
		}
	}
	printf("\n");

	int numsites = getNumSites(sites, data->numseqs);
	printf("Number of predicted sites: %d (%.2lf%%)\n", numsites, (numsites * 100.0) / data->numseqs);
	printf("\n");

	if(profile->span != profile->cols) {
		printGapPos(stdout, profile);
		printf("\n");
	}

	printf("Sequence range is from 0 to (number of sequences - 1).\n");
	printf("Motif sites are in range 1 to length or -1 to -length.\n");
	for(int i=0; i< data->numseqs; i++) {
		if(sites[i] >= 0) {
			int pos = getConcat2DoubleStrandPos(data,i,sites[i]);
			int revcomplPos = getConcat2DoubleStrandPos(data, i, getConcatPosOfOppStrand(data, i, sites[i], profile->span));
			printf("Sequence %3d: motif site %6d  (%6d)\n",i, pos, revcomplPos);
		}
		else {
			printf("Sequence %3d: motif site %6s  (%6s)\n",i, "none", "none");
		}
	}
	

	printf("\n");
	printf("Alignments and FASTA-headers:\n");
	printAlignment(stdout, sites, profile->span, scorePerSite, data);
	printf("\n");
	if(numsites < data->numseqs) {
		printf("FASTA-header of sequences with zero occurrences:\n");
		printZeroOccurrencesSeqHeaders(stdout, sites, data);
		printf("\n");
	}
	nilProfile(profile);
}