Esempio n. 1
0
    samUser* samHive::getSamUser(int rid) {
        string userNKPath = stringPrintf("\\SAM\\Domains\\Account\\Users\\%08X", rid);
        reg_off userNKOffset = this->travPath(0, (char*)userNKPath.c_str(), 0) + 4;
        string vValuePath = stringPrintf("\\SAM\\Domains\\Account\\Users\\%08X\\V",rid);
        ntreg::keyval *vValue = this->copyValueToBuffer(NULL, 0, (char*)vValuePath.c_str(), REG_BINARY, TPF_VK_EXACT);

        string fValuePath = stringPrintf("\\SAM\\Domains\\Account\\Users\\%08X\\F",rid);
        ntreg::keyval *fValue = this->copyValueToBuffer(NULL, 0, (char*)fValuePath.c_str(), REG_BINARY, TPF_VK_EXACT);

        // this should be null for local accounts, and set for microsoft accounts
        string internetUserNamePath = stringPrintf("\\SAM\\Domains\\Account\\Users\\%08X\\InternetUserName",rid);
        ntreg::keyval *internetUserNameValue = this->copyValueToBuffer(NULL, 0, (char*)internetUserNamePath.c_str(), REG_BINARY, TPF_VK_EXACT);
        string internetUserName = "";
        if(internetUserNameValue != NULL) {
            int inetUserNameLen = internetUserNameValue->len;
            char* inetUserNameCString = new char[inetUserNameLen + 1];
            inetUserNameCString[inetUserNameLen] = '\0';
            binaryManip::unicodeToAscii((char*)&internetUserNameValue->data, inetUserNameCString, internetUserNameValue->len);
            internetUserName = inetUserNameCString;
            delete[] inetUserNameCString;
            free(internetUserNameValue);
            internetUserNameValue = NULL;
        }

        samUser *newSamUser;
        try{
            newSamUser = new samUser(rid, userNKOffset, vValue, vValuePath, fValue, fValuePath, this->hashedBootKey, internetUserName);
        }catch(owpException e) {
            cerr << e.formattedMessage;
            newSamUser = NULL;
        }

        return newSamUser;
    }
