{
  "name": "pyBigWig query methods: what each returns and how it treats missing data",
  "description": "Compiled from the pyBigWig README and PyPI page: the main read and write methods, the arguments that change their results, and how each behaves on missing bases or sorted-order constraints.",
  "page": "https://casrai.org/guides/pybigwig",
  "publisher": "CASRAI",
  "license": "https://creativecommons.org/licenses/by/4.0/",
  "dateModified": "2026-12-01T09:50:00Z",
  "temporalCoverage": null,
  "spatialCoverage": null,
  "columns": [
    {
      "name": "Method",
      "unit": "",
      "description": ""
    },
    {
      "name": "Returns",
      "unit": "",
      "description": ""
    },
    {
      "name": "Key arguments",
      "unit": "",
      "description": ""
    },
    {
      "name": "Behaviour to note",
      "unit": "",
      "description": ""
    }
  ],
  "rows": [
    {
      "Method": "open(path, mode)",
      "Returns": "File object for bigWig or bigBed; None if the file is missing",
      "Key arguments": "mode: read by default, w to write",
      "Behaviour to note": "Mode is ignored for bigBed; a file opened with w cannot be queried"
    },
    {
      "Method": "header()",
      "Returns": "Dict: version, nLevels, nBasesCovered, minVal, maxVal, sumData, sumSquared",
      "Key arguments": "none",
      "Behaviour to note": "sumData and sumSquared support whole-file mean and standard deviation"
    },
    {
      "Method": "chroms([name])",
      "Returns": "Dict of chromosome lengths, or one length",
      "Key arguments": "optional chromosome name",
      "Behaviour to note": "Nothing is output for a non-existent chromosome name"
    },
    {
      "Method": "values(chrom, start, end)",
      "Returns": "One value per base in the range",
      "Key arguments": "numpy=True for an array",
      "Behaviour to note": "nan where a base has no value"
    },
    {
      "Method": "stats(chrom, start, end)",
      "Returns": "List of summaries, one per bin",
      "Key arguments": "type: mean (default), max, min, coverage, std; nBins (default 1); exact",
      "Behaviour to note": "Mean excludes bases with no value from the denominator; default may use zoom levels so exact=True gives exact results"
    },
    {
      "Method": "intervals(chrom, start, end)",
      "Returns": "Tuples of (start, end, value)",
      "Key arguments": "start and end optional (whole chromosome)",
      "Behaviour to note": "Returns None for a bigWig file with no entries"
    },
    {
      "Method": "entries(chrom, start, end)",
      "Returns": "bigBed tuples of (start, end, string)",
      "Key arguments": "withString=False for positions only",
      "Behaviour to note": "Parse the string using SQL()"
    },
    {
      "Method": "addHeader(list_of_chrom_length, maxZooms)",
      "Returns": "None (must precede entries)",
      "Key arguments": "maxZooms: up to 10 by default",
      "Behaviour to note": "maxZooms=0 files may not work in IGV and other tools"
    },
    {
      "Method": "addEntries(chroms, starts, ends, values, span, step, validate)",
      "Returns": "None",
      "Key arguments": "Three layouts: bedGraph-like, variable step with span, fixed step with span",
      "Behaviour to note": "Entries must be in order; validate=False skips the check"
    },
    {
      "Method": "close()",
      "Returns": "None",
      "Key arguments": "none",
      "Behaviour to note": "Required in write mode: flushes entries, builds the index and zoom levels"
    }
  ],
  "sources": [
    {
      "title": "pyBigWig README (deepTools)",
      "url": "https://github.com/deeptools/pyBigWig",
      "accessed": "2026-11-18"
    },
    {
      "title": "pyBigWig on PyPI",
      "url": "https://pypi.org/project/pyBigWig/",
      "accessed": "2026-11-18"
    }
  ]
}