# Genomics API . variantsets

## Instance Methods

Creates a new variant set (only necessary in v1).

Deletes the contents of a variant set. The variant set object is not deleted.

Exports variant set data to an external destination.

Gets a variant set by ID.

Creates variant data by asynchronously importing the provided information.

Merges the given variants with existing variants. Each variant will be merged with an existing variant that matches its reference sequence, start, end, reference bases, and alternative bases. If no such variant exists, a new one will be created.

Updates a variant set's metadata. All other modifications are silently ignored. This method supports patch semantics.

Returns a list of all variant sets matching search criteria.

Updates a variant set's metadata. All other modifications are silently ignored.

### Method Details

`create(body)`

    Creates a new variant set (only necessary in v1).

    The provided variant set must have a valid datasetId set - all other fields are optional. Note that the id field will be ignored, as this is assigned by the server.

    Args:
      body: object, The request body. (required)
        The object takes the form of:

    { # A variant set is a collection of call sets and variants. It contains summary statistics of those contents. A variant set belongs to a dataset.
      "referenceBounds": [ # A list of all references used by the variants in a variant set with associated coordinate upper bounds for each one.
        { # ReferenceBound records an upper bound for the starting coordinate of variants in a particular reference.
          "upperBound": "A String", # An upper bound (inclusive) on the starting coordinate of any variant in the reference sequence.
          "referenceName": "A String", # The name of the reference associated with this reference bound.
        },
      ],
      "referenceSetId": "A String", # The reference set to which the variant set is mapped. The reference set describes the alignment provenance of the variant set, while the referenceBounds describe the shape of the actual variant data. The reference set's reference names are a superset of those found in the referenceBounds.
          #
          # For example, given a variant set that is mapped to the GRCh38 reference set and contains a single variant on reference 'X', referenceBounds would contain only an entry for 'X', while the associated reference set enumerates all possible references: '1', '2', 'X', 'Y', 'MT', etc.
      "id": "A String", # The Google-generated ID of the variant set. Immutable.
      "datasetId": "A String", # The dataset to which this variant set belongs. Immutable.
      "metadata": [ # The metadata associated with this variant set.
        { # Metadata describes a single piece of variant call metadata. These data include a top level key and either a single value string (value) or a list of key-value pairs (info.) Value and info are mutually exclusive.
          "info": { # A string which maps to an array of values.
            "a_key": [ # A string which maps to an array of values.
              "A String",
            ],
          },
          "description": "A String", # A textual description of this metadata.
          "number": "A String", # The number of values that can be included in a field described by this metadata.
          "value": "A String", # The value field for simple metadata
          "key": "A String", # The top-level key.
          "type": "A String", # The type of data. Possible types include: Integer, Float, Flag, Character, and String.
          "id": "A String", # User-provided ID field, not enforced by this API. Two or more pieces of structured metadata with identical id and key fields are considered equivalent.
        },
      ],
    }

    Returns:
      An object of the form:

        { # A variant set is a collection of call sets and variants. It contains summary statistics of those contents. A variant set belongs to a dataset.
        "referenceBounds": [ # A list of all references used by the variants in a variant set with associated coordinate upper bounds for each one.
          { # ReferenceBound records an upper bound for the starting coordinate of variants in a particular reference.
            "upperBound": "A String", # An upper bound (inclusive) on the starting coordinate of any variant in the reference sequence.
            "referenceName": "A String", # The name of the reference associated with this reference bound.
          },
        ],
        "referenceSetId": "A String", # The reference set to which the variant set is mapped. The reference set describes the alignment provenance of the variant set, while the referenceBounds describe the shape of the actual variant data. The reference set's reference names are a superset of those found in the referenceBounds.
            #
            # For example, given a variant set that is mapped to the GRCh38 reference set and contains a single variant on reference 'X', referenceBounds would contain only an entry for 'X', while the associated reference set enumerates all possible references: '1', '2', 'X', 'Y', 'MT', etc.
        "id": "A String", # The Google-generated ID of the variant set. Immutable.
        "datasetId": "A String", # The dataset to which this variant set belongs. Immutable.
        "metadata": [ # The metadata associated with this variant set.
          { # Metadata describes a single piece of variant call metadata. These data include a top level key and either a single value string (value) or a list of key-value pairs (info.) Value and info are mutually exclusive.
            "info": { # A string which maps to an array of values.
              "a_key": [ # A string which maps to an array of values.
                "A String",
              ],
            },
            "description": "A String", # A textual description of this metadata.
            "number": "A String", # The number of values that can be included in a field described by this metadata.
            "value": "A String", # The value field for simple metadata
            "key": "A String", # The top-level key.
            "type": "A String", # The type of data. Possible types include: Integer, Float, Flag, Character, and String.
            "id": "A String", # User-provided ID field, not enforced by this API. Two or more pieces of structured metadata with identical id and key fields are considered equivalent.
          },
        ],
      }

