/// <summary>
 /// Creates an instance of <see cref="GeneticSnpResults"/> with specified
 /// parameters.
 /// </summary>
 ///
 /// <param name="when">The date and time of the SNP test.</param>
 ///
 /// <param name="genomeBuild">The genome build that defines the SNPs.</param>
 ///
 /// <param name="chromosome">The chromosome on which the SNPs are located.</param>
 ///
 /// <param name="numberingScheme">The numbering scheme used for positions.</param>
 ///
 /// <exception cref="ArgumentNullException">
 /// If <paramref name="when"/> is <b> null</b>.
 /// </exception>
 ///
 /// <exception cref="ArgumentException">
 /// If <paramref name="genomeBuild"/> or <paramref name="chromosome" />
 /// is <b>null</b> or empty, or <paramref name="numberingScheme"/> is not 0 or 1.
 /// </exception>
 ///
 /// <exception cref="ArgumentOutOfRangeException" >
 /// The <paramref name="numberingScheme" /> is neither zero based scheme nor one
 /// based scheme.
 /// </exception>
 ///
 public GeneticSnpResults(
     ApproximateDateTime when,
     string genomeBuild,
     string chromosome,
     GenomeNumberingScheme numberingScheme)
     : base(TypeId)
 {
     When            = when;
     GenomeBuild     = genomeBuild;
     Chromosome      = chromosome;
     NumberingScheme = numberingScheme;
     Sections       |= ThingSections.BlobPayload;
 }
        /// <summary>
        /// Populates this <see cref="GeneticSnpResults"/> instance from the data
        /// in the XML.
        /// </summary>
        /// 
        /// <param name="typeSpecificXml">
        /// The XML to get the genetic snp result data from.
        /// </param>
        /// 
        /// <exception cref="InvalidOperationException">
        /// If the first node in <paramref name="typeSpecificXml"/> is not
        /// an "genetic-snp-results" node.
        /// </exception>
        /// 
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            XPathNavigator itemNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("genetic-snp-results");

            Validator.ThrowInvalidIfNull(itemNav, "GeneticSnpResultsUnexpectedNode");

            // <when> mandatory
            _when = new ApproximateDateTime();
            _when.ParseXml(itemNav.SelectSingleNode("when"));

            // <genome-build> mandatory
            _genomeBuild = itemNav.SelectSingleNode("genome-build").Value;

            // <chromosome> mandatory
            _chromosome = itemNav.SelectSingleNode("chromosome").Value;

            // <numbering-scheme> mandatory
            int numberingScheme = itemNav.SelectSingleNode("numbering-scheme").ValueAsInt;
            if ((numberingScheme == 0) || (numberingScheme == 1))
            {
                _numberingScheme = (GenomeNumberingScheme)numberingScheme;
            }
            else
            {
                _numberingScheme = GenomeNumberingScheme.Unknown;
            }

            // ordered-by
            _orderedBy =
                XPathHelper.GetOptNavValue<Organization>(itemNav, "ordered-by");

            // test-provider
            _testProvider =
                XPathHelper.GetOptNavValue<Organization>(itemNav, "test-provider");

            // laboratory-name
            _laboratoryName =
                XPathHelper.GetOptNavValue<Organization>(itemNav, "laboratory-name");

            // annotation-version
            _annotationVersion =
                XPathHelper.GetOptNavValue(itemNav, "annotation-version");

            // dbSNP-build
            _dbSnpBuild =
                XPathHelper.GetOptNavValue(itemNav, "dbSNP-build");

            // platform
            _platform =
                XPathHelper.GetOptNavValue(itemNav, "platform");
        }
 /// <summary>
 /// Creates an instance of <see cref="GeneticSnpResults"/> with specified 
 /// parameters. 
 /// </summary>
 /// 
 /// <param name="when">The date and time of the SNP test.</param>
 /// 
 /// <param name="genomeBuild">The genome build that defines the SNPs.</param>
 ///
 /// <param name="chromosome">The chromosome on which the SNPs are located.</param>
 /// 
 /// <param name="numberingScheme">The numbering scheme used for positions.</param>
 /// 
 /// <exception cref="ArgumentNullException">
 /// If <paramref name="when"/> is <b> null</b>. 
 /// </exception>
 /// 
 /// <exception cref="ArgumentException">
 /// If <paramref name="genomeBuild"/> or <paramref name="chromosome" /> 
 /// is <b>null</b> or empty, or <paramref name="numberingScheme"/> is not 0 or 1. 
 /// </exception> 
 /// 
 /// <exception cref="ArgumentOutOfRangeException" >
 /// The <paramref name="numberingScheme" /> is neither zero based scheme nor one
 /// based scheme. 
 /// </exception>
 /// 
 public GeneticSnpResults(
     ApproximateDateTime when,
     string genomeBuild,
     string chromosome,
     GenomeNumberingScheme numberingScheme)
     : base(TypeId)
 {
     When = when;
     GenomeBuild = genomeBuild;
     Chromosome = chromosome;
     NumberingScheme = numberingScheme;
     Sections |= HealthRecordItemSections.BlobPayload;
 }