Пример #1
0
/*
  Fade from off to given color and back.
 */
void pulse(int w) {
  uint32_t c;
  //uint32_t c = Wheel(map(opt, 0, 1023, 0, 255)); 
  for(uint16_t j = 8; j <= getOpt(_pin_lev, 0, 255); j++) {
    if( checkButton() ){ return; };
    setBrightness(j);
    c = Wheel(map(opt, 0, 1023, 0, 255));
    for(uint16_t i = 0; i < numPixels(); i++) {
      setPixelColor(i, c);
    }
    show();
    delay(w);
  }
  delay(w*10+50);
  for(uint16_t j=getOpt(_pin_lev, 0, 255); j>8; j--) {
    if( checkButton() ){ return; };
    setBrightness(j);
    c = Wheel(map(opt, 0, 1023, 0, 255));
    for(uint16_t i = 0; i < numPixels(); i++) {
      setPixelColor(i, c);
    }
    show();
    delay(w);
  }
  delay(w*10+50);
}
/**
 * @brief Check to see if the options used by the copy number engine are valid.
 */
void CNReferenceEngine::checkOptionsImp()
{
    defineStates();

    setLibFileOpt("reference-file");
    m_pEngine->setLibFileOpt("probeset-ids");
    m_pEngine->setLibFileOpt("annotation-file");

    if (m_pEngine == this)
    {
        if (getOpt("set-analysis-name") == "") {setOpt("set-analysis-name", "CN5");}
        if (m_pEngine->getOpt("expr-summary-file") == "") {throw(Except("Must specify a expr-summary-file."));}
        if (m_pEngine->getOpt("genotype-calls-file") == "") {throw(Except("Must specify a genotype-calls-file."));}
        if (m_pEngine->getOpt("genotype-confidences-file") == "") {throw(Except("Must specify a genotype-confidences-file."));}
        if (m_pEngine->getOpt("genotype-report-file") == "") {throw(Except("Must specify a genoptype-report-file."));}
        if (m_pEngine->getOpt("reference-file") == "") {throw(Except("Must specify a reference-file."));}
    }
    if (m_pEngine->getOpt("annotation-file") == "") {throw(Except("Must specify a netaffx annotation-file."));}

    AffxString strReferenceFileName = m_pEngine->getOpt("reference-file");
    if (m_pEngine == this)
    {
        m_pEngine->setOpt("create-reference", "true");
        m_pEngine->setOpt("reference-file", strReferenceFileName);
    }
}
Пример #3
0
Actions::Action Actions::get(std::int32_t ID) {
    if (auto res = getOpt(ID)) {
        return res.value();
    } else {
        throw InvalidData{"incorrect action ID"};
    }
}
Пример #4
0
//Rainbow Program
void rainbow() {
  int wait = getOpt(_pin_opt, 0, 255);
  uint16_t i, j;
  for(j = 0; j < 256; j++) {
    if( checkButton() ){ return; };
    for(i = 0; i < numPixels(); i++) {
      setPixelColor(i, Wheel((i + j) & 255));
    }
    show();
    delay(wait);
  }
}
Пример #5
0
/**
 * compute CHP files
 */
