コード例 #1
0
ファイル: CommandLineOptions.cs プロジェクト: olgatei/MSPC
        private void AssertGivenValuesAreValid()
        {
            switch (_cReplicate.Value().ToLower())
            {
            case "bio":
            case "biological":
                _vreplicate = ReplicateType.Biological;
                break;

            case "tec":
            case "technical":
                _vreplicate = ReplicateType.Technical;
                break;

            default:
                throw new ArgumentException("Invalid value given for the `" + _cReplicate.LongName + "` argument.");
            }

            if (!double.TryParse(_cTauS.Value(), out _vtauS))
            {
                throw new ArgumentException("Invalid value given for the `" + _cTauS.LongName + "` argument.");
            }

            if (!double.TryParse(_cTauW.Value(), out _vtauW))
            {
                throw new ArgumentException("Invalid value given for the `" + _cTauW.LongName + "` argument.");
            }

            if (_vtauW <= _vtauS)
            {
                throw new ArgumentException("Stringency threshold (TauS) should be lower than weak threshold (TauW).");
            }

            if (_cGamma.HasValue() && !double.TryParse(_cGamma.Value(), out _vgamma))
            {
                throw new ArgumentException("Invalid value given for the `" + _cGamma.LongName + "` argument.");
            }
            _vgamma = _vgamma == -1 ? _vtauS : _vgamma;

            if (_cAlpha.HasValue() && !float.TryParse(_cAlpha.Value(), out _valpha))
            {
                throw new ArgumentException("Invalid value given for the `" + _cAlpha.LongName + "` argument.");
            }

            if (_cC.HasValue())
            {
                if (_cC.Value().Contains("%"))
                {
                    if (int.TryParse(_cC.Value().Replace("%", ""), out int percentage))
                    {
                        _vc = (_inputFiles.Count * percentage) / 100;
                    }
                    else
                    {
                        throw new ArgumentException("Invalid value given for the `" + _cC.ShortName + "` argument.");
                    }
                }
                else if (!int.TryParse(_cC.Value(), out _vc))
                {
                    throw new ArgumentException("Invalid value given for the `" + _cC.ShortName + "` argument.");
                }

                if (_vc < 1)
                {
                    _vc = 1;
                }
            }

            if (_cM.HasValue())
            {
                switch (_cM.Value().ToLower())
                {
                case "lowest":
                    _vm = MultipleIntersections.UseLowestPValue;
                    break;

                case "highest":
                    _vm = MultipleIntersections.UseHighestPValue;
                    break;

                default:
                    throw new ArgumentException("Invalid value given for the `" + _cM.LongName + "` argument.");
                }
            }
        }
コード例 #2
0
ファイル: CommandLineOptions.cs プロジェクト: VJalili/MSPC
        private void AssertGivenValuesAreValid()
        {
            switch (_cReplicate.Value().ToLower())
            {
            case "bio":
            case "biological":
                _vreplicate = ReplicateType.Biological;
                break;

            case "tec":
            case "technical":
                _vreplicate = ReplicateType.Technical;
                break;

            default:
                throw new ArgumentException("Invalid value given for the `" + _cReplicate.LongName + "` argument.");
            }

            if (!double.TryParse(_cTauS.Value(), out _vtauS))
            {
                throw new ArgumentException("Invalid value given for the `" + _cTauS.LongName + "` argument.");
            }

            if (!double.TryParse(_cTauW.Value(), out _vtauW))
            {
                throw new ArgumentException("Invalid value given for the `" + _cTauW.LongName + "` argument.");
            }

            if (_vtauW <= _vtauS)
            {
                throw new ArgumentException("Stringency threshold (TauS) should be lower than weak threshold (TauW).");
            }

            if (_cGamma.HasValue() && !double.TryParse(_cGamma.Value(), out _vgamma))
            {
                throw new ArgumentException("Invalid value given for the `" + _cGamma.LongName + "` argument.");
            }
            _vgamma = _vgamma == -1 ? _vtauS : _vgamma;

            if (_cAlpha.HasValue() && !float.TryParse(_cAlpha.Value(), out _valpha))
            {
                throw new ArgumentException("Invalid value given for the `" + _cAlpha.LongName + "` argument.");
            }

            if (_cC.HasValue())
            {
                if (_cC.Value().Contains("%"))
                {
                    if (int.TryParse(_cC.Value().Replace("%", ""), out int percentage))
                    {
                        _vc = (_inputFiles.Count * percentage) / 100;
                    }
                    else
                    {
                        throw new ArgumentException("Invalid value given for the `" + _cC.ShortName + "` argument.");
                    }
                }
                else if (!int.TryParse(_cC.Value(), out _vc))
                {
                    throw new ArgumentException("Invalid value given for the `" + _cC.ShortName + "` argument.");
                }

                if (_vc < 1)
                {
                    Warnings.Add($"Invalid `C={_cC.Value()}`, it is set to `C=1`.");
                    _vc = 1;
                }
                else if (_vc > _inputFiles.Count)
                {
                    Warnings.Add($"Invalid `C={_cC.Value()}`, it is set to `C={_inputFiles.Count}`.");
                    _vc = _inputFiles.Count;
                }
            }

            if (_cM.HasValue())
            {
                switch (_cM.Value().ToLower())
                {
                case "lowest":
                    _vm = MultipleIntersections.UseLowestPValue;
                    break;

                case "highest":
                    _vm = MultipleIntersections.UseHighestPValue;
                    break;

                default:
                    throw new ArgumentException("Invalid value given for the `" + _cM.LongName + "` argument.");
                }
            }

            if (_cOutput.HasValue())
            {
                OutputPath = _cOutput.Value();
            }

            if (_cDP.HasValue())
            {
                if (int.TryParse(_cDP.Value(), out int dp))
                {
                    DegreeOfParallelism = dp;
                }
                else
                {
                    throw new ArgumentException("Invalid value given for the `" + _cDP.LongName + "` argument.");
                }
            }

            if (_cExcludeHeader.HasValue())
            {
                ExcludeHeader = true;
            }
        }
コード例 #3
0
 internal Result(ReplicateType replicateType)
 {
     _replicateType = replicateType;
     Chromosomes    = new ConcurrentDictionary <string, Sets <I> >();
 }