QuantNadoDataset
quantnado.analysis.core.QuantNadoDataset
¶
Unified read-only xarray view over QuantNado zarr stores.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path | str
|
Path to either:
- a directory containing per-sample |
required |
Examples:
>>> qn = QuantNadoDataset("dataset/")
>>> region = qn.sel(chrom="chr1", start=1_000_000, end=1_001_000)
>>> region["atac"].sel(sample="ATAC-SEM-1")
>>> tree = qn.to_datatree()
Source code in quantnado/analysis/core.py
assays
property
¶
Distinct biological assay types present (e.g. 'ATAC', 'RNA', 'METH').
array_keys
property
¶
All zarr data-variable names (e.g. 'atac', 'rna_fwd', 'coverage', 'AF').
group_sets
property
¶
Cached named group sets for the current dataset view.
metadata
property
¶
Return per-sample metadata with core fields plus cached group_by labels.
available_peak_methods
property
¶
Peak-calling methods supported by :meth:call_peaks.
coverage
property
¶
Sub-store adapter for plotnado stranded coverage tracks (RNA).
methylation
property
¶
Sub-store adapter for plotnado methylation tracks.
variants
property
¶
Sub-store adapter for plotnado variant tracks.
group_by
¶
group_by(
by: str = "assay",
*,
groups: "dict[str, list[str] | str] | None" = None,
match: str = "exact",
drop_empty: bool = True,
**named_groups: "dict[str, list[str] | str]",
) -> "GroupInfo | NamedGroupInfo"
Build sample groups from metadata or an explicit mapping.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
by
|
str
|
Metadata field to group on. Currently supports |
'assay'
|
groups
|
'dict[str, list[str] | str] | None'
|
Optional explicit label -> sample list mapping. When provided, this
takes precedence over |
None
|
match
|
str
|
How to interpret |
'exact'
|
drop_empty
|
bool
|
If True (default), drop groups whose label is empty. |
True
|
Source code in quantnado/analysis/core.py
692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 | |
subset
¶
subset(
assay: "str | Sequence[str] | None" = None,
samples: "str | Sequence[str] | None" = None,
ip: "str | Sequence[str] | None" = None,
group: "str | Sequence[str] | dict[str, str | Sequence[str]] | None" = None,
) -> "QuantNadoDataset"
Return a new QuantNadoDataset restricted to the specified filters.
No data is copied — the returned object shares the same zarr handles.
Use this to avoid repeating assay= or samples= on every call::
rna = qn.subset(assay="RNA")
reduced = rna.reduce(intervals_path="promoters.bed")
normalised = rna.normalise(reduced, method="cpm")
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
assay
|
'str | Sequence[str] | None'
|
One or more assay types (e.g. |
None
|
samples
|
'str | Sequence[str] | None'
|
Explicit sample name(s). |
None
|
ip
|
'str | Sequence[str] | None'
|
One or more IP / target labels (e.g. |
None
|
group
|
'str | Sequence[str] | dict[str, str | Sequence[str]] | None'
|
Labels from cached group sets. Pass a string / list to use the most
recent :meth: |
None
|
Returns:
| Type | Description |
|---|---|
QuantNadoDataset
|
A lightweight view over the same stores, filtered to the resolved samples. |
Source code in quantnado/analysis/core.py
set_annotation
¶
Attach a GTF annotation file for gene-name-based queries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gtf_path
|
str | Path
|
Path to a GTF or GTF.gz file (e.g. hg38.gtf.gz). |
required |
Source code in quantnado/analysis/core.py
gene_info
¶
Look up a gene by name and return its coordinates and exon structure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Gene name (e.g. "GNAQ"). Case-sensitive; falls back to case-insensitive. |
required |
Returns:
| Type | Description |
|---|---|
dict with keys: gene_name, gene_id, chrom, start, end, strand, locus, exons.
|
|
Coordinates are 1-based inclusive.
|
|
Source code in quantnado/analysis/core.py
sel_gene
¶
sel_gene(
name: str,
padding: int = 0,
assay: "str | Sequence[str] | None" = None,
samples: "str | Sequence[str] | None" = None,
) -> xr.Dataset
Select a genomic region by gene name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Gene name (e.g. "GNAQ"). |
required |
padding
|
int
|
Extra bases to add on each side of the gene body (default: 0). |
0
|
assay
|
'str | Sequence[str] | None'
|
Optional assay filter passed to :meth: |
None
|
Returns:
| Type | Description |
|---|---|
xr.Dataset with gene metadata in ``.attrs``:
|
|
``gene_name``, ``gene_id``, ``gene_strand``, ``locus``, ``exons``.
|
|
Source code in quantnado/analysis/core.py
sel
¶
sel(
chrom: str,
start: int | None = None,
end: int | None = None,
assay: "str | Sequence[str] | None" = None,
samples: "str | Sequence[str] | None" = None,
) -> xr.Dataset
Extract a genomic region as an xr.Dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chrom
|
str
|
Chromosome name (e.g. |
required |
start
|
int | None
|
1-based start position (inclusive). Defaults to 1. |
None
|
end
|
int | None
|
1-based end position (inclusive). Defaults to chromosome length. |
None
|
assay
|
'str | Sequence[str] | None'
|
If provided, restrict to samples whose assay type matches
(e.g. |
None
|
Returns:
| Type | Description |
|---|---|
Dataset
|
dims: sample × position coords: position (1-based), sample, assay (non-index on sample) data_vars: one per assay key (atac, chip_h3k27ac, rna_fwd, …) |
Source code in quantnado/analysis/core.py
1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 | |
to_datatree
¶
Return the full dataset as an xr.DataTree.
Each chromosome is a child node containing an xr.Dataset with 1-based position coordinates and assay data variables.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chromosomes
|
list[str] | None
|
Subset of chromosomes. Defaults to all. |
None
|
lazy
|
bool
|
If True (default), use lazy dask arrays without materializing position coordinate arrays. This is much faster for large datasets. If False, materializes the full position coordinate for each chromosome. |
True
|
Source code in quantnado/analysis/core.py
extract
¶
extract(
feature_type: str = "promoter",
GTF_FILE: str | None = None,
anchor_feature: str = "gene",
fixed_width: int | None = None,
upstream: int | None = None,
downstream: int | None = None,
anchor: str = "start",
flip_strand: bool = True,
bin_size: int = 50,
assay: "str | Sequence[str] | None" = None,
modality: "str | Sequence[str] | None" = None,
samples: "str | Sequence[str] | None" = None,
) -> xr.DataArray
Extract signal into fixed-width bins around genomic features.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feature_type
|
str
|
Feature type: "promoter", "gene", "transcript", or "exon". |
'promoter'
|
GTF_FILE
|
str
|
Path to GTF file. |
None
|
anchor_feature
|
str
|
Which feature type to anchor promoters on when |
'gene'
|
fixed_width
|
int
|
If provided, expands features to this width around anchor point. If None, uses feature length. |
None
|
upstream
|
int
|
Window around the anchor in base pairs. When provided, positions are
extracted from |
None
|
downstream
|
int
|
Window around the anchor in base pairs. When provided, positions are
extracted from |
None
|
anchor
|
str
|
Anchor point: "start", "end", or "midpoint". |
'start'
|
flip_strand
|
bool
|
If True (default), reverse minus-strand intervals after extraction so the returned windows are oriented 5'→3' relative to the anchor. This is especially useful for gene/transcript-body style plots where the gene body should lie to the right of the TSS. |
True
|
bin_size
|
int
|
Width of each bin in bp (default: 50). |
50
|
assay
|
str
|
Assay type to restrict samples to (e.g. "RNA", "ATAC", "METH"). Also accepted as the array key for backward compatibility. |
None
|
modality
|
str
|
Array key to extract (e.g. "rna_fwd", "coverage", "methyl_pct"). Required when assay is a type name rather than an array key. |
None
|
samples
|
list of str
|
Sample names to extract. If None, uses all samples. |
None
|
Returns:
| Type | Description |
|---|---|
DataArray
|
Shape (interval, bin, sample) with binned signal. |
Source code in quantnado/analysis/core.py
1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 | |
call_peaks
¶
call_peaks(
output_dir: "str | Path",
method: "str | Sequence[str] | None" = None,
assay: "str | Sequence[str] | None" = None,
**kwargs,
) -> "dict[str, Path] | dict[str, dict[str, Path]]"
Call peaks for all completed samples in the dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_dir
|
str or Path
|
Directory where per-sample BED files are written. |
required |
method
|
('quantile', 'seacr', 'lanceotron')
|
Peak-calling algorithm. Pass one method or a list of methods. When omitted, one method is auto-selected from the biological assay type:
|
"quantile"
|
assay
|
str
|
Zarr array key to call peaks on (e.g. |
None
|
**kwargs
|
Passed through to the underlying caller. Common options:
|
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Path] or dict[str, dict[str, Path]]
|
For one method: sample name → path to the output BED file. For multiple methods: method name → (sample name → path). |
Examples:
>>> qn.available_peak_methods
['quantile', 'seacr', 'lanceotron']
>>> beds = qn.subset(assay="ATAC").call_peaks("peaks/atac/")
>>> beds = qn.subset(assay="CUT&TAG").call_peaks("peaks/cat/", method="seacr")
>>> beds_by_method = qn.call_peaks("peaks/", method=["quantile", "lanceotron"], assay=["ATAC", "CHIP"])
Source code in quantnado/analysis/core.py
1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 | |
peak_overlap
¶
Compute overlap statistics across 2–4 peak sets.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
peak_sets
|
dict[str, str or Path]
|
Label → BED file path. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
Rows are exclusive Venn regions; columns are |
Examples:
>>> counts = qn.peak_overlap({
... "ATAC": "peaks/atac/ATAC-SEM-1.bed",
... "CUT&TAG": "peaks/cat/CAT-HSC_H3K27ac.bed",
... })
Source code in quantnado/analysis/core.py
venn_peaks
¶
venn_peaks(
peak_sets: "dict[str, str | Path]",
ax: "plt.axes.Axes | None" = None,
title: "str | None" = None,
colors: "list[str] | None" = None,
alpha: float = 0.5,
figsize: "tuple[float, float]" = (5.5, 5.5),
) -> "plt.axes.Axes"
Venn diagram for 2 or 3 peak sets.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
peak_sets
|
dict[str, str or Path]
|
Label → BED file path. Must have exactly 2 or 3 entries. |
required |
ax
|
Axes
|
|
None
|
title
|
str
|
|
None
|
colors
|
list of str
|
|
None
|
alpha
|
float
|
|
0.5
|
figsize
|
tuple
|
|
(5.5, 5.5)
|
Returns:
| Type | Description |
|---|---|
Axes
|
|
Examples:
>>> ax = qn.venn_peaks(
... {"ATAC": "peaks/atac/SEM-1.bed", "ChIP": "peaks/chip/SEM-1.bed"},
... title="Peak overlap",
... )
Source code in quantnado/analysis/core.py
combine
classmethod
¶
combine(
src: Path | str,
output: Path | str,
overwrite: bool = True,
n_workers: int = 1,
) -> "QuantNadoDataset"
Combine a directory of per-sample zarrs into a single multi-sample zarr.
Only completed stores are included. Same-assay arrays are stacked
along axis 0: (1, chrom_len) × N → (N, chrom_len).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
src
|
Path | str
|
Directory containing per-sample |
required |
output
|
Path | str
|
Path for the combined |
required |
overwrite
|
bool
|
Delete |
True
|
n_workers
|
int
|
Number of thread workers for row-copy tasks. |
1
|
Source code in quantnado/analysis/core.py
1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 | |
reduce
¶
reduce(
intervals_path: "str | None" = None,
ranges_df=None,
gtf_path: "str | None" = None,
feature_type: "str | None" = None,
reduction: str = "mean",
assay: "str | Sequence[str] | None" = None,
samples: "str | Sequence[str] | None" = None,
modality: "str | Sequence[str] | None" = None,
**kwargs,
)
Reduce signal over genomic intervals.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
intervals_path
|
'str | None'
|
Path to a BED or GTF file. |
None
|
ranges_df
|
Pre-parsed ranges DataFrame / PyRanges. |
None
|
|
gtf_path
|
'str | None'
|
GTF file path (used with feature_type). |
None
|
feature_type
|
'str | None'
|
Feature type (e.g. |
None
|
reduction
|
str
|
One of |
'mean'
|
assay
|
'str | Sequence[str] | None'
|
Restrict to samples of this assay type. |
None
|
samples
|
'str | Sequence[str] | None'
|
Explicit sample names (overrides assay). |
None
|
modality
|
'str | Sequence[str] | None'
|
Zarr array key (e.g. |
None
|
Returns:
| Type | Description |
|---|---|
Dataset
|
|
Source code in quantnado/analysis/core.py
count_features
¶
count_features(
gtf_file: "str | None" = None,
bed_file: "str | None" = None,
ranges_df=None,
feature_type: str = "gene",
engine: str = "signal",
assay: "str | Sequence[str] | None" = None,
samples: "str | Sequence[str] | None" = None,
modality: "str | Sequence[str] | None" = None,
**kwargs,
)
Count or quantify genomic features into a feature-by-sample matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gtf_file
|
'str | None'
|
Path to GTF file. |
None
|
bed_file
|
'str | None'
|
Path to BED file. |
None
|
ranges_df
|
Pre-parsed ranges DataFrame. |
None
|
|
feature_type
|
str
|
GTF feature level (default |
'gene'
|
engine
|
str
|
Counting backend.
|
'signal'
|
assay
|
'str | Sequence[str] | None'
|
Restrict to samples of this assay type. |
None
|
samples
|
'str | Sequence[str] | None'
|
Explicit sample names (overrides assay). |
None
|
modality
|
'str | Sequence[str] | None'
|
Zarr array key hint (e.g. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[DataFrame, DataFrame]
|
(counts_df, feature_metadata) |
Source code in quantnado/analysis/core.py
2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 | |
quantify_signal
¶
quantify_signal(
gtf_file: "str | None" = None,
bed_file: "str | None" = None,
ranges_df=None,
feature_type: str = "gene",
assay: "str | Sequence[str] | None" = None,
samples: "str | Sequence[str] | None" = None,
modality: "str | Sequence[str] | None" = None,
return_metadata: bool = True,
**kwargs,
)
Quantify stored signal over genomic features.
This is the explicit signal-based alternative to BAM-backed counting.
Internally it reuses the current count_features(engine="signal")
implementation and is intended for exploratory analysis, clustering,
PCA, and assay-agnostic feature summarisation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gtf_file
|
'str | None'
|
Same feature selection inputs accepted by :meth: |
None
|
bed_file
|
'str | None'
|
Same feature selection inputs accepted by :meth: |
None
|
ranges_df
|
'str | None'
|
Same feature selection inputs accepted by :meth: |
None
|
feature_type
|
'str | None'
|
Same feature selection inputs accepted by :meth: |
None
|
assay
|
'str | Sequence[str] | None'
|
Restrict to samples of this assay type. |
None
|
samples
|
'str | Sequence[str] | None'
|
Explicit sample names (overrides assay). |
None
|
modality
|
'str | Sequence[str] | None'
|
Concrete zarr array key to quantify, for example |
None
|
return_metadata
|
bool
|
If True (default), return |
True
|
Returns:
| Type | Description |
|---|---|
DataFrame | tuple[DataFrame, DataFrame]
|
Feature-by-sample quantified matrix, optionally with aligned feature metadata. |
Source code in quantnado/analysis/core.py
normalise
¶
normalise(
data=None,
method: str = "cpm",
assay: "str | Sequence[str] | None" = None,
samples: "str | Sequence[str] | None" = None,
library_sizes=None,
feature_lengths=None,
)
Normalise coverage signal or feature counts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
xr.Dataset, xr.DataArray, or pd.DataFrame. |
None
|
|
method
|
str
|
|
'cpm'
|
assay
|
'str | Sequence[str] | None'
|
Pre-filter data to samples of this assay type. |
None
|
samples
|
'str | Sequence[str] | None'
|
Explicit sample names (overrides assay). |
None
|
library_sizes
|
Total mapped reads per sample; auto-read from store if omitted. |
None
|
|
feature_lengths
|
Required for |
None
|
Source code in quantnado/analysis/core.py
library_sizes
¶
library_sizes(
assay: "str | Sequence[str] | None" = None,
samples: "str | Sequence[str] | None" = None,
)
Return total mapped reads per sample as a pd.Series.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
assay
|
'str | Sequence[str] | None'
|
Restrict to samples of this assay type. |
None
|
samples
|
'str | Sequence[str] | None'
|
Explicit sample names (overrides assay). |
None
|
Source code in quantnado/analysis/core.py
pca
¶
pca(
data_or_query=None,
n_components: int = 5,
assay: "str | Sequence[str] | None" = None,
samples: "str | Sequence[str] | None" = None,
modality: "str | Sequence[str] | None" = None,
chromosome: "str | None" = None,
nan_handling_strategy: str = "drop",
standardize: bool = False,
random_state: "int | None" = None,
subset_size: "int | None" = None,
subset_strategy: str = "random",
)
Run PCA on reduced genomic signal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_or_query
|
Either a 2D DataArray, a chromosome name string, or |
None
|
|
n_components
|
int
|
Number of principal components. |
5
|
assay
|
'str | Sequence[str] | None'
|
Pre-filter samples before PCA. |
None
|
samples
|
'str | Sequence[str] | None'
|
Explicit sample names (overrides assay). |
None
|
Returns:
| Type | Description |
|---|---|
tuple[PCA, DataArray]
|
|
Source code in quantnado/analysis/core.py
2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 | |
pca_scree
¶
pca_scatter
¶
Scatter plot of PCA-transformed samples.
Source code in quantnado/analysis/core.py
metaplot
¶
metaplot(
data,
data_rev=None,
*,
assay: "str | Sequence[str] | None" = None,
samples: "str | Sequence[str] | None" = None,
modality: "str | Sequence[str] | None" = None,
**kwargs,
)
Plot a metagene profile. See :func:quantnado.analysis.plot.metaplot.
Source code in quantnado/analysis/core.py
tornadoplot
¶
tornadoplot(
data,
data_rev=None,
*,
assay: "str | Sequence[str] | None" = None,
samples: "str | Sequence[str] | None" = None,
modality: "str | Sequence[str] | None" = None,
**kwargs,
)
Tornado / heatmap plot. See :func:quantnado.analysis.plot.tornadoplot.
Source code in quantnado/analysis/core.py
heatmap
¶
heatmap(
data,
*,
assay: "str | Sequence[str] | None" = None,
samples: "str | Sequence[str] | None" = None,
exclude_zeros: bool = False,
zscore: "int | None" = None,
**kwargs,
)
Heatmap of reduced signal. See :func:quantnado.analysis.plot.heatmap.
Source code in quantnado/analysis/core.py
correlate
¶
correlate(
data,
*,
assay: "str | Sequence[str] | None" = None,
samples: "str | Sequence[str] | None" = None,
**kwargs,
)
Compute and plot sample correlation. See :func:quantnado.analysis.plot.correlate.
Source code in quantnado/analysis/core.py
locus_plot
¶
locus_plot(
locus,
sample_names,
modality=None,
assay: "str | Sequence[str] | None" = None,
**kwargs,
)
Plot a genomic locus. See :func:quantnado.analysis.plot.locus_plot.
Source code in quantnado/analysis/core.py
extract_region
¶
Extract a genomic region as an xr.DataArray for plotnado coverage tracks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
region
|
str
|
Genomic region string, e.g. |
required |
samples
|
Sample name(s) to include. |
None
|
|
array_key
|
'str | None'
|
Explicit zarr array key (e.g. |
None
|
Source code in quantnado/analysis/core.py
normalised
¶
normalised(
method: str = "cpm",
library_sizes: "pd.Series | dict | None" = None,
) -> "NormalisedQuantNadoDataset"
Compatibility alias for :meth:normalise with data=None.
Source code in quantnado/analysis/core.py
info_of
¶
Return a compact summary for xarray / pandas objects.