void DmetEngine::runImp() {

    setOpt("analysis-guid", affxutil::Guid::GenerateNewGuid());

    string errMsg;

    if(!Fs::isWriteableDir(getOpt("out-dir")))
        if(Fs::mkdirPath(getOpt("out-dir"), false) != APT_OK)
            Err::errAbort("Can't make or write to directory: " + getOpt("out-dir"));
    if(getOptBool("run-cn-engine")) {
        Verbose::out(1,"");
        Verbose::out(1,"Step 1: Computing probeset summaries for copy number state calling");
        if(computeCnSummaries()) {
            Verbose::out(1,"");
            Verbose::out(1,"Step 2: Computing copy number states");
            computeCnState();
            setOpt("run-cn-engine","true");
        } else {
            Verbose::out(1,"");
            Verbose::out(1,"No CN regions to compute. Skipping step 2.");
            setOpt("run-cn-engine","false");
        }
    } else {
        Verbose::out(1,"");
        Verbose::out(1,"Not computing CN state. Skipping steps 1 and 2.");
        setOpt("run-cn-engine","false");
    }
    Verbose::out(1,"");
    Verbose::out(1,"Step 3: Computing genotypes");
    computeGenotypes();
    if(getOptBool("cc-chp-output")) {
        Verbose::out(1,"");
        Verbose::out(1,"Step 4: Generating CHP files");
        generateChpFiles();
    }
    Verbose::out(1,"");
    Verbose::out(1, "Done.");
}
Пример #6
0
const char *MacroCodeReplacer::replaceField(const char *field){
   if (isempty(field))
      return NULL;

   size_t l = strlen(field);
      
   char *tmpfield = strdupn(field);
   char MACROS  = MACROS_NONE;
   char MACROS1 = MACROS_NONE;

   getOpt(1);   //singles [xxx[a]
   getOpt(2);   //doubles [xxx[a]

   const char *res = MacroReplacer::replaceField(tmpfield);
   free(tmpfield);

   const char *tmp;
      
   switch(MACROS){
      case MACROS_HTML      : tmp = coder->HTMLEncode(res);           break;
      case MACROS_SOFT_HTML : tmp = coder->SoftHTMLEncode(res);       break;
      case MACROS_PHTML     : tmp = coder->HTMLEncode(res, true);     break;
      case MACROS_SOFT_PHTML: tmp = coder->SoftHTMLEncode(res, true); break;
      case MACROS_URL       : tmp = coder->URLEncode(res);            break;
      case MACROS_NUMBER    : tmp = coder->numberEncode(res);         break;
      case MACROS_FLOAT     : tmp = coder->floatEncode(res, ctoi(MACROS1)); break;
      case MACROS_SQL       : tmp = coder->sqlEncode(res);            break;
      case MACROS_SQLNULL   : tmp = coder->sqlNullEncode(res);        break;
      case MACROS_NO        : tmp = res;                              break;

      default               : tmp = res;
         printflog(LOG_NOTIFY, "Macrocode: Using macros without encoding.\n");
   }

   return tmp;
};
Пример #7
0
bool Parser::hasListPreamble(string const itemcmd)
{
	// remember current position
	unsigned int oldpos = pos_;
	// jump over arguments
	if (hasOpt())
		getOpt();
	if (hasOpt("{"))
		getArg('{', '}');
	// and swallow spaces and comments
	skip_spaces(true);
	// we have a list preamble if the next thing
	// that follows is not the \item command
	bool res =  next_token().cs() != itemcmd;
	// back to orig position
	pos_ = oldpos;
	return res;
}
Пример #8
0
string DmetEngine::makeVal(string name, int optionIndex) {
    vector<string> vals;
    vals = getOptVector(name, optionIndex);

    /*
    if(name.find("file") != string::npos)
        for(int i=0; i<vals.size(); i++)
            vals[i] = Fs::basename(vals[i]);
    */
    string val;
    if(vals.size() > 1) {
        val = "'" + vals[0] + "'";
        for(int i=1; i<vals.size(); i++) {
            val += ",'" + vals[i] + "'";
        }
    } else if(vals.size() == 1) {
        val = vals[0];
    } else {
        val = getOpt(name,optionIndex);
    }
    return val;
}
int DownloadChild::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: finished(); break;
        case 1: download(); break;
        case 2: setURL((*reinterpret_cast< QString*(*)>(_a[1]))); break;
        case 3: { QString* _r = getURL();
            if (_a[0]) *reinterpret_cast< QString**>(_a[0]) = _r; }  break;
        case 4: setSaveFile((*reinterpret_cast< QString*(*)>(_a[1]))); break;
        case 5: { QString* _r = getSaveFile();
            if (_a[0]) *reinterpret_cast< QString**>(_a[0]) = _r; }  break;
        case 6: setOpt((*reinterpret_cast< QString*(*)>(_a[1]))); break;
        case 7: { QString* _r = getOpt();
            if (_a[0]) *reinterpret_cast< QString**>(_a[0]) = _r; }  break;
        default: ;
        }
        _id -= 8;
    }
    return _id;
}
Пример #10
0
videoApp_t::videoApp_t(int &argc,argv_t &argv)
:application_t(argc, argv), 
 __controlPort(NULL),
 __bandwidth(1000000.0)
{
	strcpy(__rtpPort,"51017");
	strcpy(__rtcpPort,"51019");
  enum myOptions {
       ctrlPort,
	   notify,
	   dport,
	   autoChannel,
	   h
       };
  s = static_cast<sched_t*>(this);
  	  
  optionDefList_t opt;       
  appParamList_t *parList;   

  //Available options 
  opt           << new optionDef_t("@cport", ctrlPort , "Opens a Control Socket in <port>")  
				<< new optionDef_t("@rtpPort", dport , "Receiver data port")
				<< new optionDef_t("@notify", notify , "Notify file")
				<< new optionDef_t("autoChannel", autoChannel , "autoShows playChannels")
				<< new optionDef_t("h", h , "Video Help");  
         		
  parList = getOpt(opt, argc, argv);
  ctrlTask_t * ctrlTask = NULL;
			
  SetAutoChannel = new bool();
  *SetAutoChannel = false;

  for ( ; parList->len(); parList->behead()) {
              switch(parList->head()->parId) {
                case ctrlPort:
                    char * port;
		      		port = strdup(parList->head()->parValue);
					ctrlTask = new ctrlTask_t(port);
                    break;
 
				case dport:
                    char * strDport;
					strDport = strdup(parList->head()->parValue);
					strcpy(__rtpPort,strDport);
					itoa(atoi(strDport) + 2,__rtcpPort,10);
					break;

				case notify:
                    
					char * file;
					file = strdup(parList->head()->parValue);
					setNotifyFile(file);		      		
					break;


				case autoChannel:
                    
					*SetAutoChannel = true;
					break;
				
			  
				case h:
					default:
                    int i;
					for(i=0; i < opt.len(); i++) {
						optionDef_t * op= static_cast<optionDef_t*>(opt.nth(i));
						if(op->optDesc)
							fprintf(stderr, "    %-10s %-5s\t-- %s\n",
							op->optName,
							op->optHasArg?"value":"",
							op->optDesc);
						else
							fprintf(stderr, "    %-10s %-5s\t",
							op->optName,
							op->optHasArg?"":"value");
						}
						exit(0);

				   break;
    
			  }
 	};

	// RTP Object Creation
#ifdef WIN32
	if (getenv("MCU_USE_ONLY_IPv4")){
  		rtpSession= new videoRTPSession_t(this,
                                    "0.0.0.0",
                                    __rtpPort,
                                    "0.0.0.0",
                                    __rtcpPort,
                                    VIDEO_TIMESTAMP_UNIT
                                   );
	}
	else{
		rtpSession= new videoRTPSession_t(this,
                                    NULL,
                                    __rtpPort,
                                    NULL,
                                    __rtcpPort,
                                    VIDEO_TIMESTAMP_UNIT
                                   );
	}
#else
	rtpSession= new videoRTPSession_t(this,
                                    NULL,
                                    __rtpPort,
                                    NULL,
                                    __rtcpPort,
                                    VIDEO_TIMESTAMP_UNIT
                                   );
#endif


    //init log file
      struct _timeb timebuffer;
      char * timeline;

      _ftime( &timebuffer );
      timeline = ctime( & ( timebuffer.time ) );
			    
      char auxFile[20];
      char auxArgv[100];
			    
      memset(auxArgv,0,100);
      for (int i = 1; i<argc; i++)
      {
    	    strcat(auxArgv,argv[i]);
		    strcat(auxArgv," ");
      }

      if (char * n = strstr(auxArgv,"File"))
      {				
		    n = strstr(n," ");
		    strcpy(auxFile,n);

      }else{
		    strcpy(auxFile," Screen");
      }

      // Debug Session Info
      NOTIFY(  	"\n·:======================================================:·\n\n"
			    "	Isabel Video v0.1 Debug Session:\n\n"
			    "   - Options: %s\n"
			    "   - Log File:%s\n"
			    "   - Date: %s\n"
			    "   - Author: Vicente Sirvent Orts\n" 		
			    "\n"
			    "·:=======================================================:·\n\n",
			    auxArgv,
			    auxFile,
			    timeline);
}
Пример #11
0
int
main(int argc, char *argv[])
{
	MERET ret;
	int getOptSuccessed;

#if defined(_MSC_VER) && !defined(NDEBUG)
	/* 厳密な演算チェックのため */
	_controlfp(~_MCW_EM | _EM_INEXACT, _MCW_EM);
#endif
#if	defined(__FreeBSD__)
	{	/* デフォルト動作が他のOSと違う。*/
		struct sigaction new_sig;
        	memset(&new_sig, 0, sizeof(struct sigaction));
        	new_sig.sa_handler = SIG_IGN;
        	sigaction(SIGFPE, &new_sig, NULL);
	}
#endif
	if(MPGE_initializeWork() == ME_NOFPU) return ERR;

	getOptSuccessed = 1 < argc && getOpt(argc, argv) == NOERR;
	opening();
	if(!getOptSuccessed){
		usage();
		MPGE_endCoder();
		return ERR;
	}

	ret = MPGE_detectConfigure();
	if(ret != ME_NOERR){
		if(!silent) fprintf(stderr, "%s\n", getErrMsg(ret));
		return ERR;
	}

	putConfig();

	reportInit();	/* report progress */

#if defined(USE_ITIMER) || (defined(_CONSOLE) && defined(WIN32) && defined( USE_TTIMER ))
	ret = MPGE_processTrack();
	if(ret != ME_NOERR){
		if(!silent) fprintf(stderr, "%s\n", getErrMsg(ret));
	}
#else
	for(;;){
		ret = MPGE_processFrame();
		if(ret == ME_EMPTYSTREAM) break;
		if(ret != ME_NOERR){
			if(!silent) fprintf(stderr, "%s\n", getErrMsg(ret));
			break;
		}
		reportDsp(0);
	} /* main loop */
#endif
	ret = MPGE_closeCoder();
	if(ret != ME_NOERR) if(!silent) fprintf(stderr, "%s\n", getErrMsg(ret));

	reportTerm();

	MPGE_endCoder();
	clkput();
	return NOERR;
} /* main */
Пример #12
0
bool Config::parseArgs(int argc, ACE_TCHAR* argv[])
{
#if defined(NSRPC_HAS_PROACTOR)

    ACE_Get_Opt getOpt(argc, argv, ACE_TEXT("a:c:e:k:m:n:p:s:t:hrv"));

    bool isOk = true;
    int c;
    while ((c = getOpt()) != EOF) {
        switch (c) {
        case 'a':
            connectHost_ = getOpt.opt_arg();
            break;
        case 'c':
            connections_ = ACE_OS::atoi(getOpt.opt_arg());
            break;
        case 'e':
            echoCount_ = ACE_OS::atoi(getOpt.opt_arg());
            break;
        case 'k':
            blockSize_ = ACE_OS::atoi(getOpt.opt_arg());
            break;
        case 'm':
            mode_ = getOpt.opt_arg();
            break;
        case 'n':
            threads_ = ACE_OS::atoi(getOpt.opt_arg());
            break;
        case 'p':
            port_ =
                static_cast<srpc::UInt16>(ACE_OS::atoi(getOpt.opt_arg()));
            break;
        case 'r':
            useRpc_ = true;
            break;
        case 's':
            streamType_ = getOpt.opt_arg();
            break;
        case 't':
            proactorType_ = getOpt.opt_arg();
            break;
        case 'v':
            verbose_ = true;
            break;
        case 'h':
        default:
            isOk = false;
            break;
        }
    }

    if ((! isServer()) && (! isClient())) {
        isOk = false;
    }

    if ((streamType_ != "bit") && (streamType_ != "byte")) {
        isOk = false;
    }

    if (! isOk) {
        printUsage();
    }
    return isOk;

#else

    printUsage();
    return false;

#endif // #if defined(NSRPC_HAS_PROACTOR)
}
Пример #13
0
  void StabConfig::processOptions(const QCommandLineParser &parser, ErrorMessageHelper &die, QTextStream *err) {

    mdConf.numThreads = getOpt(parser, die, *threadsOption, SomeInt(0), NoneInt, mdConf.numThreads,
      QCoreApplication::translate("main", "Cant parse thread count."),
      QCoreApplication::translate("main", "Thread count have to be possitive."));

    mdConf.shakiness = getOpt(parser, die, *shakinessOption, SomeInt(1), SomeInt(10), mdConf.shakiness,
      QCoreApplication::translate("main", "Cant parse shakiness."),
      QCoreApplication::translate("main", "Shakiness can be in range 1-10."));

    mdConf.accuracy = getOpt(parser, die, *accuracyOption, SomeInt(1), SomeInt(15), mdConf.accuracy,
      QCoreApplication::translate("main", "Cant parse accuracy."),
      QCoreApplication::translate("main", "Acccuracy can be in range 1-15."));

    mdConf.stepSize = getOpt(parser, die, *stepSizeOption, SomeInt(1), SomeInt(1000), mdConf.stepSize,
      QCoreApplication::translate("main", "Cant parse step size."),
      QCoreApplication::translate("main", "Step size can be in range 1-1000."));

    mdConf.contrastThreshold = getOpt(parser, die, *minContrastOption, SomeDouble(0), SomeDouble(1), mdConf.contrastThreshold,
      QCoreApplication::translate("main", "Cant parse contrast threshold."),
      QCoreApplication::translate("main", "Contrast threshold can be in range 0-1."));

    mdConf.show = getOpt(parser, die, *showOption, SomeInt(0), SomeInt(2), mdConf.show,
      QCoreApplication::translate("main", "Cant parse show option."),
      QCoreApplication::translate("main", "Show option can be in range 0-2."));

    tsConf.smoothing = getOpt(parser, die, *smoothingOption, SomeInt(0), NoneInt, tsConf.smoothing,
      QCoreApplication::translate("main", "Cant parse smoothing option."),
      QCoreApplication::translate("main", "Smoothing have to be possitive."));


    if (parser.isSet(*camPathAlgoOption)) {
      QString algoStr = parser.value(*camPathAlgoOption);
      if (algoStr.compare("gauss", Qt::CaseInsensitive) == 0) {
        tsConf.camPathAlgo = VSGaussian;
      } else if (algoStr.compare("avg", Qt::CaseInsensitive) == 0) {
        tsConf.camPathAlgo = VSAvg;
      } else {
        die << QCoreApplication::translate("main", "Invalid cam path algorithm \"%1\".").arg(algoStr);
      }
    }

    tsConf.maxShift = getOpt(parser, die, *maxShiftOption, SomeInt(-1), NoneInt, tsConf.maxShift,
      QCoreApplication::translate("main", "Cant parse max shift option."),
      QCoreApplication::translate("main", "Max. shift can't be smaller than -1."));

    tsConf.maxAngle = getOpt(parser, die, *maxAngleOption, SomeDouble(-1), NoneDouble, tsConf.maxAngle,
      QCoreApplication::translate("main", "Cant parse max angle option."),
      QCoreApplication::translate("main", "Max. angle can't be smaller than -1."));

    tsConf.crop = parser.isSet(*cropBlackOption) ? VSCropBorder : VSKeepBorder;
    tsConf.invert = parser.isSet(*invertOption) ? 1 : 0;
    tsConf.relative = parser.isSet(*relativeOption) ? 1 : 0;

    tsConf.zoom = getOpt(parser, die, *zoomOption, NoneDouble, NoneDouble, tsConf.zoom,
      QCoreApplication::translate("main", "Cant parse zoom option."),
      "");

    tsConf.optZoom = getOpt(parser, die, *optZoomOption, SomeInt(0), SomeInt(2), tsConf.optZoom,
      QCoreApplication::translate("main", "Cant parse opt-zoom option."),
      QCoreApplication::translate("main", "Opt zoom can be 0, 1 or 2."));

    tsConf.zoomSpeed = getOpt(parser, die, *zoomSpeedOption, SomeDouble(0), SomeDouble(5), tsConf.zoomSpeed,
      QCoreApplication::translate("main", "Cant parse zoom speed option."),
      QCoreApplication::translate("main", "Zoom speed can be in range 0-5."));

    if (parser.isSet(*interpolOption)) {
      QString interpolStr = parser.value(*interpolOption);
      if (interpolStr.compare("no", Qt::CaseInsensitive) == 0) {
        tsConf.interpolType = VS_Zero;
      } else if (interpolStr.compare("linear", Qt::CaseInsensitive) == 0) {
        tsConf.interpolType = VS_Linear;
      } else if (interpolStr.compare("bilinear", Qt::CaseInsensitive) == 0) {
        tsConf.interpolType = VS_BiLinear;
      } else if (interpolStr.compare("bicubic", Qt::CaseInsensitive) == 0) {
        tsConf.interpolType = VS_BiCubic;
      } else {
        die << QCoreApplication::translate("main", "Invalid interpolation algorithm \"%1\".").arg(interpolStr);
      }
    }

    mdConf.virtualTripod = getOpt(parser, die, *tripodOption, SomeInt(0), NoneInt, mdConf.virtualTripod,
      QCoreApplication::translate("main", "Cant parse tripod option."),
      QCoreApplication::translate("main", "Tripod option have to be possitive."));

    if (mdConf.virtualTripod > 0) {
      if (tsConf.relative != 0)
        *err << QCoreApplication::translate("main", "Relative transformation is disabled with tripod.") << endl;
      if (tsConf.smoothing != 0)
        *err << QCoreApplication::translate("main", "Smoothing is disabled with tripod.") << endl;
      tsConf.relative = 0;
      tsConf.smoothing = 0;
    }

  }