`delete(variantSetId)`

    Deletes the contents of a variant set. The variant set object is not deleted.

    Args:
      variantSetId: string, The ID of the variant set to be deleted. (required)

`export(variantSetId, body)`

    Exports variant set data to an external destination.

    Args:
      variantSetId: string, Required. The ID of the variant set that contains variant data which should be exported. The caller must have READ access to this variant set. (required)
      body: object, The request body. (required)
        The object takes the form of:

    { # The variant data export request.
        "bigqueryDataset": "A String", # Required. The BigQuery dataset to export data to. This dataset must already exist. Note that this is distinct from the Genomics concept of "dataset".
        "format": "A String", # The format for the exported data.
        "callSetIds": [ # If provided, only variant call information from the specified call sets will be exported. By default all variant calls are exported.
          "A String",
        ],
        "projectNumber": "A String", # Required. The Google Cloud project number that owns the destination BigQuery dataset. The caller must have WRITE access to this project. This project will also own the resulting export job.
        "bigqueryTable": "A String", # Required. The BigQuery table to export data to. If the table doesn't exist, it will be created. If it already exists, it will be overwritten.
      }

    Returns:
      An object of the form:

        { # The variant data export response.
        "jobId": "A String", # A job ID that can be used to get status information.
      }

`get(variantSetId)`

    Gets a variant set by ID.

    Args:
      variantSetId: string, Required. The ID of the variant set. (required)

    Returns:
      An object of the form:

        { # A variant set is a collection of call sets and variants. It contains summary statistics of those contents. A variant set belongs to a dataset.
        "referenceBounds": [ # A list of all references used by the variants in a variant set with associated coordinate upper bounds for each one.
          { # ReferenceBound records an upper bound for the starting coordinate of variants in a particular reference.
            "upperBound": "A String", # An upper bound (inclusive) on the starting coordinate of any variant in the reference sequence.
            "referenceName": "A String", # The name of the reference associated with this reference bound.
          },
        ],
        "referenceSetId": "A String", # The reference set to which the variant set is mapped. The reference set describes the alignment provenance of the variant set, while the referenceBounds describe the shape of the actual variant data. The reference set's reference names are a superset of those found in the referenceBounds.
            #
            # For example, given a variant set that is mapped to the GRCh38 reference set and contains a single variant on reference 'X', referenceBounds would contain only an entry for 'X', while the associated reference set enumerates all possible references: '1', '2', 'X', 'Y', 'MT', etc.
        "id": "A String", # The Google-generated ID of the variant set. Immutable.
        "datasetId": "A String", # The dataset to which this variant set belongs. Immutable.
        "metadata": [ # The metadata associated with this variant set.
          { # Metadata describes a single piece of variant call metadata. These data include a top level key and either a single value string (value) or a list of key-value pairs (info.) Value and info are mutually exclusive.
            "info": { # A string which maps to an array of values.
              "a_key": [ # A string which maps to an array of values.
                "A String",
              ],
            },
            "description": "A String", # A textual description of this metadata.
            "number": "A String", # The number of values that can be included in a field described by this metadata.
            "value": "A String", # The value field for simple metadata
            "key": "A String", # The top-level key.
            "type": "A String", # The type of data. Possible types include: Integer, Float, Flag, Character, and String.
            "id": "A String", # User-provided ID field, not enforced by this API. Two or more pieces of structured metadata with identical id and key fields are considered equivalent.
          },
        ],
      }

