string ofxTweakbarSimpleStorage::getPath() {
	// When using the testApp::testApp() constructor the current working
	// directory is different than when in the testApp::setup(). Kind of wierd,
	// but this function takes this into account.
	
	// TODO: test/update when 007 stable is released
	string filepath;
	Poco::Path p;
	string curr_path = p.current();
	Poco::Path p_data(curr_path + "data/");
	Poco::File file(p_data);
	if(file.exists()) {
		filepath = curr_path +"data/" +getBar()->getFileName();
	}
	else {
		if(POCO_OS_MAC_OS_X) {
			filepath = "../../../data/" +getBar()->getFileName();
		} 
		else {	
			filepath = "data/" +getBar()->getFileName();
		}
	}
	ofLog(OF_LOG_VERBOSE, filepath);
	return filepath;
}
Exemple #2
0
posterior_set *posterior(const int *matches, float *p_quals, float p_prior, float p_match, int n) {
  /* The posterior for both the random model and the non-random
     model.
     
     `matches`: a int array of 0s and 1s indicating matching and
     mismatch positions.
     `p_quals`: quality values convered to probabilities.
     `p_prior`: prior probability
     `p_match`: probability of a match (for DNA: default is 0.25)
     `n`: match length.     
  */

  posterior_set *ps = xmalloc(sizeof(posterior_set));
  likelihood_set *ls = likelihood(matches, p_quals, p_match, n);
  double p_denom = p_data(matches, p_quals, p_prior, p_match, n);
  ps->contam = (ls->contam * p_prior)/p_denom;
  ps->random = (ls->random * (1-p_prior))/p_denom;
  ps->is_contam = ps->contam > ps->random;
  free(ls);
  return ps;  
}
Exemple #3
0
/**
 * \brief Search the workspace according to a file.
 * \param path The path of the file.
 */
std::string
bf::path_configuration::search_workspace( const std::string& path ) const
{
    std::string result;
    boost::filesystem::path p_file = resolve_path( path );

    workspace::path_list_const_iterator it;
    workspaces_const_iterator it_map;

    for ( it_map = m_workspaces.begin();
            it_map != m_workspaces.end() && result.empty(); ++it_map )
        for ( it = it_map->second.data_begin();
                it != it_map->second.data_end() && result.empty(); ++it )
        {
            boost::filesystem::path p_data( boost::filesystem::absolute(*it) );

            if ( p_file.string().find( p_data.string() ) == 0 )
                result = it_map->first;
        }

    return result;
} // path_configuration::search_workspace()