Esempio n. 2
0
char* getEntryNumber( int number, int pairType, int readNum ) {
  int flag=0;
  Stringa str=stringCreate(10);
  switch ( pairType ) {
  case GFR_PAIR_TYPE_EXONIC_EXONIC:    
  case GFR_PAIR_TYPE_EXONIC_INTRONIC:
  case GFR_PAIR_TYPE_INTRONIC_EXONIC:   
  case GFR_PAIR_TYPE_INTRONIC_INTRONIC:
    break;
  case GFR_PAIR_TYPE_INTRONIC_JUNCTION:
  case GFR_PAIR_TYPE_EXONIC_JUNCTION:
    if( readNum==2 ) flag=1;      
    break;
  case GFR_PAIR_TYPE_JUNCTION_EXONIC:
  case GFR_PAIR_TYPE_JUNCTION_INTRONIC:
    if( readNum==1 ) flag=1;
    break;
  case GFR_PAIR_TYPE_JUNCTION_JUNCTION:
    flag=1;
  }
  if( flag==1 ) {
    int rem = number % 2;
    if( rem == 0 )
      stringPrintf(str, "%d right", number/2);
    else 
      stringPrintf(str, "left %d", number/2+1);
  } else {
    stringPrintf(str, "%d", number);
  }
  return string(str);
}
Esempio n. 3
0
static void addSubstitution (Alteration *currAlteration, char* proteinSequenceBeforeIndel, char *proteinSequenceAfterIndel, int indelOffset) 
{
  int lengthBefore,lengthAfter;
  static Stringa buffer = NULL;
  int i;
  int diff;
  int index;

  stringCreateClear (buffer,100);
  index = ((currAlteration->relativePosition - 1) / 3);
  lengthBefore = strlen (proteinSequenceBeforeIndel);
  lengthAfter = strlen (proteinSequenceAfterIndel);
  diff = abs (lengthBefore - lengthAfter);
  if (lengthBefore < lengthAfter) {
    stringPrintf (buffer,"%d_%c->",index + 1,proteinSequenceBeforeIndel[index]);
    for (i = 0; i <= diff; i++) {
      stringAppendf (buffer,"%c",proteinSequenceAfterIndel[index + i]);
    }
  }
  else if (lengthBefore > lengthAfter) {
    stringPrintf (buffer,"%d_",index + 1);
    for (i = 0; i <= diff; i++) {
      stringAppendf (buffer,"%c",proteinSequenceBeforeIndel[index + i]);
    }
    stringAppendf (buffer,"->%c",proteinSequenceAfterIndel[index]);
  }
  else {
    stringPrintf (buffer,"%d_%s->",index,subString (proteinSequenceBeforeIndel,index - 1,index + (int)ceil ((double)indelOffset / 3)));
    stringAppendf (buffer,"%s",subString (proteinSequenceAfterIndel,index - 1,index + (int)ceil ((double)indelOffset / 3)));
  } 
  currAlteration->substitution = hlr_strdup (string (buffer));
}
Esempio n. 4
0
void TextMgr::statusDraw() {
	char *statusTextPtr = NULL;

	charAttrib_Push();
	charPos_Push();

	if (_statusEnabled) {
		clearLine(_statusRow, 15);

		charAttrib_Set(0, 15);
		charPos_Set(_statusRow, 1);
		statusTextPtr = stringPrintf(_systemUI->getStatusTextScore());
		displayText(statusTextPtr);

		charPos_Set(_statusRow, 30);
		if (_vm->getFlag(VM_FLAG_SOUND_ON)) {
			statusTextPtr = stringPrintf(_systemUI->getStatusTextSoundOn());
		} else {
			statusTextPtr = stringPrintf(_systemUI->getStatusTextSoundOff());
		}
		displayText(statusTextPtr);
	}

	charPos_Pop();
	charAttrib_Pop();
}
Esempio n. 5
0
    /**
     * Merges changes made with samUser objects back into the hive in memory
     * @return bool Whether or not all changes were merged
     */
    bool samHive::mergeChangesToHive() {
        bool allSuccessful = true;
        for(unsigned int i = 0; i < userList.size(); i++) {
            if(userList.at(i)->hasChanges()) {
                ntreg::keyval *keyValue = userList.at(i)->getVStructRegValue();
                string path = userList.at(i)->getVStructPath().c_str();
                int size = copyBufferToValue(keyValue, 0, (char*)path.c_str(), VAL_TYPE_REG_BINARY, TPF_VK_EXACT);

                if(size < 1) {
                    allSuccessful = false;
                }
                cout << stringPrintf("Merging into %s: wrote %d bytes", path.c_str(), size) << endl;

                keyValue = userList.at(i)->getFStructRegValue();
                path = userList.at(i)->getFStructPath().c_str();
                size = copyBufferToValue(keyValue, 0, (char*)path.c_str(), VAL_TYPE_REG_BINARY, TPF_VK_EXACT);

                if(size < 1 || allSuccessful == false) {
                    allSuccessful = false;
                } else {
                    userList.at(i)->hasSaved();
                }
                cout << stringPrintf("Merging into %s: wrote %d bytes", path.c_str(), size) << endl;
            }
        }

        regHive->state |= HMODE_DIRTY;
        return allSuccessful;
    }
Esempio n. 6
0
/**
 * Prints currSeq to char*.
 */