`importVariants(variantSetId, body)`

    Creates variant data by asynchronously importing the provided information.

    The variants for import will be merged with any existing data and each other according to the behavior of mergeVariants. In particular, this means for merged VCF variants that have conflicting info fields, some data will be arbitrarily discarded. As a special case, for single-sample VCF files, QUAL and FILTER fields will be moved to the call level; these are sometimes interpreted in a call-specific context. Imported VCF headers are appended to the metadata already in a variant set.

    Args:
      variantSetId: string, Required. The variant set to which variant data should be imported. (required)
      body: object, The request body. (required)
        The object takes the form of:

    { # The variant data import request.
        "normalizeReferenceNames": True or False, # Convert reference names to the canonical representation. hg19 haploytypes (those reference names containing "_hap") are not modified in any way. All other reference names are modified according to the following rules: The reference name is capitalized. The "chr" prefix is dropped for all autosomes and sex chromsomes. For example "chr17" becomes "17" and "chrX" becomes "X". All mitochondrial chromosomes ("chrM", "chrMT", etc) become "MT".
        "sourceUris": [ # A list of URIs referencing variant files in Google Cloud Storage. URIs can include wildcards as described here. Note that recursive wildcards ('**') are not supported.
          "A String",
        ],
        "format": "A String", # The format of the variant data being imported. If unspecified, defaults to "VCF".
      }

    Returns:
      An object of the form:

        { # The variant data import response.
        "jobId": "A String", # A job ID that can be used to get status information.
      }

`mergeVariants(variantSetId, body)`

    Merges the given variants with existing variants. Each variant will be merged with an existing variant that matches its reference sequence, start, end, reference bases, and alternative bases. If no such variant exists, a new one will be created.

    When variants are merged, the call information from the new variant is added to the existing variant, and other fields (such as key/value pairs) are discarded.

    Args:
      variantSetId: string, The destination variant set. (required)
      body: object, The request body. (required)
        The object takes the form of:

    {
        "variants": [ # The variants to be merged with existing variants.
          { # A variant represents a change in DNA sequence relative to a reference sequence. For example, a variant could represent a SNP or an insertion. Variants belong to a variant set. Each of the calls on a variant represent a determination of genotype with respect to that variant. For example, a call might assign probability of 0.32 to the occurrence of a SNP named rs1234 in a sample named NA12345. A call belongs to a call set, which contains related calls typically from one sample.
              "info": { # A string which maps to an array of values.
                "a_key": [ # A string which maps to an array of values.
                  "A String",
                ],
              },
              "variantSetId": "A String", # The ID of the variant set this variant belongs to.
              "end": "A String", # The end position (0-based) of this variant. This corresponds to the first base after the last base in the reference allele. So, the length of the reference allele is (end - start). This is useful for variants that don't explicitly give alternate bases, for example large deletions.
              "calls": [ # The variant calls for this particular variant. Each one represents the determination of genotype with respect to this variant.
                { # A call represents the determination of genotype with respect to a particular variant. It may include associated information such as quality and phasing. For example, a call might assign a probability of 0.32 to the occurrence of a SNP named rs1234 in a call set with the name NA12345.
                  "info": { # A string which maps to an array of values.
                    "a_key": [ # A string which maps to an array of values.
                      "A String",
                    ],
                  },
                  "genotype": [ # The genotype of this variant call. Each value represents either the value of the referenceBases field or a 1-based index into alternateBases. If a variant had a referenceBases value of T and an alternateBases value of ["A", "C"], and the genotype was [2, 1], that would mean the call represented the heterozygous value CA for this variant. If the genotype was instead [0, 1], the represented value would be TA. Ordering of the genotype values is important if the phaseset is present. If a genotype is not called (that is, a . is present in the GT string) -1 is returned.
                    42,
                  ],
                  "callSetId": "A String", # The ID of the call set this variant call belongs to.
                  "phaseset": "A String", # If this field is present, this variant call's genotype ordering implies the phase of the bases and is consistent with any other variant calls in the same reference sequence which have the same phaseset value. When importing data from VCF, if the genotype data was phased but no phase set was specified this field will be set to *.
                  "genotypeLikelihood": [ # The genotype likelihoods for this variant call. Each array entry represents how likely a specific genotype is for this call. The value ordering is defined by the GL tag in the VCF spec. If Phred-scaled genotype likelihood scores (PL) are available and log10(P) genotype likelihood scores (GL) are not, PL scores are converted to GL scores. If both are available, PL scores are stored in info.
                    3.14,
                  ],
                  "callSetName": "A String", # The name of the call set this variant call belongs to.
                },
              ],
              "created": "A String", # The date this variant was created, in milliseconds from the epoch.
              "referenceBases": "A String", # The reference bases for this variant. They start at the given position.
              "filter": [ # A list of filters (normally quality filters) this variant has failed. PASS indicates this variant has passed all filters.
                "A String",
              ],
              "start": "A String", # The position at which this variant occurs (0-based). This corresponds to the first base of the string of reference bases.
              "names": [ # Names for the variant, for example a RefSNP ID.
                "A String",
              ],
              "alternateBases": [ # The bases that appear instead of the reference bases.
                "A String",
              ],
              "referenceName": "A String", # The reference on which this variant occurs. (such as chr20 or X)
              "quality": 3.14, # A measure of how likely this variant is to be real. A higher value is better.
              "id": "A String", # The Google generated ID of the variant, immutable.
            },
        ],
      }

