Dimensions ¶
ndarray.ndim : the number of axes (dimensions) of the array.
1 ¶
One-dimensional arrays are for data in a sequence. Many of these examples contain a single sample of the data, where you would have many samples in real-world data.
Genomic sequences : DNA, RNA, or protein sequences can be represented as arrays of characters or numerical codes.
np.array(['A', 'C', 'G', 'T', 'A', 'T', 'C', 'G'])
Gene expression levels : Quantitative measurements of gene expression across different samples.
np.array([23.5, 30.2, 18.8, 40.1, 15.6])
Amino acid properties : Numeric data representing properties of amino acids in protein structures.
np.array([135.5, 72.3, 18.9, 55.6])
Signal intensity : Experimental data such as microarray or sequencing signal intensities.
np.array([120, 90, 150, 200, 180])
Phylogenetic trees : Hierarchical relationships among species or genes.
np.array([0.2, 0.5, 0.8, 1.2])
Molecular weights : Mass spectrometry data, including molecular weights of biomolecules.
np.array([150.3, 200.5, 180.8, 220.1, 195.4])
Time-series : Temporal data related to biological processes or experimental measurements.
np.array([25.6, 30.2, 28.8, 32.1, 29.6])
Population genetics : Allele frequencies, genetic diversity, or other population genetics metrics.
np.array([0.3, 0.5, 0.2, 0.4, 0.6])
Sequence alignments : Results of sequence alignment algorithms, such as scores or identity percentages.
np.array([80, 95, 88, 92, 78])
2 ¶
2D NumPy arrays are often used to represent data that involves multiple dimensions or attributes.
Gene Expression Matrix : Each row represents a gene, and each column represents a sample. The values in the matrix are the expression levels of genes across different samples.
np.array([
# Sample 0, Sample 1, Sample 2, Sample 3
[23.5, 30.2, 18.8, 40.1, 15.6], # Gene 0
[15.2, 22.0, 19.5, 35.8, 28.1], # Gene 1
[30.0, 28.5, 32.2, 25.9, 21.4] # Gene 2
])
Genomic Variants Matrix : Each row represents a genomic position, and each column represents an individual. The values indicate the presence (1) or absence (0) of a variant.
np.array([
[0, 1, 0, 1, 1],
[1, 0, 1, 0, 0],
[0, 1, 1, 1, 0]
])
Protein Structure Coordinates : Each row represents an amino acid, and each column represents the coordinates (x, y, z) of that amino acid in a protein structure.
np.array([
[12.3, 8.5, 20.1],
[15.0, 9.2, 18.8],
[18.5, 11.3, 22.0]
])
Population Genetics Data Matrix : Each row represents an individual, and each column represents a genetic marker. The values are the allele frequencies for each marker in each individual.
np.array([
[0.3, 0.5, 0.2, 0.4, 0.6],
[0.2, 0.4, 0.1, 0.3, 0.7],
[0.5, 0.6, 0.3, 0.2, 0.4]
])
Sequence Alignment Scores Matrix : Each row and column represent sequences, and the values are the alignment scores between pairs of sequences.
np.array([
[80, 95, 88, 92, 78],
[75, 85, 90, 89, 82],
[85, 88, 92, 91, 80]
])
3 ¶
Molecular Structures: Protein structures: 3D coordinates of atoms in a protein. DNA or RNA structures: Helical structures and positions of nucleotides. Small molecule structures: 3D coordinates of atoms in chemical compounds.
Medical Imaging: MRI scans: Voxel-based representation of tissues in three dimensions. CT scans: 3D arrays of X-ray attenuation coefficients for different tissues.
Genomic Data: 3D arrays can be used to represent genomic data, where each axis may represent different genomic features (e.g., chromosomes, genes, and samples).
Spatial Transcriptomics: Gene expression data with spatial information, representing expression levels across a spatial grid.
Molecular Dynamics Simulations: Simulation data of biomolecular systems, where each dimension represents different spatial coordinates and time steps.
Electron Microscopy Data: High-resolution imaging data of cellular structures, represented as a 3D array.
Proteomics: Mass spectrometry data where one dimension represents different mass-to-charge ratios, another dimension represents retention time, and the third dimension represents intensity.
Phylogenetic Data: Evolutionary relationships represented in 3D space, considering species, traits, and time.
This means we have an
x
and
y
axis.