char* fastq_printOneSequence (Fastq* currFQ) 
{
  static Stringa buffer=NULL;
  stringCreateClear( buffer, 100 );
  stringPrintf( buffer, "@%s\n%s\n+\n%s", currFQ->seq->name, currFQ->seq->sequence, currFQ->quality );
  return string( buffer );
}
Esempio n. 7
0
  String BufferedReader::dumpCurrentContext ()
  {
    String context;
    stringPrintf ( context, "at file='%s', line %llu, char %llu : ",
        getCurrentURI().c_str(),
        totalLinesParsed, totalParsed );

    if ( buffer )
      {
        static const __ui64 MaxBufferDumpSize = 256;
        char _dumpBuff[MaxBufferDumpSize];
        __ui64 _dumpBuffStart, _dumpBuffSize = 0;
        _dumpBuffStart = bufferIdx;
        while ( _dumpBuffStart && buffer[_dumpBuffStart] != '\n' &&
                ( bufferIdx - _dumpBuffStart < MaxBufferDumpSize / 2 ) )
          _dumpBuffStart--;
        if ( _dumpBuffStart ) _dumpBuffStart++;
        while ( _dumpBuffSize < bufferSz && buffer[_dumpBuffStart + _dumpBuffSize] != '\n' )
          _dumpBuffSize++;
        if ( _dumpBuffSize > MaxBufferDumpSize )
          _dumpBuffSize = MaxBufferDumpSize;

        memcpy ( _dumpBuff, &(buffer[_dumpBuffStart]), _dumpBuffSize );
        _dumpBuff[_dumpBuffSize-1] = '\0';
        context += _dumpBuff;
        context += "\n";
      }
    else
      {
        context += "(Unknown context)";
      }
    return context;
  }
Esempio n. 8
0
static void sslGenerateCertificate(const char *certificate,
                                   const char *serverName) {
 debug("Auto-generating missing certificate \"%s\" for \"%s\"",
       certificate, serverName);

  pid_t pid = fork();
  if (pid == -1) {
    warn("Failed to generate self-signed certificate \"%s\"", certificate);
  } else if (pid == 0) {
    int fd = NOINTR(open("/dev/null", O_RDONLY));
    check(fd != -1);
    check(NOINTR(dup2(fd, STDERR_FILENO)) == STDERR_FILENO);
    check(NOINTR(close(fd)) == 0);
    fd = NOINTR(open("/dev/null", O_WRONLY));
    check(fd != -1);
    check(NOINTR(dup2(fd, STDIN_FILENO)) == STDIN_FILENO);
    check(NOINTR(close(fd)) == 0);
    umask(077);
    check(setenv("PATH", "/usr/bin:/usr/sbin", 1) == 0);
    execlp("openssl", "openssl", "req", "-x509", "-nodes", "-days", "7300",
           "-newkey", "rsa:2048", "-keyout", certificate, "-out", certificate,
           "-subj", stringPrintf(NULL, "/CN=%s/", serverName),
           (char *)NULL);
    check(0);
  } else {
    int status;
    check(NOINTR(waitpid(pid, &status, 0)) == pid);
    if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
      warn("Failed to generate self-signed certificate \"%s\"", certificate);
  }
}
Esempio n. 9
0
    void samHive::loadUserList() {
        reg_off regKeyOffset = this->travPath(0,(char*)"\\SAM\\Domains\\Account\\Users\\Names\\",0);

        if(!regKeyOffset) {
            throw(new owpException("loadUserList: could not find usernames in registry!"));
        } else {
            cout << stringPrintf("regKeyOffset: %d\n", regKeyOffset) << endl;
        }

        int subKeyCount = 0;
        int subKeyCountRI = 0;
        struct ntreg::ex_data exData;
        string adminUser;
        while((this->getNextSubKey(regKeyOffset+4, &subKeyCount, &subKeyCountRI, &exData) > 0)) {
            //get the RID
            int rid = this->getUserRID(exData.name);

            if(rid == 500) {
                adminUser = exData.name;
            }

            samUser* newSamUser = this->getSamUser(rid);
            if(newSamUser != NULL) {
                this->userList.push_back(newSamUser);
            }

            FREE(exData.name);
        }
    }