`patch(variantSetId, body)`

    Updates a variant set's metadata. All other modifications are silently ignored. This method supports patch semantics.

    Args:
      variantSetId: string, The ID of the variant to be updated (must already exist). (required)
      body: object, The request body. (required)
        The object takes the form of:

    { # A variant set is a collection of call sets and variants. It contains summary statistics of those contents. A variant set belongs to a dataset.
      "referenceBounds": [ # A list of all references used by the variants in a variant set with associated coordinate upper bounds for each one.
        { # ReferenceBound records an upper bound for the starting coordinate of variants in a particular reference.
          "upperBound": "A String", # An upper bound (inclusive) on the starting coordinate of any variant in the reference sequence.
          "referenceName": "A String", # The name of the reference associated with this reference bound.
        },
      ],
      "referenceSetId": "A String", # The reference set to which the variant set is mapped. The reference set describes the alignment provenance of the variant set, while the referenceBounds describe the shape of the actual variant data. The reference set's reference names are a superset of those found in the referenceBounds.
          #
          # For example, given a variant set that is mapped to the GRCh38 reference set and contains a single variant on reference 'X', referenceBounds would contain only an entry for 'X', while the associated reference set enumerates all possible references: '1', '2', 'X', 'Y', 'MT', etc.
      "id": "A String", # The Google-generated ID of the variant set. Immutable.
      "datasetId": "A String", # The dataset to which this variant set belongs. Immutable.
      "metadata": [ # The metadata associated with this variant set.
        { # Metadata describes a single piece of variant call metadata. These data include a top level key and either a single value string (value) or a list of key-value pairs (info.) Value and info are mutually exclusive.
          "info": { # A string which maps to an array of values.
            "a_key": [ # A string which maps to an array of values.
              "A String",
            ],
          },
          "description": "A String", # A textual description of this metadata.
          "number": "A String", # The number of values that can be included in a field described by this metadata.
          "value": "A String", # The value field for simple metadata
          "key": "A String", # The top-level key.
          "type": "A String", # The type of data. Possible types include: Integer, Float, Flag, Character, and String.
          "id": "A String", # User-provided ID field, not enforced by this API. Two or more pieces of structured metadata with identical id and key fields are considered equivalent.
        },
      ],
    }

    Returns:
      An object of the form:

        { # A variant set is a collection of call sets and variants. It contains summary statistics of those contents. A variant set belongs to a dataset.
        "referenceBounds": [ # A list of all references used by the variants in a variant set with associated coordinate upper bounds for each one.
          { # ReferenceBound records an upper bound for the starting coordinate of variants in a particular reference.
            "upperBound": "A String", # An upper bound (inclusive) on the starting coordinate of any variant in the reference sequence.
            "referenceName": "A String", # The name of the reference associated with this reference bound.
          },
        ],
        "referenceSetId": "A String", # The reference set to which the variant set is mapped. The reference set describes the alignment provenance of the variant set, while the referenceBounds describe the shape of the actual variant data. The reference set's reference names are a superset of those found in the referenceBounds.
            #
            # For example, given a variant set that is mapped to the GRCh38 reference set and contains a single variant on reference 'X', referenceBounds would contain only an entry for 'X', while the associated reference set enumerates all possible references: '1', '2', 'X', 'Y', 'MT', etc.
        "id": "A String", # The Google-generated ID of the variant set. Immutable.
        "datasetId": "A String", # The dataset to which this variant set belongs. Immutable.
        "metadata": [ # The metadata associated with this variant set.
          { # Metadata describes a single piece of variant call metadata. These data include a top level key and either a single value string (value) or a list of key-value pairs (info.) Value and info are mutually exclusive.
            "info": { # A string which maps to an array of values.
              "a_key": [ # A string which maps to an array of values.
                "A String",
              ],
            },
            "description": "A String", # A textual description of this metadata.
            "number": "A String", # The number of values that can be included in a field described by this metadata.
            "value": "A String", # The value field for simple metadata
            "key": "A String", # The top-level key.
            "type": "A String", # The type of data. Possible types include: Integer, Float, Flag, Character, and String.
            "id": "A String", # User-provided ID field, not enforced by this API. Two or more pieces of structured metadata with identical id and key fields are considered equivalent.
          },
        ],
      }