Пример #14
0
/**
 * Compute genotypes
 */
void DmetEngine::computeGenotypes() {
    ProbesetGenotypeEngine engine;

    vector<string> celFiles = getOptVector("cels");
    engine.setOpt("cels",celFiles);
    vector<string> chipTypes = getOptVector("chip-type");
    if(chipTypes.size() > 0)
        engine.setOpt("chip-type",chipTypes);
    engine.setOpt("cdf-file",getOpt("cdf-file"));
    engine.setOpt("spf-file",getOpt("spf-file"));
    string analysis;
    if(getOpt("gt-analysis") != "") {
        analysis = getOpt("gt-analysis");
    } else {
        ///@todo If we have a reference, set analysis and qmethod-spec based on 
        ///      what was used to build the reference
        if(getOpt("reference-output") != "") {
            analysis = "quant-norm.sketch=50000,pm-only,brlmm-p-multi.CM=1.bins=100.mix=1.bic=2.lambda=1.0.HARD=3.SB=0.75.KX=0.3.KH=0.3.KXX=0.1.KAH=-0.1.KHB=-0.1.KYAH=-0.05.KYHB=-0.05.KYAB=-0.1.transform=MVA.AAM=2.8.BBM=-2.8.AAV=0.10.BBV=0.10.ABV=0.10.V=1.AAY=10.7.ABY=11.3.BBY=10.7.copyqc=0.00000.wobble=0.05.MS=0.1.copytype=-1.clustertype=2.CSepPen=0.5.ocean=0.0000001";
        } else {
            analysis = "quant-norm.sketch=50000,pm-only,brlmm-p-multi.CM=2.bins=100.mix=1.bic=2.lambda=1.0.HARD=3.SB=0.75.KX=0.3.KH=0.3.KXX=0.1.KAH=-0.1.KHB=-0.1.KYAH=-0.05.KYHB=-0.05.KYAB=-0.1.transform=MVA.AAM=2.8.BBM=-2.8.AAV=0.10.BBV=0.10.ABV=0.10.V=1.AAY=10.7.ABY=11.3.BBY=10.7.copyqc=0.00000.wobble=0.05.MS=0.1.copytype=-1.clustertype=2.CSepPen=0.5.ocean=0.0000001";
        }
        analysis += ".cc-alleles=6";
        analysis += ".cc-type=UCHAR";
        analysis += ".cc-version=1.0";
    }
    if(getOpt("gt-qmethod-spec") != "")
        engine.setOpt("qmethod-spec",getOpt("gt-qmethod-spec"));
    else
        engine.setOpt("qmethod-spec","plier.optmethod=1.FixFeatureEffect=true");

    analysis = setPra(analysis,getOptInt("pra-thresh"));
    engine.setOpt("analysis",analysis);
    engine.setOpt("out-dir",Fs::join(getOpt("out-dir"),"apg"));
    engine.setOpt("verbose",getOpt("verbose"));
    engine.setOpt("force",getOpt("force"));
    engine.setOpt("cc-chp-output","false");
    engine.setOpt("probeset-ids-reported",getOpt("probeset-ids-reported"));
    engine.setOpt("probeset-ids",getOpt("probeset-ids"));
    engine.setOpt("temp-dir", getOpt("temp-dir"));
    engine.setOpt("use-disk", getOpt("use-disk"));
    engine.setOpt("disk-cache", getOpt("disk-cache"));
    engine.setOpt("set-analysis-name", getOpt("set-analysis-name"));
    engine.setOpt("call-coder-max-alleles", getOpt("call-coder-max-alleles"));
    engine.setOpt("call-coder-type", getOpt("call-coder-type"));
    engine.setOpt("call-coder-version", getOpt("call-coder-version"));
    engine.setOpt("command-line", getOpt("command-line"));
    engine.setOpt("exec-guid", getOpt("exec-guid"));
    engine.setOpt("program-name", getOpt("program-name"));
    engine.setOpt("program-company", getOpt("program-company"));
    engine.setOpt("program-version", getOpt("program-version"));
    engine.setOpt("program-cvs-id", getOpt("program-cvs-id"));
    engine.setOpt("version-to-report", getOpt("version-to-report"));
    engine.setOpt("prior-size", "1");
    engine.setOpt("special-snps", getOpt("special-snps"));
    engine.setOpt("em-gender", "false");
    if(getOpt("chrX-probes") != "") {
        engine.setOpt("chrX-probes", getOpt("chrX-probes"));
        engine.setOpt("chrY-probes", getOpt("chrY-probes"));
        engine.setOpt("set-gender-method", "cn-probe-chrXY-ratio");
        engine.setOpt("no-gender-force", "false");
    } else {
        engine.setOpt("set-gender-method", "none");
        engine.setOpt("no-gender-force", "true");
    }
    engine.setOpt("female-thresh", getOpt("female-thresh"));
    engine.setOpt("male-thresh", getOpt("male-thresh"));
    engine.setOpt("table-output", "false");
    engine.setOpt("output-context", "true");
    engine.setOpt("output-forced-calls", "true");

    if (getOptBool("run-cn-engine") && getOpt("cn-region-gt-probeset-file") != "") {
      /// @todo perhaps we should use state to track the file name
      ///       as it is we need to keep this in sync with the cn engine call
      engine.setOpt("genotype-markers-cn-file", 
                    Fs::join(getOpt("out-dir"),
                                 "adc",
                                 getOpt("set-analysis-name") + ".gt.markers.cn.call.a5"));
    }

    engine.setOpt("a5-global-file",getOpt("reference-output"));
    engine.setOpt("a5-global-file-no-replace","true");
    engine.setOpt("a5-group","ProbesetGenotypeEngine");
    engine.setOpt("a5-calls","true");
    engine.setOpt("a5-summaries","true");
    engine.setOpt("a5-feature-effects","true");
    engine.setOpt("a5-sketch","true");
    engine.setOpt("a5-write-models","true");
    if(getOpt("reference-output") != "") {
        engine.setOpt("a5-sketch-use-global","true");
        engine.setOpt("a5-feature-effects-use-global","true");
        engine.setOpt("a5-write-models-use-global","true");
    }
  
    engine.setOpt("a5-global-input-file",getOpt("reference-input"));
    engine.setOpt("a5-input-group","ProbesetGenotypeEngine");
    if(getOpt("reference-input") != "") {
        engine.setOpt("a5-sketch-input-global","true");
        engine.setOpt("a5-feature-effects-input-global","true");
        engine.setOpt("a5-models-input-global","true");
    }

    if(m_ArgvPosAPG > 0) 
        engine.parseArgv(m_argv, m_ArgvPosAPG);
    engine.run();
}
Пример #15
0
/*
  Set strip brightness based on potentiometer value
 */
