# Genomics API . reads

## Instance Methods

Gets a list of reads for one or more readsets. Reads search operates over a genomic coordinate space of reference sequence & position defined over the reference sequences to which the requested readsets are aligned. If a target positional range is specified, search returns all reads whose alignment to the reference genome overlap the range. A query which specifies only readset IDs yields all reads in those readsets, including unmapped reads. All reads returned (including reads on subsequent pages) are ordered by genomic coordinate (reference sequence & position). Reads with equivalent genomic coordinates are returned in a deterministic order.

### Method Details

`search(body)`

    Gets a list of reads for one or more readsets. Reads search operates over a genomic coordinate space of reference sequence & position defined over the reference sequences to which the requested readsets are aligned. If a target positional range is specified, search returns all reads whose alignment to the reference genome overlap the range. A query which specifies only readset IDs yields all reads in those readsets, including unmapped reads. All reads returned (including reads on subsequent pages) are ordered by genomic coordinate (reference sequence & position). Reads with equivalent genomic coordinates are returned in a deterministic order.

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

    { # The read search request.
        "sequenceStart": "A String", # The start position (1-based, inclusive) of the target range. If specified, sequenceName must also be specified. Defaults to the start of the target reference sequence, if any.
        "readsetIds": [ # The readsets within which to search for reads. At least one readset ID must be provided. All specified readsets must be aligned against a common set of reference sequences; this defines the genomic coordinates for the query.
          "A String",
        ],
        "sequenceEnd": "A String", # The end position (1-based, inclusive) of the target range. If specified, sequenceName must also be specified. Defaults to the end of the target reference sequence, if any.
        "maxResults": "A String", # Specifies number of results to return in a single page. If unspecified, it will default to 256. The maximum value is 2048.
        "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.
        "sequenceName": "A String", # Restricts the results to a particular reference sequence such as 1, chr1, or X. The set of valid references sequences depends on the readsets specified. If set to *, only unmapped Reads are returned.
      }

    Returns:
      An object of the form:

        { # The read search 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.
        "reads": [ # The list of matching Reads. The resulting Reads are sorted by position; the smallest positions are returned first. Unmapped reads, which have no position, are returned last and are further sorted alphabetically by name.
          { # A Read is a group of bases that may or may not have been aligned to a reference. It contains quality information and other metadata.
            "mateReferenceSequenceName": "A String", # The name of the sequence that the paired read is aligned to. This is usually the same as referenceSequenceName. (RNEXT)
            "referenceSequenceName": "A String", # The name of the sequence that this read is aligned to. This would be, for example, 'X' for the X Chromosome or '20' for Chromosome 20. (RNAME)
            "name": "A String", # The name of the read. When imported from a BAM file, this is the query template name. (QNAME)
            "mappingQuality": 42, # A score up to 255 that represents how likely this read's aligned position is to be correct. A higher value is better. (MAPQ)
            "templateLength": 42, # Length of the original piece of DNA that produced both this read and the paired read. (TLEN)
            "cigar": "A String", # A condensed representation of how this read matches up to the reference. (CIGAR)
            "readsetId": "A String", # The ID of the readset this read belongs to.
            "matePosition": 42, # The 1-based start position of the paired read. (PNEXT)
            "tags": { # A map of additional read information. (TAG)
              "a_key": [ # A string which maps to an array of values.
                "A String",
              ],
            },
            "flags": 42, # Each bit of this number has a different meaning if enabled. See the full BAM spec for more details. (FLAG)
            "position": 42, # The 1-based start position of the aligned read. If the first base starts at the very beginning of the reference sequence, then the position would be '1'. (POS)
            "baseQuality": "A String", # Represents the quality of each base in this read. Each character represents one base. To get the quality, take the ASCII value of the character and subtract 33. (QUAL)
            "originalBases": "A String", # The list of bases that this read represents (such as "CATCGA"). (SEQ)
            "id": "A String", # The Google generated ID of the read, immutable.
            "alignedBases": "A String", # The originalBases after the cigar field has been applied. Deletions are represented with '-' and insertions are omitted.
          },
        ],
      }