`search(body)`

    Returns a list of all variant sets matching search criteria.

    Implements GlobalAllianceApi.searchVariantSets.

    Args:
      body: object, The request body. (required)
        The object takes the form of:

    { # The search variant sets request.
        "pageToken": "A String", # The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of nextPageToken from the previous response.
        "datasetIds": [ # Exactly one dataset ID must be provided here. Only variant sets which belong to this dataset will be returned.
          "A String",
        ],
        "pageSize": 42, # The maximum number of results to return in a single page. If unspecified, defaults to 1024.
      }

    Returns:
      An object of the form:

        { # The search variant sets response.
        "nextPageToken": "A String", # The continuation token, which is used to page through large result sets. Provide this value in a subsequent request to return the next page of results. This field will be empty if there aren't any additional results.
        "variantSets": [ # The variant sets belonging to the requested dataset.
          { # A variant set is a collection of call sets and variants. It contains summary statistics of those contents. A variant set belongs to a dataset.
            "referenceBounds": [ # A list of all references used by the variants in a variant set with associated coordinate upper bounds for each one.
              { # ReferenceBound records an upper bound for the starting coordinate of variants in a particular reference.
                "upperBound": "A String", # An upper bound (inclusive) on the starting coordinate of any variant in the reference sequence.
                "referenceName": "A String", # The name of the reference associated with this reference bound.
              },
            ],
            "referenceSetId": "A String", # The reference set to which the variant set is mapped. The reference set describes the alignment provenance of the variant set, while the referenceBounds describe the shape of the actual variant data. The reference set's reference names are a superset of those found in the referenceBounds.
                #
                # For example, given a variant set that is mapped to the GRCh38 reference set and contains a single variant on reference 'X', referenceBounds would contain only an entry for 'X', while the associated reference set enumerates all possible references: '1', '2', 'X', 'Y', 'MT', etc.
            "id": "A String", # The Google-generated ID of the variant set. Immutable.
            "datasetId": "A String", # The dataset to which this variant set belongs. Immutable.
            "metadata": [ # The metadata associated with this variant set.
              { # Metadata describes a single piece of variant call metadata. These data include a top level key and either a single value string (value) or a list of key-value pairs (info.) Value and info are mutually exclusive.
                "info": { # A string which maps to an array of values.
                  "a_key": [ # A string which maps to an array of values.
                    "A String",
                  ],
                },
                "description": "A String", # A textual description of this metadata.
                "number": "A String", # The number of values that can be included in a field described by this metadata.
                "value": "A String", # The value field for simple metadata
                "key": "A String", # The top-level key.
                "type": "A String", # The type of data. Possible types include: Integer, Float, Flag, Character, and String.
                "id": "A String", # User-provided ID field, not enforced by this API. Two or more pieces of structured metadata with identical id and key fields are considered equivalent.
              },
            ],
          },
        ],
      }