Esempio n. 10
0
int main (int argc, char *argv[])
{ 
	LineStream ls;
	char *line;
	char *pos;
	Stringa buffer;

	if (argc != 2) {
		usage ("%s <file.intraOffsets>");
	}

	TH1 *his = new TH1D ("","Intra-read distribution",1000,0,1000);
	TCanvas *canv = new TCanvas("","canvas",1200,400);
	ls = ls_createFromFile (argv[1]);
	while (line = ls_nextLine (ls)) {
		his->Fill (atoi (line));
	}
	ls_destroy (ls);
	his->Draw();
	his->GetXaxis()->SetLabelSize (0.04);
	his->GetYaxis()->SetLabelSize (0.04);
	buffer = stringCreate (100);
	pos = strchr (argv[1],'.');
	if (pos == NULL) {
		die ("Expected <file.intraOffsets>: %s",argv[1]);
	}
	*pos = '\0';
	stringPrintf (buffer,"%s_intraDistribution.jpg",argv[1]);
	canv->Print (string (buffer),"jpg");
	stringDestroy (buffer);
	return 0;
}
Esempio n. 11
0
 void PersistenceModule::functionGetCurrentRevisionId ( __XProcFunctionArgs__ )
 {
   BranchRevId branchRevId = node.getDocument().getBranchRevId();
   String revisionId;
   stringPrintf ( revisionId, "%llu", branchRevId.revisionId );
   result.setSingleton ( revisionId );
 }
Esempio n. 12
0
llvm::Function* FunctionAST::codegen() {
  debug_info_helper->emitLocation(getLoc());
  llvm::Function* function = prototype_->codegen();
  CHECK(function != nullptr);
  CurFunctionGuard guard(function);
  debug_info_helper->createFunction(function, getLoc(), false);
  std::string body_label = stringPrintf("%s.entry", function->getName().data());
  llvm::BasicBlock* basic_block = llvm::BasicBlock::Create(*context, body_label, function);
  llvm::IRBuilder<>::InsertPointGuard InsertPointGuard(*cur_builder);
  cur_builder->SetInsertPoint(basic_block);

  // Don't allow to break on argument initialization.
  // global_debug_info.emitLocation(nullptr);

  auto arg_it = function->arg_begin();
  for (size_t i = 0; i < function->arg_size(); ++i, ++arg_it) {
    llvm::Value* variable = createVariable(arg_it->getName(), getLoc(), i + 1);
    cur_builder->CreateStore(&*arg_it, variable);
  }

  // global_debug_info.emitLocation(nullptr);

  llvm::Value* ret_val = body_->codegen();
  CHECK(ret_val != nullptr);
  cur_builder->CreateRet(ret_val);
  debug_info_helper->endFunction();
  return function;
}
Esempio n. 13
0
/**
 * Generates a link to Rat Genome Database (RGD) gene description page.
 * Example: http://rgd.mcw.edu/tools/genes/genes_view.cgi?id=727972
 * @note The rgdId must be numeric.
 */
char* htmlLinker_generateLinkToRatGeneDescriptionPage (char* rgdId)
{
  static Stringa buffer = NULL;

  stringCreateClear (buffer,100);
  stringPrintf (buffer,"http://rgd.mcw.edu/tools/genes/genes_view.cgi?id=%s",rgdId);
  return string (buffer);
}
Esempio n. 14
0
/**
 * Generates a link to Saccharomyces Genome Database (SGD) gene description page.
 * Both the SGD gene ID or the gene symbol can be used. 
 * Example: http://db.yeastgenome.org/cgi-bin/locus.pl?locus=AAC3 or
   http://db.yeastgenome.org/cgi-bin/locus.pl?locus=S000000289
 */