void setBrightness() {
  // convert analogRead's range of 0 to 1023 to brightness range 0 to 255
  uint8_t brightness = (uint8_t) getOpt(_pin_lev, 0, 255);
  setBrightness(brightness);
}
Пример #16
0
int main(int argc, char* argv[]) {
	printf("SimpleDS\n");
	printf("Build: " VERSION_STR " (" SYSTEM_NAME " " SYSTEM_PROCESSOR ")");
#ifdef SDL_HAPTIC_DISABLED
	printf(" - No Haptic");
#endif
	printf("\nAuthors: " VERSION_AUTHORS "\n");

	args = std::vector<const char*>(argv, argv + argc);
	int offset = 1;

	std::string configFile = "./simpleds.conf";
	if (hasOpt("-c") || hasOpt("--config")) {
		configFile = getOpt("-c");
		if (configFile.size() == 0) {
			configFile = getOpt("--config");
		}
		offset += 2;
	}
	config = new Config(configFile);
	if (config->loaded) {
		printf("Config: %s\n", configFile.c_str());
		if (config->has("DS.foo")) {
			printf("Foo: %s\n", config->getString("DS.foo").c_str());
		}
	} else {
		printf("Config file couldn't be loaded, won't be able to save\n");
	}

	uint16_t teamNum = (uint16_t)config->getInt32("DS.team");

	verbose = (hasOpt("-v") || hasOpt("--verbose"));

	if (hasOpt("-V") || hasOpt("--version")) {
		return 0;
	}

	if (hasOpt("-h") || hasOpt("--help")) {
		printUsage();
		printf("Options:\n");
		printf(" -h, --help      Prints this message\n");
		printf(" -v, --verbose   Output debugging information\n");
		printf(" -V, --version   Prints version info and exits\n");
		printf(" -c, --config    Sets the config file to use [default: ./simpleds.conf]\n");
		printf(" teamNum         The team number to use, must be provided here or in configuration file\n");
		return 0;
	}

	if (teamNum == 0 && args.begin() + offset == args.end()) { // We're out of arguments
		printUsage();
		return 1;
	} else {
		char* endptr;
		uint16_t argTeamNum = (uint16_t)std::strtol(args[offset], &endptr, 10);

		if (endptr == args[offset] || *endptr != '\0') { // No team number in config, and none provided
			if (teamNum == 0) {
				printUsage();
				return 1;
			}
		} else {
			teamNum = argTeamNum;
		}
	}

	printf("Team Number: %d\n", teamNum);

	bool quit = false;
	SDL_Event e;

	auto gui = new GUI();
	if (!gui->isValid()) {
		return 1;
	}

	config->setInt32("DS.team", teamNum);
	config->initInt32("DS.alliance", Alliance::RED);
	config->initInt32("DS.position", 1);

	DS::initialize(teamNum);
	auto ds = DS::getInstance();

	enum GUIMode { MAIN, INFO, JOYSTICKS, CONTROL, HELP, COUNT };
	GUIMode mode = GUIMode::MAIN;

	auto runner = std::async(std::launch::async, &DS::run, ds);
	std::map<GUIMode, Screen*> screens;
	screens[MAIN] = new ScreenMain();
	screens[INFO] = new ScreenInfo();
	screens[JOYSTICKS] = new ScreenJoysticks();
	screens[CONTROL] = new ScreenControl();
	screens[HELP] = new ScreenHelp();

	while (!quit) {
		while (gui->pollEvent(&e) != 0) {
			if (e.type == SDL_QUIT) {
				quit = true;
			} else if (e.type == SDL_JOYDEVICEREMOVED || e.type == SDL_JOYDEVICEADDED) {
				ds->setEnable(false);
				ds->loadJoysticks();
			} else if (e.type == SDL_KEYDOWN && e.key.repeat == 0) {
				auto key = e.key.keysym;
				if (key.sym == SDLK_e) {
					ds->toggleEnable();
				} else if (key.sym == SDLK_SPACE) {
					ds->setEnable(false);
				} else if (key.sym == SDLK_0) {
					ds->setEStop();
				} else if (key.sym == SDLK_q) {
					quit = true;
				} else if (key.sym == SDLK_r) {
					if (key.mod & KMOD_SHIFT) {
						ds->reboot();
					} else {
						ds->restartCode();
					}
				} else if (key.sym == SDLK_BACKQUOTE) {
					ds->setAlliance(ds->getAlliance() == Alliance::BLUE ? Alliance::RED : Alliance::BLUE);
				} else if (key.sym >= SDLK_1 && key.sym <= SDLK_9) {
					uint8_t keyNum = (uint8_t)(1 + key.sym - SDLK_1);
					if (key.mod & KMOD_CTRL && keyNum >= 1 && keyNum <= 3) {
						ds->setPosition(keyNum);
					} else if (key.mod & KMOD_SHIFT && keyNum >= 1 && keyNum <= 3) {
						ds->setEnable(false);
						ds->setMode((Mode)(keyNum - 1));
					} else if (keyNum >= 1 && keyNum <= GUIMode::COUNT) {
						mode = (GUIMode)(keyNum - 1);
					}
				}
			}
			screens[mode]->update(e);
		}
		if (gui->readyToDraw()) {
			gui->setOffset(10, 10);
			gui->clear();
			gui->drawScreen(screens[mode]);

			gui->setOffset(10, gui->getHeight() - gui->getCharSize().y);
			gui->drawText(0, 0, "1: Main", mode == GUIMode::MAIN ? Colors::BLACK : Colors::DISABLED);
			gui->drawTextRel(9, 0, "2: Info", mode == GUIMode::INFO ? Colors::BLACK : Colors::DISABLED);
			gui->drawTextRel(9, 0, "3: Joysticks", mode == GUIMode::JOYSTICKS ? Colors::BLACK : Colors::DISABLED);
			gui->drawTextRel(14, 0, "4: Control", mode == GUIMode::CONTROL ? Colors::BLACK : Colors::DISABLED);
			gui->drawTextRel(12, 0, "5: Help", mode == GUIMode::HELP ? Colors::BLACK : Colors::DISABLED);

			gui->render();
		}

		std::string s = narf::util::format("Team %d", teamNum);
		if (ds->isConnected()) {
			auto rio = ds->getRoboRIO();
			s += " - ";
			if (rio->getEStop()) {
				s += "E-Stopped";
			} else {
				s += narf::util::format("%s %s", modeNames[rio->getMode()].c_str(), rio->getEnable() ? "Enabled" : "Disabled");
			}
			s += narf::util::format(" - %s %d", allianceNames[ds->getAlliance()].c_str(), ds->getPosition());
			if (!rio->getCode()) {
				s += " - No Code";
			}
		} else {
			s += " - No Comms";
		}
		gui->setTitle(s);

		ds->updateJoysticks();
		SDL_Delay(25);
	}

	ds->saveJoysticks();
	ds->stop();
	SDL_Quit();
	return 0;
}
Пример #17
0
/**
 * Compute probeset summaries values for using in computing CN state
 */