`update(variantSetId, body)`

    Updates a variant set's metadata. All other modifications are silently ignored.

    Args:
      variantSetId: string, The ID of the variant to be updated (must already exist). (required)
      body: object, The request body. (required)
        The object takes the form of:

    { # A variant set is a collection of call sets and variants. It contains summary statistics of those contents. A variant set belongs to a dataset.
      "referenceBounds": [ # A list of all references used by the variants in a variant set with associated coordinate upper bounds for each one.
        { # ReferenceBound records an upper bound for the starting coordinate of variants in a particular reference.
          "upperBound": "A String", # An upper bound (inclusive) on the starting coordinate of any variant in the reference sequence.
          "referenceName": "A String", # The name of the reference associated with this reference bound.
        },
      ],
      "referenceSetId": "A String", # The reference set to which the variant set is mapped. The reference set describes the alignment provenance of the variant set, while the referenceBounds describe the shape of the actual variant data. The reference set's reference names are a superset of those found in the referenceBounds.
          #
          # For example, given a variant set that is mapped to the GRCh38 reference set and contains a single variant on reference 'X', referenceBounds would contain only an entry for 'X', while the associated reference set enumerates all possible references: '1', '2', 'X', 'Y', 'MT', etc.
      "id": "A String", # The Google-generated ID of the variant set. Immutable.
      "datasetId": "A String", # The dataset to which this variant set belongs. Immutable.
      "metadata": [ # The metadata associated with this variant set.
        { # Metadata describes a single piece of variant call metadata. These data include a top level key and either a single value string (value) or a list of key-value pairs (info.) Value and info are mutually exclusive.
          "info": { # A string which maps to an array of values.
            "a_key": [ # A string which maps to an array of values.
              "A String",
            ],
          },
          "description": "A String", # A textual description of this metadata.
          "number": "A String", # The number of values that can be included in a field described by this metadata.
          "value": "A String", # The value field for simple metadata
          "key": "A String", # The top-level key.
          "type": "A String", # The type of data. Possible types include: Integer, Float, Flag, Character, and String.
          "id": "A String", # User-provided ID field, not enforced by this API. Two or more pieces of structured metadata with identical id and key fields are considered equivalent.
        },
      ],
    }

    Returns:
      An object of the form:

        { # A variant set is a collection of call sets and variants. It contains summary statistics of those contents. A variant set belongs to a dataset.
        "referenceBounds": [ # A list of all references used by the variants in a variant set with associated coordinate upper bounds for each one.
          { # ReferenceBound records an upper bound for the starting coordinate of variants in a particular reference.
            "upperBound": "A String", # An upper bound (inclusive) on the starting coordinate of any variant in the reference sequence.
            "referenceName": "A String", # The name of the reference associated with this reference bound.
          },
        ],
        "referenceSetId": "A String", # The reference set to which the variant set is mapped. The reference set describes the alignment provenance of the variant set, while the referenceBounds describe the shape of the actual variant data. The reference set's reference names are a superset of those found in the referenceBounds.
            #
            # For example, given a variant set that is mapped to the GRCh38 reference set and contains a single variant on reference 'X', referenceBounds would contain only an entry for 'X', while the associated reference set enumerates all possible references: '1', '2', 'X', 'Y', 'MT', etc.
        "id": "A String", # The Google-generated ID of the variant set. Immutable.
        "datasetId": "A String", # The dataset to which this variant set belongs. Immutable.
        "metadata": [ # The metadata associated with this variant set.
          { # Metadata describes a single piece of variant call metadata. These data include a top level key and either a single value string (value) or a list of key-value pairs (info.) Value and info are mutually exclusive.
            "info": { # A string which maps to an array of values.
              "a_key": [ # A string which maps to an array of values.
                "A String",
              ],
            },
            "description": "A String", # A textual description of this metadata.
            "number": "A String", # The number of values that can be included in a field described by this metadata.
            "value": "A String", # The value field for simple metadata
            "key": "A String", # The top-level key.
            "type": "A String", # The type of data. Possible types include: Integer, Float, Flag, Character, and String.
            "id": "A String", # User-provided ID field, not enforced by this API. Two or more pieces of structured metadata with identical id and key fields are considered equivalent.
          },
        ],
      }