本文整理汇总了C++中GroupInfo类的典型用法代码示例。如果您正苦于以下问题:C++ GroupInfo类的具体用法?C++ GroupInfo怎么用?C++ GroupInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GroupInfo类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NS_ASSERTION
void
QuotaObject::UpdateSize(int64_t aSize)
{
QuotaManager* quotaManager = QuotaManager::Get();
NS_ASSERTION(quotaManager, "Shouldn't be null!");
MutexAutoLock lock(quotaManager->mQuotaMutex);
if (!mOriginInfo) {
return;
}
GroupInfo* groupInfo = mOriginInfo->mGroupInfo;
if (groupInfo->IsForTemporaryStorage()) {
quotaManager->mTemporaryStorageUsage -= mSize;
}
groupInfo->mUsage -= mSize;
mOriginInfo->mUsage -= mSize;
mSize = aSize;
mOriginInfo->mUsage += mSize;
groupInfo->mUsage += mSize;
if (groupInfo->IsForTemporaryStorage()) {
quotaManager->mTemporaryStorageUsage += mSize;
}
}
示例2: throw
void NsAdapterCatalog::updateGroup(const GroupInfo& group) throw (DmException)
{
// gid may not be initialized
GroupInfo g = this->getGroup(group.name);
wrapCall(dpns_modifygrpmap(g.getUnsigned("gid"),
(char*)group.name.c_str(),
group.getLong("banned")));
}
示例3: throw
std::vector<GroupInfo> BuiltInAuthn::getGroups(void) throw (DmException)
{
std::vector<GroupInfo> groups;
GroupInfo group;
struct group* ent;
while ((ent = getgrent()) != NULL) {
group.clear();
group.name = ent->gr_name;
group["gid"] = ent->gr_gid;
}
return groups;
}
示例4: IPeekBuffer
int plNetMsgGroupOwner::IPeekBuffer(hsStream* stream, uint32_t peekOptions)
{
int bytes=plNetMsgServerToClient::IPeekBuffer(stream, peekOptions);
if (bytes)
{
int i, num;
stream->LogReadLE(&num,"GroupOwnerNum");
fGroups.resize(num);
for(i=0;i<num;i++)
{
GroupInfo gr;
gr.Read(stream);
fGroups[i]=gr;
}
bytes=stream->GetPosition();
}
return bytes;
}
示例5: throw
void AuthnOracle::updateGroup(const GroupInfo& group) throw (DmException)
{
occi::Statement* stmt = getPreparedStatement(this->conn_, STMT_UPDATE_GROUP);
try {
stmt->setInt(1, group.getLong("banned"));
stmt->setString(2, group.name);
stmt->executeUpdate();
this->conn_->commit();
this->conn_->terminateStatement(stmt);
}
catch (occi::SQLException& ex) {
this->conn_->rollback();
throw DmException(DM_INTERNAL_ERROR, ex.getMessage());
}
}
示例6:
bool suPHP::GroupInfo::operator==(const GroupInfo& ginfo) const {
if (this->getGid() == ginfo.getGid())
return true;
else
return false;
}
示例7: main
//.........这里部分代码省略.........
for (int i = 6; i < argc; i++) {
if (!strcmp(argv[i], "-p")) { nThreads = atoi(argv[i + 1]); }
if (!strcmp(argv[i], "-b")) {
genBamF = true;
inpSamType = argv[i + 1][0];
strcpy(inpSamF, argv[i + 2]);
if (atoi(argv[i + 3]) == 1) {
strcpy(fn_list, argv[i + 4]);
pt_fn_list = (char*)(&fn_list);
}
}
if (!strcmp(argv[i], "-q")) { quiet = true; }
if (!strcmp(argv[i], "--gibbs-out")) { genGibbsOut = true; }
if (!strcmp(argv[i], "--sampling")) { bamSampling = true; }
if (!strcmp(argv[i], "--seed")) {
hasSeed = true;
int len = strlen(argv[i + 1]);
seed = 0;
for (int k = 0; k < len; k++) seed = seed * 10 + (argv[i + 1][k] - '0');
}
if (!strcmp(argv[i], "--calc-evaluation-score")) {
calcEvalScore = true;
nb_r = atof(argv[i + 1]);
nb_p = atof(argv[i + 2]);
L = atoi(argv[i + 3]);
w = atoi(argv[i + 4]);
}
}
general_assert(nThreads > 0, "Number of threads should be bigger than 0!");
verbose = !quiet;
//basic info loading
sprintf(refF, "%s.seq", refName);
refs.loadRefs(refF);
M = refs.getM();
sprintf(tiF, "%s.ti", refName);
transcripts.readFrom(tiF);
sprintf(cntF, "%s.cnt", statName);
fin.open(cntF);
general_assert(fin.is_open(), "Cannot open " + cstrtos(cntF) + "! It may not exist.");
fin>>N0>>N1>>N2>>N_tot;
fin.close();
general_assert(N1 > 0, "There are no alignable reads!");
if ((READ_INT_TYPE)nThreads > N1) nThreads = N1;
//set model parameters
mparams.M = M;
mparams.N[0] = N0; mparams.N[1] = N1; mparams.N[2] = N2;
mparams.refs = &refs;
sprintf(mparamsF, "%s.mparams", imdName);
fin.open(mparamsF);
general_assert(fin.is_open(), "Cannot open " + cstrtos(mparamsF) + "It may not exist.");
fin>> mparams.minL>> mparams.maxL>> mparams.probF;
int val; // 0 or 1 , for estRSPD
fin>>val;
mparams.estRSPD = (val != 0);
fin>> mparams.B>> mparams.mate_minL>> mparams.mate_maxL>> mparams.mean>> mparams.sd;
fin>> mparams.seedLen;
fin.close();
//run EM
switch(read_type) {
case 0 : EM<SingleRead, SingleHit, SingleModel>(); break;
case 1 : EM<SingleReadQ, SingleHit, SingleQModel>(); break;
case 2 : EM<PairedEndRead, PairedEndHit, PairedEndModel>(); break;
case 3 : EM<PairedEndReadQ, PairedEndHit, PairedEndQModel>(); break;
default : fprintf(stderr, "Unknown Read Type!\n"); exit(-1);
}
if (calcEvalScore) {
CalcEvalScore ces(refs, nb_r, nb_p, L, w, statName);
sprintf(scoreF, "%s.score", outName);
ces.writeScoresTo(scoreF);
char groupF[STRLEN];
GroupInfo gi;
sprintf(groupF, "%s.grp", argv[1]);
gi.load(groupF);
ces.generateExpressionFiles(gi, transcripts, scoreF);
}
time_t b = time(NULL);
printTimeUsed(a, b, "EM.cpp");
return 0;
}
示例8: calcCI_batch
void* calcCI_batch(void* arg) {
float *itsamples, *gtsamples;
ifstream fin;
CIParams *ciParams = (CIParams*)arg;
itsamples = new float[nSamples];
gtsamples = new float[nSamples];
fin.open(tmpF, ios::binary);
streampos pos = streampos(gi.spAt(ciParams->start_gene_id)) * nSamples * FLOATSIZE;
fin.seekg(pos, ios::beg);
int cnt = 0;
for (int i = ciParams->start_gene_id; i < ciParams->end_gene_id; i++) {
int b = gi.spAt(i), e = gi.spAt(i + 1);
memset(gtsamples, 0, FLOATSIZE * nSamples);
for (int j = b; j < e; j++) {
for (int k = 0; k < nSamples; k++) {
fin.read((char*)(&itsamples[k]), FLOATSIZE);
gtsamples[k] += itsamples[k];
}
calcCI(nSamples, itsamples, iso_tau[j].lb, iso_tau[j].ub);
}
calcCI(nSamples, gtsamples, gene_tau[i].lb, gene_tau[i].ub);
++cnt;
if (verbose && cnt % 1000 == 0) { printf("In thread %d, %d genes are processed for CI calculation!\n", ciParams->no, cnt); }
}
fin.close();
delete[] itsamples;
delete[] gtsamples;
return NULL;
}
示例9: main
int main(int argc, char* argv[]) {
ifstream fin;
bool quiet = false;
if (argc < 5) {
printf("Usage : rsem-run-em refName read_type sampleName sampleToken [-p #Threads] [-b samInpType samInpF has_fn_list_? [fn_list]] [-q] [--gibbs-out] [--sampling]\n\n");
printf(" refName: reference name\n");
printf(" read_type: 0 single read without quality score; 1 single read with quality score; 2 paired-end read without quality score; 3 paired-end read with quality score.\n");
printf(" sampleName: sample's name, including the path\n");
printf(" sampleToken: sampleName excludes the path\n");
printf(" -p: number of threads which user wants to use. (default: 1)\n");
printf(" -b: produce bam format output file. (default: off)\n");
printf(" -q: set it quiet\n");
printf(" --gibbs-out: generate output file used by Gibbs sampler. (default: off)\n");
printf(" --sampling: sample each read from its posterior distribution when bam file is generated. (default: off)\n");
printf("// model parameters should be in imdName.mparams.\n");
exit(-1);
}
time_t a = time(NULL);
strcpy(refName, argv[1]);
read_type = atoi(argv[2]);
strcpy(outName, argv[3]);
sprintf(imdName, "%s.temp/%s", argv[3], argv[4]);
sprintf(statName, "%s.stat/%s", argv[3], argv[4]);
nThreads = 1;
genBamF = false;
bamSampling = false;
genGibbsOut = false;
pt_fn_list = pt_chr_list = NULL;
for (int i = 5; i < argc; i++) {
if (!strcmp(argv[i], "-p")) { nThreads = atoi(argv[i + 1]); }
if (!strcmp(argv[i], "-b")) {
genBamF = true;
inpSamType = argv[i + 1][0];
strcpy(inpSamF, argv[i + 2]);
if (atoi(argv[i + 3]) == 1) {
strcpy(fn_list, argv[i + 4]);
pt_fn_list = (char*)(&fn_list);
}
}
if (!strcmp(argv[i], "-q")) { quiet = true; }
if (!strcmp(argv[i], "--gibbs-out")) { genGibbsOut = true; }
if (!strcmp(argv[i], "--sampling")) { bamSampling = true; }
}
general_assert(nThreads > 0, "Number of threads should be bigger than 0!");
verbose = !quiet;
//basic info loading
sprintf(refF, "%s.seq", refName);
refs.loadRefs(refF);
M = refs.getM();
sprintf(groupF, "%s.grp", refName);
gi.load(groupF);
m = gi.getm();
sprintf(tiF, "%s.ti", refName);
transcripts.readFrom(tiF);
sprintf(cntF, "%s.cnt", statName);
fin.open(cntF);
general_assert(fin.is_open(), "Cannot open " + cstrtos(cntF) + "! It may not exist.");
fin>>N0>>N1>>N2>>N_tot;
fin.close();
general_assert(N1 > 0, "There are no alignable reads!");
if ((READ_INT_TYPE)nThreads > N1) nThreads = N1;
//set model parameters
mparams.M = M;
mparams.N[0] = N0; mparams.N[1] = N1; mparams.N[2] = N2;
mparams.refs = &refs;
sprintf(mparamsF, "%s.mparams", imdName);
fin.open(mparamsF);
general_assert(fin.is_open(), "Cannot open " + cstrtos(mparamsF) + "It may not exist.");
fin>> mparams.minL>> mparams.maxL>> mparams.probF;
int val; // 0 or 1 , for estRSPD
fin>>val;
mparams.estRSPD = (val != 0);
fin>> mparams.B>> mparams.mate_minL>> mparams.mate_maxL>> mparams.mean>> mparams.sd;
fin>> mparams.seedLen;
fin.close();
//run EM
switch(read_type) {
case 0 : EM<SingleRead, SingleHit, SingleModel>(); break;
case 1 : EM<SingleReadQ, SingleHit, SingleQModel>(); break;
case 2 : EM<PairedEndRead, PairedEndHit, PairedEndModel>(); break;
//.........这里部分代码省略.........
示例10: writeResults
void writeResults(ModelType& model, double* counts) {
double denom;
char outF[STRLEN];
FILE *fo;
sprintf(modelF, "%s.model", statName);
model.write(modelF);
//calculate tau values
double *tau = new double[M + 1];
memset(tau, 0, sizeof(double) * (M + 1));
denom = 0.0;
for (int i = 1; i <= M; i++)
if (eel[i] >= EPSILON) {
tau[i] = theta[i] / eel[i];
denom += tau[i];
}
general_assert(denom > 0, "No alignable reads?!");
for (int i = 1; i <= M; i++) {
tau[i] /= denom;
}
//isoform level results
sprintf(outF, "%s.iso_res", imdName);
fo = fopen(outF, "w");
for (int i = 1; i <= M; i++) {
const Transcript& transcript = transcripts.getTranscriptAt(i);
fprintf(fo, "%s%c", transcript.getTranscriptID().c_str(), (i < M ? '\t' : '\n'));
}
for (int i = 1; i <= M; i++)
fprintf(fo, "%.2f%c", counts[i], (i < M ? '\t' : '\n'));
for (int i = 1; i <= M; i++)
fprintf(fo, "%.15g%c", tau[i], (i < M ? '\t' : '\n'));
for (int i = 1; i <= M; i++) {
const Transcript& transcript = transcripts.getTranscriptAt(i);
fprintf(fo, "%s%c", transcript.getGeneID().c_str(), (i < M ? '\t' : '\n'));
}
fclose(fo);
//gene level results
sprintf(outF, "%s.gene_res", imdName);
fo = fopen(outF, "w");
for (int i = 0; i < m; i++) {
const string& gene_id = transcripts.getTranscriptAt(gi.spAt(i)).getGeneID();
fprintf(fo, "%s%c", gene_id.c_str(), (i < m - 1 ? '\t' : '\n'));
}
for (int i = 0; i < m; i++) {
double sumC = 0.0; // sum of counts
int b = gi.spAt(i), e = gi.spAt(i + 1);
for (int j = b; j < e; j++) sumC += counts[j];
fprintf(fo, "%.2f%c", sumC, (i < m - 1 ? '\t' : '\n'));
}
for (int i = 0; i < m; i++) {
double sumT = 0.0; // sum of tau values
int b = gi.spAt(i), e = gi.spAt(i + 1);
for (int j = b; j < e; j++) sumT += tau[j];
fprintf(fo, "%.15g%c", sumT, (i < m - 1 ? '\t' : '\n'));
}
for (int i = 0; i < m; i++) {
int b = gi.spAt(i), e = gi.spAt(i + 1);
for (int j = b; j < e; j++) {
fprintf(fo, "%s%c", transcripts.getTranscriptAt(j).getTranscriptID().c_str(), (j < e - 1 ? ',' : (i < m - 1 ? '\t' :'\n')));
}
}
fclose(fo);
delete[] tau;
if (verbose) { printf("Expression Results are written!\n"); }
}
示例11: main
int main(int argc, char* argv[]) {
bool quiet = false;
if (argc < 6) {
printf("Usage : rsem-parse-alignments refName imdName statName alignFType('s' for sam, 'b' for bam) alignF [-t Type] [-l fn_list] [-tag tagName] [-q]\n");
exit(-1);
}
strcpy(fn_list, "");
read_type = 0;
if (argc > 6) {
for (int i = 6; i < argc; i++) {
if (!strcmp(argv[i], "-t")) {
read_type = atoi(argv[i + 1]);
}
if (!strcmp(argv[i], "-l")) {
strcpy(fn_list, argv[i + 1]);
}
if (!strcmp(argv[i], "-tag")) {
SamParser::setReadTypeTag(argv[i + 1]);
}
if (!strcmp(argv[i], "-q")) { quiet = true; }
}
}
verbose = !quiet;
sprintf(groupF, "%s.grp", argv[1]);
gi.load(groupF);
sprintf(tiF, "%s.ti", argv[1]);
transcripts.readFrom(tiF);
sprintf(datF, "%s.dat", argv[2]);
sprintf(cntF, "%s.cnt", argv[3]);
init(argv[2], argv[4][0], argv[5]);
hit_out.open(datF);
string firstLine(99, ' ');
firstLine.append(1, '\n'); //May be dangerous!
hit_out<<firstLine;
switch(read_type) {
case 0 : parseIt<SingleRead, SingleHit>(parser); break;
case 1 : parseIt<SingleReadQ, SingleHit>(parser); break;
case 2 : parseIt<PairedEndRead, PairedEndHit>(parser); break;
case 3 : parseIt<PairedEndReadQ, PairedEndHit>(parser); break;
}
hit_out.seekp(0, ios_base::beg);
hit_out<<N[1]<<" "<<nHits<<" "<<read_type;
hit_out.close();
//cntF for statistics of alignments file
ofstream fout(cntF);
fout<<N[0]<<" "<<N[1]<<" "<<N[2]<<" "<<(N[0] + N[1] + N[2])<<endl;
fout<<nUnique<<" "<<nMulti<<" "<<nIsoMulti<<endl;
fout<<nHits<<" "<<read_type<<endl;
fout<<"0\t"<<N[0]<<endl;
for (iter = counter.begin(); iter != counter.end(); iter++) {
fout<<iter->first<<'\t'<<iter->second<<endl;
}
fout<<"Inf\t"<<N[2]<<endl;
fout.close();
release();
if (verbose) { printf("Done!\n"); }
return 0;
}
示例12: main
int main(int argc, char* argv[]) {
if (argc < 8) {
printf("Usage: rsem-calculate-credibility-intervals reference_name sample_name sampleToken confidence nCV nSpC nMB [-p #Threads] [-q]\n");
exit(-1);
}
confidence = atof(argv[4]);
nCV = atoi(argv[5]);
nSpC = atoi(argv[6]);
nMB = atoi(argv[7]);
nThreads = 1;
quiet = false;
for (int i = 8; i < argc; i++) {
if (!strcmp(argv[i], "-p")) nThreads = atoi(argv[i + 1]);
if (!strcmp(argv[i], "-q")) quiet = true;
}
verbose = !quiet;
sprintf(refF, "%s.seq", argv[1]);
refs.loadRefs(refF, 1);
M = refs.getM();
sprintf(groupF, "%s.grp", argv[1]);
gi.load(groupF);
m = gi.getm();
nSamples = nCV * nSpC;
cvlen = M + 1;
assert(nSamples > 0 && cvlen > 1); // for Buffter.h: (bufsize_type)nSamples
sprintf(imdName, "%s.temp/%s", argv[2], argv[3]);
sprintf(statName, "%s.stat/%s", argv[2], argv[3]);
sprintf(tmpF, "%s.tmp", imdName);
sprintf(cvsF, "%s.countvectors", imdName);
sprintf(modelF, "%s.model", statName);
FILE *fi = fopen(modelF, "r");
general_assert(fi != NULL, "Cannot open " + cstrtos(modelF) + "!");
assert(fscanf(fi, "%d", &model_type) == 1);
fclose(fi);
// Phase I
switch(model_type) {
case 0 : sample_theta_vectors_from_count_vectors<SingleModel>(); break;
case 1 : sample_theta_vectors_from_count_vectors<SingleQModel>(); break;
case 2 : sample_theta_vectors_from_count_vectors<PairedEndModel>(); break;
case 3 : sample_theta_vectors_from_count_vectors<PairedEndQModel>(); break;
}
// Phase II
calculate_credibility_intervals(imdName);
/*
sprintf(command, "rm -f %s", tmpF);
int status = system(command);
if (status != 0) {
fprintf(stderr, "Cannot delete %s!\n", tmpF);
exit(-1);
}
*/
return 0;
}
示例13: calculate_credibility_intervals
void calculate_credibility_intervals(char* imdName) {
FILE *fo;
char outF[STRLEN];
int num_threads = nThreads;
iso_tau = new CIType[M + 1];
gene_tau = new CIType[m];
assert(M > 0);
int quotient = M / num_threads;
if (quotient < 1) { num_threads = M; quotient = 1; }
int cur_gene_id = 0;
int num_isoforms = 0;
// A just so so strategy for paralleling
ciParamsArray = new CIParams[num_threads];
for (int i = 0; i < num_threads; i++) {
ciParamsArray[i].no = i;
ciParamsArray[i].start_gene_id = cur_gene_id;
num_isoforms = 0;
while ((m - cur_gene_id > num_threads - i - 1) && (i == num_threads - 1 || num_isoforms < quotient)) {
num_isoforms += gi.spAt(cur_gene_id + 1) - gi.spAt(cur_gene_id);
++cur_gene_id;
}
ciParamsArray[i].end_gene_id = cur_gene_id;
}
threads = new pthread_t[num_threads];
/* set thread attribute to be joinable */
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
// paralleling
for (int i = 0; i < num_threads; i++) {
rc = pthread_create(&threads[i], &attr, &calcCI_batch, (void*)(&ciParamsArray[i]));
pthread_assert(rc, "pthread_create", "Cannot create thread " + itos(i) + " (numbered from 0) in calculate_credibility_intervals!");
}
for (int i = 0; i < num_threads; i++) {
rc = pthread_join(threads[i], &status);
pthread_assert(rc, "pthread_join", "Cannot join thread " + itos(i) + " (numbered from 0) in calculate_credibility_intervals!");
}
// releasing resources
/* destroy attribute */
pthread_attr_destroy(&attr);
delete[] threads;
delete[] ciParamsArray;
//isoform level results
sprintf(outF, "%s.iso_res", imdName);
fo = fopen(outF, "a");
for (int i = 1; i <= M; i++)
fprintf(fo, "%.6g%c", iso_tau[i].lb, (i < M ? '\t' : '\n'));
for (int i = 1; i <= M; i++)
fprintf(fo, "%.6g%c", iso_tau[i].ub, (i < M ? '\t' : '\n'));
fclose(fo);
//gene level results
sprintf(outF, "%s.gene_res", imdName);
fo = fopen(outF, "a");
for (int i = 0; i < m; i++)
fprintf(fo, "%.6g%c", gene_tau[i].lb, (i < m - 1 ? '\t' : '\n'));
for (int i = 0; i < m; i++)
fprintf(fo, "%.6g%c", gene_tau[i].ub, (i < m - 1 ? '\t' : '\n'));
fclose(fo);
delete[] iso_tau;
delete[] gene_tau;
if (verbose) { printf("All credibility intervals are calculated!\n"); }
}