char* htmlLinker_generateLinkToYeastGeneDescriptionPage (char* sgdId)
{
  static Stringa buffer = NULL;

  stringCreateClear (buffer,100);
  stringPrintf (buffer,"http://db.yeastgenome.org/cgi-bin/locus.pl?locus=%s",sgdId);
  return string (buffer);
}
Esempio n. 15
0
/**
 * Generates a link to InterPro.
 * Example: http://www.ebi.ac.uk/interpro/DisplayIproEntry?ac=IPR001922
 */
char* htmlLinker_generateLinkToInterPro (char* interProId)
{
  static Stringa buffer = NULL;

  stringCreateClear (buffer,100);
  stringPrintf (buffer,"http://www.ebi.ac.uk/interpro/DisplayIproEntry?ac=%s",interProId);
  return string (buffer);
}
Esempio n. 16
0
/**
 * Generates a link to FlyBase gene description page.
 * Example: http://flybase.bio.indiana.edu/reports/FBgn0033837.html
 */
char* htmlLinker_generateLinkToFlyBaseGeneDescriptionPage (char* flyBaseId)
{
  static Stringa buffer = NULL;

  stringCreateClear (buffer,100);
  stringPrintf (buffer,"http://flybase.bio.indiana.edu/reports/%s.html",flyBaseId);
  return string (buffer);
}
Esempio n. 17
0
/**
 * Generates a link to WormBase gene description page. 
 * Both the WormBase gene ID or the gene symbol can be used. 
 * Example: http://www.wormbase.org/db/gene/gene?name=WBGene00002239 or 
   http://www.wormbase.org/db/gene/gene?name=ksr-1
 */
char* htmlLinker_generateLinkToWormBaseGeneDescriptionPage (char* wormBaseGeneId)
{
  static Stringa buffer = NULL;

  stringCreateClear (buffer,100);
  stringPrintf (buffer,"http://www.wormbase.org/db/gene/gene?name=%s",wormBaseGeneId);
  return string (buffer);
}
Esempio n. 18
0
/**
 * Generates a link to AmiGO. 
 * Example: http://amigo.geneontology.org/cgi-bin/amigo/term-details.cgi?term=GO:0051240
 */
char* htmlLinker_generateLinkToAmiGO (char* goId)
{
  static Stringa buffer = NULL;

  stringCreateClear (buffer,100);
  stringPrintf (buffer,"http://amigo.geneontology.org/cgi-bin/amigo/term-details.cgi?term=%s",goId);
  return string (buffer);
}
Esempio n. 19
0
/**
 * Generates a link to the PDB.
 * Example: http://www.rcsb.org/pdb/explore/explore.do?structureId=1HDC
 */
char* htmlLinker_generateLinkToPDB (char* pdbId)
{
  static Stringa buffer = NULL;

  stringCreateClear (buffer,100);
  stringPrintf (buffer,"http://www.rcsb.org/pdb/explore/explore.do?structureId=%s",pdbId);
  return string (buffer);
}
Esempio n. 20
0
/**
 * Generates a link to PubMed.
 * Example: http://www.ncbi.nlm.nih.gov/pubmed/18276894
 */
char* htmlLinker_generateLinkToPubmed (char* pmid)
{
  static Stringa buffer = NULL;

  stringCreateClear (buffer,100);
  stringPrintf (buffer,"http://www.ncbi.nlm.nih.gov/pubmed/%s",pmid);
  return string (buffer);
}
Esempio n. 21
0
/**
 * Generates a link to EntrezGene.
 * Example: http://www.ncbi.nlm.nih.gov/sites/entrez?db=gene&cmd=search&term=NP_001069323 or 
   http://www.ncbi.nlm.nih.gov/sites/entrez?db=gene&cmd=search&term=1812
 */
