public void ReadM(string m, MultipleIntersections expectedValue) { // Arrange & Act var options = new CommandLineOptions(); var po = options.Parse(GenerateShortNameArguments(m: m).Split(' '), out bool _); // Assert Assert.True(po.MultipleIntersections == expectedValue); }
/// <summary> /// The configuration of MSPC process. /// </summary> /// <param name="replicateType">Sets the replicate type of the input samples.</param> /// <param name="tauW">Sets weak p-value threshold.</param> /// <param name="tauS">Sets stringent p-value threshold.</param> /// <param name="gamma">Sets combined stringency threshold.</param> /// <param name="c">Sets the minimum number of samples having overlapping peaks with a given peak.</param> /// <param name="alpha">Sets Benjamini-Hochberg multiple testing correction threshold.</param> /// <param name="multipleIntersections">Sets if the peak with lowest or highest p-value /// should be used when multiple peaks from a sample overlap with a given peak.</param> public Config(ReplicateType replicateType, double tauW, double tauS, double gamma, int c, float alpha, MultipleIntersections multipleIntersections) { ReplicateType = replicateType; TauW = tauW; TauS = tauS; Gamma = gamma; C = c; Alpha = alpha; MultipleIntersections = multipleIntersections; }
private ReadOnlyDictionary <uint, Result <Peak> > InitializeAndRun(MultipleIntersections miChoice) { // Arrange var sA = new Bed <Peak>(); sA.Add(r11, _chr, _strand); var sB = new Bed <Peak>(); sB.Add(r21, _chr, _strand); sB.Add(r22, _chr, _strand); sB.Add(r23, _chr, _strand); var mspc = new Mspc(); mspc.AddSample(0, sA); mspc.AddSample(1, sB); // Act return(mspc.Run(new Config(ReplicateType.Biological, 1e-4, 1e-8, 1e-8, 2, 1F, miChoice))); }
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."); } } 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."); } } }