bool DmetEngine::computeCnSummaries() {
    ProbesetSummarizeEngine engine;

    vector<string> celFiles = getOptVector("cels");
    engine.setOpt("cels",celFiles);
    vector<string> chipTypes = getOptVector("chip-type");
    if(chipTypes.size() > 0)
        engine.setOpt("chip-type",chipTypes);
    engine.setOpt("cdf-file",getOpt("cdf-file"));
    engine.setOpt("spf-file",getOpt("spf-file"));
    ///@todo If we have a reference, set analysis based on what was used to build the reference
    if(getOpt("ps-analysis") != "")
        engine.setOpt("analysis",getOpt("ps-analysis"));
    else
        engine.setOpt("analysis",
            "quant-norm.sketch=50000,pm-only,plier.optmethod=1.FixFeatureEffect=true,expr.genotype=true");
    engine.setOpt("out-dir",Fs::join(getOpt("out-dir"),"aps"));
    engine.setOpt("verbose",getOpt("verbose"));
    engine.setOpt("force",getOpt("force"));
    engine.setOpt("cc-chp-output","false");

    // We only want to process intersection of probesets in consent file
    // and those in regions
    Fs::ensureWriteableDirPath(getOpt("out-dir", false));

    FsPath probesetFile;
    probesetFile.setDirName(getOpt("out-dir"));
    probesetFile.setFileNameExt("probesets","txt");
    if (!generateApsProbesetList(getOpt("probeset-ids-reported"),
                                 getOpt("probeset-model"),
                                 probesetFile.asUnixPath())) {
      return false;
    }

    engine.setOpt("probeset-ids",probesetFile.asUnixPath());
    engine.setOpt("temp-dir", getOpt("temp-dir"));
    engine.setOpt("use-disk", getOpt("use-disk"));
    engine.setOpt("disk-cache", getOpt("disk-cache"));
    engine.setOpt("set-analysis-name", getOpt("set-analysis-name"));
    engine.setOpt("command-line", getOpt("command-line"));
    engine.setOpt("exec-guid", getOpt("exec-guid"));
    engine.setOpt("program-name", getOpt("program-name"));
    engine.setOpt("program-company", getOpt("program-company"));
    engine.setOpt("program-version", getOpt("program-version"));
    engine.setOpt("program-cvs-id", getOpt("program-cvs-id"));
    engine.setOpt("version-to-report", getOpt("version-to-report"));
    engine.setOpt("summaries","false");

    engine.setOpt("a5-global-file",getOpt("reference-output"));
    //engine.setOpt("a5-global-file-no-replace","true");
    engine.setOpt("a5-group","ProbesetSummarizeEngine");
    engine.setOpt("a5-sketch","true");
    engine.setOpt("a5-summaries","true");
    engine.setOpt("a5-feature-effects","true");
    if(getOpt("reference-output") != "") {
        engine.setOpt("a5-feature-effects-use-global","true");
        engine.setOpt("a5-sketch-use-global","true");
    }
  
    engine.setOpt("a5-global-input-file",getOpt("reference-input"));
    engine.setOpt("a5-input-group","ProbesetSummarizeEngine");
    if(getOpt("reference-input") != "") {
        engine.setOpt("a5-sketch-input-global","true");
        engine.setOpt("a5-feature-effects-input-global","true");
    }

    if(m_ArgvPosAPS > 0) 
        engine.parseArgv(m_argv, m_ArgvPosAPS);
    engine.run();

    return true;
}
Пример #18
0
/**
 * Build final CHP files
 */