char* htmlLinker_generateLinkToEntrezGene (char* term)
{
  static Stringa buffer = NULL;

  stringCreateClear (buffer,100);
  stringPrintf (buffer,"http://www.ncbi.nlm.nih.gov/sites/entrez?db=gene&cmd=search&term=%s",term);
  return string (buffer);
}
Esempio n. 22
0
char* htmlLinker_generateLinkToMouseGeneDescriptionPage (char* mgiId)
{
  static Stringa buffer = NULL;

  stringCreateClear (buffer,100);
  stringPrintf (buffer,"http://www.informatics.jax.org/searches/accession_report.cgi?id=%s",mgiId);
  return string (buffer);
}
Esempio n. 23
0
/**
 * Generates a link to Pfam.
 * Example: http://pfam.sanger.ac.uk/family?acc=PF09582
 */
char* htmlLinker_generateLinkToPfam (char* pfamId)
{
  static Stringa buffer = NULL;

  stringCreateClear (buffer,100);
  stringPrintf (buffer,"http://pfam.sanger.ac.uk/family?acc=%s",pfamId);
  return string (buffer);
}
Esempio n. 24
0
/**
 * Generates a link to the Yale human pseudogene site.
 * Example: http://tables.pseudogene.org/human/200550
 */
char* htmlLinker_generateLinkToHumanPseudogenePageAtYale (char* pseudogeneId)
{
  static Stringa buffer = NULL;

  stringCreateClear (buffer,100);
  stringPrintf (buffer,"http://tables.pseudogene.org/human/%s",pseudogeneId);
  return string (buffer);
}
Esempio n. 25
0
/**
 * Generates a link to Uniprot.
 * Example: http://www.pir.uniprot.org/cgi-bin/upEntry?id=Q91V24 or 
   http://www.pir.uniprot.org/cgi-bin/upEntry?id=ADA1A_BOVIN
 */
char* htmlLinker_generateLinkToUniProt (char* uniProtId)
{
  static Stringa buffer = NULL;

  stringCreateClear (buffer,100);
  stringPrintf (buffer,"http://www.pir.uniprot.org/cgi-bin/upEntry?id=%s",uniProtId);
  return string (buffer);
}
Esempio n. 26
0
static char* getBreakPointSequence (char *tileCoordinate1, char *tileCoordinate2)
{
	Stringa buffer;
	Stringa targetsFile;
	FILE *fp;
	Array targetSeqs;
	int i;
	Seq *currSeq;
	static Stringa sequence = NULL;

	buffer = stringCreate (100);
	targetsFile = stringCreate (100);
	stringPrintf (targetsFile,"targets_%d.txt",getpid ());
	if (!(fp = fopen (string (targetsFile),"w")) ){
		die ("Unable to open target file: %s",string (targetsFile));
	}
	fprintf (fp,"%s\n%s",tileCoordinate1,tileCoordinate2);
	fclose (fp);

	stringPrintf (buffer,"%s %s/%s stdout -noMask -seqList=%s",
		      confp_get(Conf, "BLAT_TWO_BIT_TO_FA"),
		      confp_get(Conf, "BLAT_DATA_DIR"),
		      confp_get(Conf, "BLAT_TWO_BIT_DATA_FILENAME"),
		      string (targetsFile));
	fasta_initFromPipe (string (buffer));
	targetSeqs = fasta_readAllSequences (0);
	fasta_deInit ();
	if (arrayMax (targetSeqs) != 2) {
		die ("Expected only two target sequences");
	} 
	stringCreateClear (sequence,100);
	for (i = 0; i < arrayMax (targetSeqs); i++) {
		currSeq = arrp (targetSeqs,i,Seq);
		stringAppendf (sequence,"%s",currSeq->sequence);
		hlr_free (currSeq->name);
		hlr_free (currSeq->sequence);
	}
	arrayDestroy (targetSeqs);
	stringPrintf (buffer,"rm -rf %s",string (targetsFile));
	hlr_system (string (buffer),0);
	stringDestroy (targetsFile);
	stringDestroy (buffer);
	return string (sequence);
}
Esempio n. 27
0
/**
 * Generates a link to KnownGene description page.
 * Example: http://genome.ucsc.edu/cgi-bin/hgGene?db=rn4&hgg_gene=NM_012824&hgg_chrom=chr1&hgg_start=78996678&hgg_end=78999875
 */
