public void Validate_NullGenomeAssembly_ThrowException() { SingleConfig config = GetConfig(); config.genomeAssembly = null; Assert.Throws <UserErrorException>(() => config.Validate()); }
public void Validate_NullVariant_ThrowException() { SingleConfig config = GetConfig(); config.variant = null; Assert.Throws <UserErrorException>(() => config.Validate()); }
public void Validate_Success() { SingleConfig config = GetConfig(); Exception ex = Record.Exception(() => { config.Validate(); }); Assert.Null(ex); }
// ReSharper disable once UnusedMember.Global public Stream Run(SingleConfig config, ILambdaContext context) { string snsTopicArn = null; Stream response; try { LogUtilities.UpdateLogger(context.Logger, null); LogUtilities.LogLambdaInfo(context, CommandLineUtilities.InformationalVersion); LogUtilities.LogObject("Config", config); LogUtilities.Log(new[] { LambdaUrlHelper.UrlBaseEnvironmentVariableName, LambdaUtilities.SnsTopicKey }); LambdaUtilities.GarbageCollect(); snsTopicArn = LambdaUtilities.GetEnvironmentVariable(LambdaUtilities.SnsTopicKey); config.Validate(); GenomeAssembly genomeAssembly = GenomeAssemblyHelper.Convert(config.genomeAssembly); var cacheConfiguration = new CacheConfiguration(genomeAssembly, config.supplementaryAnnotations, config.vepVersion); bool preloadRequired = !string.IsNullOrEmpty(config.supplementaryAnnotations); AnnotationResources annotationResources = GetAndCacheAnnotationResources(config, cacheConfiguration); if (genomeAssembly != GenomeAssembly.hg19) { annotationResources.Annotator.EnableMitochondrialAnnotation(); } (IPosition position, string[] sampleNames) = config.GetPositionAndSampleNames(annotationResources.SequenceProvider, annotationResources.RefMinorProvider); if (position.Chromosome.IsEmpty()) { throw new UserErrorException($"An unknown chromosome was specified ({config.variant.chromosome})"); } string annotationResult = GetPositionAnnotation(position, annotationResources, sampleNames, preloadRequired); response = SingleResult.Create(config.id, LambdaUrlHelper.SuccessMessage, annotationResult); } catch (Exception exception) { response = ExceptionHandler.GetStream(config.id, snsTopicArn, exception); } return(response); }