See the HealthVault Data Type Wiki for current information on using this type.

This document contains general guidelines for using the GeneticSnpResults data type. It does not cover all the information that is stored in the type – see the GeneticSnpResults member documentation for more information.

The GeneticSnpResults type is used to store the results of a test that determines single nucleotide polymorphisms in a person’s genome.

Important properties

GenomeBuild

The GenomeBuild provides a definition for the SNP ids that are stored in the result data.  The definitions of the SNPs themselves are in the NCBI dbSNP database. 

Chromosome

The chromosome on which the SNP is located.

NumberingScheme

The numbering scheme (0-based or 1-based) which defines the physical locations of the start and end positions on the chromosome. 

Saving results

Because of the amount of data in a typical result set (currently on the order of a million individual SNPs), the results are grouped into separate instances by chromosome, and the data is stored in a compact format in the other-data section of the instance.

The following code illustrates how to create and save a set of SNP test results:

// for each chromosome in the results
{
    GeneticSnpResults resultsForOneChromosome = new GeneticSnpResults(when, genomeBuild, chromosome, numberingScheme);

    // set optional properties

    { // for each SNP result for the current chromosome
        SnpItem item = new SnpItem("rs1891906", "-", "GT", "SNP_C-315533", 940106, 940107);
        resultsForOneChromosome.SnpData.SnpItems.Add(item.ReferenceSnpId, item);
    }

    PersonInfo.SelectedRecord.NewItem(resultsForOneChromosome);
}

The when value should be set to the date and time when the results were generated, and should be the same across all chromosomes of a set of result.

Loading results

Loading a set of results will require processing multiple instances. There may be multiple sets of results in a single HealthVault record, and it is therefore recommended that applications load the results in two phases. In the first phase, the instances are loaded and then examined to see if they contain data that is of interested, and then the other-data for those instances is retrieved one instance at a time.

The following code illustrates this technique:

HealthRecordSearcher searcher = PersonInfo.SelectedRecord.CreateSearcher();
HealthRecordFilter filter = new HealthRecordFilter(GeneticSnpResults.TypeId);
searcher.Filters.Add(filter);

HealthRecordItemCollection items = searcher.GetMatchingItems()[0];
List<HealthRecordItemKey> interestingItems = new List<HealthRecordItemKey>();

// figure out which ones are interesting...
foreach (GeneticSnpResults resultsForOneChromosome in items)
{
    if (IsInteresting(resultsForOneChromosome))
    {
        interestingItems.Add(resultsForOneChromosome.Key);
    }
}

// fetch the results data for each of the interesting ones...
foreach (HealthRecordItemKey key in interestingItems)
{
    GeneticSnpResults results = (GeneticSnpResults)PersonInfo.SelectedRecord.GetItem(key.Id,
                                    HealthRecordItemSections.Core | HealthRecordItemSections.Xml | HealthRecordItemSections.OtherData);

    foreach (SnpItem snpItem in results.SnpData.SnpItems.Values)
    {
        // process the item here...
    }
}

Implementation details

The low-level details of the format of the results data can be found in the schema for the type (link). Details about how the .NET classes deal with this format can be found here (link).