char* htmlLinker_generateLinkToGeneDescriptionPageAtUCSC (char* database, char* geneName, 
							  char* chromosome, int start, int end)
{
  static Stringa buffer = NULL;

  stringCreateClear (buffer,100);
  stringPrintf (buffer,"http://genome.ucsc.edu/cgi-bin/hgGene?db=%s&hgg_gene=%s&hgg_chrom=%s&hgg_start=%d&hgg_end=%d",
		database,geneName,chromosome,start,end);
  return string (buffer);
}
Esempio n. 28
0
/**
 * Generates a link to the UCSC track element description page. 
 * Example: http://genome.ucsc.edu/cgi-bin/hgc?db=hg18&g=intronEst&i=BI755927&c=chrX&l=149673899&r=152783129
 */
char* htmlLinker_generateLinkToTrackElementDescriptionPageAtUCSC (char* database, char* trackName, char* elementName, 
								  char* chromosome, int start, int end)
{
  static Stringa buffer = NULL;
 
  stringCreateClear (buffer,100);
  stringPrintf (buffer,"http://genome.ucsc.edu/cgi-bin/hgc?db=%s&g=%s&i=%s&c=%s&l=%d&r=%d",
		database,trackName,elementName,chromosome,start,end);
  return string (buffer);
}
Esempio n. 29
0
/**
 * Generates a link to the UCSC genome browser.
 * Example: http://genome.ucsc.edu/cgi-bin/hgTracks?db=mm9&clade=vertebrate&org=Mouse&position=chr12:10000-20000
 */
char* htmlLinker_generateLinkToGenomeBrowserAtUCSC (char* database, char* clade, char* organism, 
						    char* chromosome, int start, int end)
{
  static Stringa buffer = NULL;
  
  stringCreateClear (buffer,100);
  stringPrintf (buffer,"http://genome.ucsc.edu/cgi-bin/hgTracks?db=%s&clade=%s&org=%s&position=%s:%d-%d",
		database,clade,organism,chromosome,start,end);
  return string (buffer);
}
Esempio n. 30
0
/** 
 * writes circos configuration file
 */
int write_circosConf (char* prefix,
		              Locus locus,
		              Array regions,
		              Chrdata_t *chromosomes,
		              SVCfg_t *settings)
{
  float rpos = 0.99;
  FILE *fp;
  Stringa buffer = stringCreate(50);
  int scale = getScale (regions);

  stringPrintf (buffer, "%s/test/circos_%s_%s_%d_%d.conf",
		confp_get(Conf, "WEB_CIRCOS_DIR"), 
		prefix, 
		locus.chromosome, 
		locus.start, 
		locus.end);

  if (!(fp = fopen (string (buffer), "w"))) {
    die ("Unable to open target file");
    return -1;
  };

  printf ("<h2>%i</h2>", scale);

  // write conf file
  conf_printHeader (fp, 
		    confp_get(Conf, "WEB_CIRCOS_DIR"), 
		    confp_get(Conf, "WEB_DATA_DIR"), 
		    confp_get(Conf, "WEB_SDATA_DIR"), 
		    chromosomes, 
		    prefix, 
		    locus, 
		    scale);
  conf_printUnits (fp, regions, chromosomes, scale);

  if (scale <= 10000) {
    conf_printDataTracks (fp, 
		    	  prefix, 
			  locus, 
			  confp_get(Conf, "WEB_SDATA_DIR"), 
			  confp_get(Conf, "WEB_DATA_DIR"), 
			  &rpos, 
			  regions, 
			  chromosomes, 
			  settings);
  }

  conf_printLinks (fp, confp_get(Conf, "WEB_DATA_DIR"), &rpos, prefix, locus, settings->readlim);
  conf_printFooter (fp);

  fclose (fp);
  stringDestroy (buffer);
  return 0;
}