void DmetEngine::generateChpFiles() {

  DmetCHPWriter engine;

  AnalysisInfo info;
  fillInAnalysisInfo(info);
  engine.setAnalysisInfo(info);

  vector<string> celFiles = getOptVector("cels");
  engine.setOpt("cels",celFiles);
  engine.setOpt("out-dir",Fs::join(getOpt("out-dir"),"chp"));
  engine.setOpt("verbose",getOpt("verbose"));
  engine.setOpt("set-analysis-name", getOpt("set-analysis-name"));
  engine.setOpt("exec-guid", getOpt("exec-guid"));
  engine.setOpt("program-name", getOpt("program-name"));
  engine.setOpt("program-company", getOpt("program-company"));
  engine.setOpt("program-version", getOpt("program-version"));
  engine.setOpt("batch-name", getOpt("batch-name"));

  if (getOptBool("run-cn-engine")) {
    engine.setOpt("a5-copynumber",
                  Fs::join(getOpt("out-dir"), "adc",
                               getOpt("set-analysis-name") + ".copynumber.a5"));
  }

  engine.setOpt("a5-summaries",
                Fs::join(getOpt("out-dir"), "apg",
                             getOpt("set-analysis-name") + ".summary.a5"));
  engine.setOpt("a5-calls", 
                Fs::join(getOpt("out-dir"), "apg",
                             getOpt("set-analysis-name") + ".calls.a5"));
  engine.setOpt("a5-forced-calls", 
                Fs::join(getOpt("out-dir"), "apg", getOpt("set-analysis-name") + ".forced-calls.a5"));
  engine.setOpt("a5-confidences", 
                Fs::join(getOpt("out-dir"), "apg",
                             getOpt("set-analysis-name") + ".confidences.a5"));
  engine.setOpt("a5-context", 
                Fs::join(getOpt("out-dir"), "apg",
                             getOpt("set-analysis-name") + ".context.a5"));
  engine.setOpt("report-file", 
                Fs::join(getOpt("out-dir"), "apg",
                             getOpt("set-analysis-name") + ".report.txt"));

  engine.setOpt("spf-file",getOpt("spf-file"));
  engine.setOpt("cdf-file",getOpt("cdf-file"));
  engine.setOpt("region-model", getOpt("region-model"));
  engine.setOpt("null-context", getOpt("null-context"));
  engine.setOpt("geno-call-thresh", getOpt("geno-call-thresh"));
  engine.setOpt("call-coder-max-alleles", getOpt("call-coder-max-alleles"));
  engine.setOpt("call-coder-type", getOpt("call-coder-type"));
  engine.setOpt("call-coder-version", getOpt("call-coder-version"));

  engine.run();
}
Пример #19
0
void DmetEngine::fillInAnalysisInfo(AnalysisInfo &info) {
    string prefix = "apt-";

    vector<string> celFiles = getOptVector("cels");
    info.m_AlgVersion = "3.0";
    info.m_AlgName = getOpt("set-analysis-name");
    info.m_ProgramName = getOpt("program-name");
    info.m_ProgramVersion = getOpt("version-to-report");
    info.m_ProgramCompany = getOpt("program-company");
    info.m_ChipType = getOpt("chip-type");
    info.m_ProgID = "";
    info.m_ExecGuid = getOpt("exec-guid");
    info.m_AnalysisGuid = getOpt("analysis-guid");

    // Execution info
    info.addParam("apt-engine", "DmetEngine");
    info.addParam(prefix + "program-name", getOpt("program-name"));
    info.addParam(prefix + "command-line", getOpt("command-line"));
    info.addParam(prefix + "exec-guid", getOpt("exec-guid"));
    info.addParam(prefix + "analysis-guid", getOpt("analysis-guid"));
    info.addParam(prefix + "time-str", getOpt("time-start"));
    info.addParam(prefix + "version", getOpt("version-to-report"));
    info.addParam(prefix + "cvs-id", getOpt("program-cvs-id"));

    // Engine Options
    string opt = "opt-";
    vector<string> initialOptionNames;
    getOptionNames(initialOptionNames,1);
    for(int i=0; i<initialOptionNames.size(); i++) {
        string name = initialOptionNames[i];
        if((name != "cels") || getOptBool("batch-info")){
            info.addParam(prefix + opt + name, makeVal(name,1));
        }
    }

    // Cel files in batch
    if(getOptBool("batch-info")){
        for(uint32_t i = 0; i < celFiles.size(); i++) {
            std::string paramName = prefix + opt + "cel-" + ToStr(i+1);
            info.addParam(paramName, Fs::basename(celFiles[i]));
        
            affymetrix_fusion_io::FusionCELData cel;
            try {
                cel.SetFileName(celFiles[i].c_str());
                if(!cel.ReadHeader()) {
                    Err::errAbort("Unable to read CEL file " + celFiles[i]);
                }
                affymetrix_calvin_io::GenericData *gdata = cel.GetGenericData();
                if (gdata != NULL)
                {
                    std::string paramName = prefix + opt + "cel-guid-" + ToStr(i+1);
                    info.addParam(paramName, gdata->Header().GetGenericDataHdr()->GetFileId());
                }
                cel.Close();
            }
            catch (...)
            {
                Err::errAbort("Unable to read CEL file " + celFiles[i]);
            }
        }
    }
    
    // Engine State
    string option = "state-";
    std::vector<std::string> optionNames;
    getOptionNames(optionNames);
    for(int i=0; i<optionNames.size(); i++) {
        string name = optionNames[i];
        if((name != "cels") || getOptBool("batch-info")){
            info.addParam(prefix + option + name, makeVal(name));
        }
    }

    // Sanity check
    Err::check(info.m_ParamValues.size() == info.m_ParamNames.size(),
             "AnalysisInfo - Names and values out of sync.");
}
Пример #20
0
/** MAIN function. -------------------------------------------------------------------------------*/
int main( int argc, char** argv )
{
    Size boardSize, imageSize;
    float squareSize = 1.f, aspectRatio = 1.f;
    Mat cameraMatrix, distCoeffs;
    //DEPRECATE proposal
    const char* outputFilename = "out_camera_data.yml";
    //DEPRECATE proposal
    const char* inputFilename = 0;
    
    int i, nframes = 15;
    bool writeExtrinsics = false, writePoints = false;
    bool undistortImage = false;
    int flags = 0;
    VideoCapture capture;
    bool flipVertical = false;
    bool showUndistorted = false;
    bool videofile = false;
    int delay = 1000;
    clock_t prevTimestamp = 0;
    int mode = DETECTION;
    int cameraId = 0;
    vector<vector<Point2f> > imagePoints;
    vector<string> imageList;

	if ( getOpt(argc, argv, &boardSize, &squareSize, &nframes, &aspectRatio, &delay, &flags, &writeExtrinsics, &writePoints, &flipVertical, &showUndistorted, &videofile, &cameraId, inputFilename, outputFilename) != 0)
		return -1;

    if( inputFilename )
    {
        if( !videofile && readStringList(inputFilename, imageList) )
            mode = CAPTURING;
        else    
            capture.open(inputFilename);
    }
    else
        capture.open(cameraId);

    if( !capture.isOpened() && imageList.empty() )
        return fprintf(stderr, "Could not initialize video (%d) capture\n", cameraId ), -2;
    
    if( !imageList.empty() )
        nframes = (int)imageList.size();

    if( capture.isOpened() )
        printf("%s", liveCaptureHelp);

	namedWindow("Image View", 1);

    bool qrfound = false;
    int qr_pixel_size;
    
    struct quirc *q;
    q = quirc_new();
    
    for(i = 0;;i++)
    {
        Mat view, viewGray;
        bool blink = false;
        
        if( capture.isOpened() )
        {
            Mat view0;
            capture >> view0;
            view0.copyTo(view);
        }
        else if( i < (int)imageList.size() )
Пример #21
0
/**
 * Make sure that our options are sane. Call Err::errAbort if not.
 */
void DmetEngine::checkOptionsImp() {

    defineStates();

    setLibFileOpt("cdf-file");
    setLibFileOpt("spf-file");
    setLibFileOpt("special-snps");
    setLibFileOpt("chrX-probes");
    setLibFileOpt("chrY-probes");
    setLibFileOpt("reference-input");
    setLibFileOpt("probeset-ids");
    setLibFileOpt("probeset-ids-reported");
    setLibFileOpt("region-model");
    setLibFileOpt("probeset-model");
	setLibFileOpt("cn-region-gt-probeset-file");

    if (getOpt("out-dir") == "") {Err::errAbort("Must specify an output directory.");}
    if (getOpt("temp-dir") == "") { 
      setOpt("temp-dir", Fs::join(getOpt("out-dir"),"temp"));
    }

    string cdfFile = getOpt("cdf-file");
    string spfFile = getOpt("spf-file");
    string specialSnps = getOpt("special-snps");
    string chrXProbes = getOpt("chrX-probes");
    string chrYProbes = getOpt("chrY-probes");

	if(getOpt("sample-type") == "plasmid") { 
		setOpt("run-cn-engine","false"); 
	} else { 
		setOpt("run-cn-engine",getOpt("run-cn-engine"));
	}

    string refOut = getOpt("reference-output");
	string batchName = getOpt("batch-name");
    if(refOut == "") {
		if (batchName.empty() != true)
			Err::errAbort("You cannot provide a batch-name when running in single sample mode. batch-name is only valid when output-reference is specified.");
    } else {
		if (batchName.empty() == true)
			Err::errAbort("You must define the batch-name parameter");
        if(Fs::isReadable(refOut))
            if(Fs::rm(refOut, false) != APT_OK)
                Err::errAbort("Unable to remove existing reference-output file '" + refOut + "'");
	}

    ///@todo check chip type in reference file
    ///@todo check reference file version

    /* Read in cel file list from other file if specified. */
    vector<string> celFiles;
    EngineUtil::getCelFiles(celFiles, this);
    if(celFiles.size() == 0)
        Err::errAbort("No cel files specified.");
    setOpt("cels",celFiles);

    // Build a consent file if vector of markers was passed in
    vector<string> consented = getOptVector("report");
    if(consented.size() > 0) {
      FsPath probeset_path;
      probeset_path.setPath(getOpt("out-dir"),"probesets-reported","txt");
      //probeset_path.ensureWriteableDirPath();
	  Fs::ensureWriteableDirPath(getOpt("out-dir", false));
      writeProbesetList(probeset_path.asUnixPath(), consented);
      setOpt("probeset-ids-reported", probeset_path.asUnixPath());
    } else {
      setOpt("probeset-ids-reported", getOpt("probeset-ids-reported"));
    }

    if(cdfFile == "" && spfFile == "")
        Err::errAbort("Must specify either a cdf file or spf (simple probe format) file.");
    if (chrXProbes != "" && chrYProbes == "")
        Err::errAbort("Must provide a chrY Probe File when providing a chrX Probe File.");
    if (chrXProbes == "" && chrYProbes != "")
        Err::errAbort("Must provide a chrX Probe File when providing a chrY Probe File.");

    // Check chip types
    vector<string> chipTypesInLayout;

    /* Get the intial info about the chip and check cel files to make sure
       they match. */
    colrow_t numRows = 0, numCols = 0;
    int probeCount=0, probeSetCount=0;

    if(cdfFile != "")
        EngineUtil::getCdfChipType(chipTypesInLayout, numRows, numCols, probeCount, probeSetCount, cdfFile);
    else if(spfFile != "")
        EngineUtil::getSpfChipType(chipTypesInLayout, numRows, numCols, probeCount, probeSetCount, spfFile);
    else
        Err::errAbort("Must specify either a cdf file or spf (simple probe format) file.");

    setOpt("num-rows", ToStr(numRows));
    setOpt("num-cols", ToStr(numCols));
    setOpt("probe-count", ToStr(probeCount));

    if(chipTypesInLayout.empty() || chipTypesInLayout[0] == "" || probeCount == 0) 
        Err::errAbort("Problem determining ChipType in file: " + 
              ( cdfFile != "" ? cdfFile : spfFile));

    /* Did the user "force" a set of chip types via options? */
    vector<string> chipTypesSupplied = getOptVector("chip-type");

    /* Figure out what chip type to report */
    if(chipTypesSupplied.size() > 0) {
        setOpt("chip-type", chipTypesSupplied);
    } else if(chipTypesInLayout.size() > 0) {
        setOpt("chip-type", chipTypesInLayout);
    } else {
        Err::errAbort("Unable to figure out a chip type.");
    }

    /* Do Chip Type Check */
    if(!getOptBool("force")) {
        vector<string> chipTypeJustPrimary;
        vector<string> chipTypesToCheck;

        if(chipTypesSupplied.size() > 0) {
            chipTypesToCheck = chipTypesSupplied;
            EngineUtil::checkChipTypeVectors(chipTypesSupplied, chipTypesInLayout);
        } else {
            chipTypesToCheck = chipTypesInLayout;
        }

        chipTypeJustPrimary.push_back(chipTypesToCheck[0]);
        EngineUtil::checkCelChipTypes(chipTypesToCheck, probeCount, celFiles, numRows, numCols);

        // Check special SNPs files
        if (specialSnps != "") {
            EngineUtil::checkTsvFileChipType(specialSnps, chipTypeJustPrimary);
        }
        
        // And other files
        if (chrXProbes != "") {
            EngineUtil::checkTsvFileChipType(chrXProbes, chipTypesToCheck);
        }
        if (chrYProbes != "") {
            EngineUtil::checkTsvFileChipType(chrYProbes, chipTypesToCheck);
        }
    } // end if(!force)
}
Пример #22
0
/**
 * Compute the CN state
 */
void DmetEngine::computeCnState() {
    DmetCopyNumberEngine engine;

    engine.setOpt("out-dir",Fs::join(getOpt("out-dir"),"adc"));
    engine.setOpt("force",getOpt("force"));
    engine.setOpt("verbose",getOpt("verbose"));
    engine.setOpt("set-analysis-name", getOpt("set-analysis-name"));
    engine.setOpt("command-line", getOpt("command-line"));
    engine.setOpt("exec-guid", getOpt("exec-guid"));
    engine.setOpt("program-name", getOpt("program-name"));
    engine.setOpt("program-company", getOpt("program-company"));
    engine.setOpt("program-version", getOpt("program-version"));
    engine.setOpt("program-cvs-id", getOpt("program-cvs-id"));
    engine.setOpt("version-to-report", getOpt("version-to-report"));

    engine.setOpt("a5-output", "true");
    engine.setOpt("text-output", "true");
    engine.setOpt("region-model", getOpt("region-model"));
    engine.setOpt("cn-region-gt-probeset-file", getOpt("cn-region-gt-probeset-file"));
    engine.setOpt("probeset-model", getOpt("probeset-model"));
    engine.setOpt("a5-summaries",
                  Fs::join(getOpt("out-dir"), "aps",
                               getOpt("set-analysis-name") + ".summary.a5"));

    if(m_ArgvPosCN > 0) 
        engine.parseArgv(m_argv, m_ArgvPosCN);
    engine.run();
}