Edit on GitHub

parascape.spaces.human

Build human gene records from measured source genes, keeping protein links separate.

This foundation does not relabel the installed host protein table or activate a gene pack. GENCODE pseudoautosomal Y records retain their qualified source identity and cannot overwrite the corresponding ordinary Ensembl gene's measurements.

GENE = re.compile('ENSG\\d{11}')
SOURCE_GENE = re.compile('(ENSG\\d{11})\\.(\\d+)(_PAR_Y)?')
PROTEIN = re.compile('(?:[OPQ][0-9][A-Z0-9]{3}[0-9]|[A-NR-Z][0-9](?:[A-Z][A-Z0-9]{2}[0-9]){1,2})')
FIELDS = {'Cells_Cultured_fibroblasts': 'gtex_fibroblast_median_tpm', 'Liver_Hepatocyte': 'gtex_lcm_hepatocyte_median_tpm'}
HUMAN_SPACE = Space(code='Hs', species='Homo sapiens', reference='GTEx v10 / GENCODE 39 / GRCh38', kind='host', gene_regex='ENSG\\d{11}', prefixes=('ENSG',), database='Ensembl', record_url='https://www.ensembl.org/Homo_sapiens/Gene/Summary?g={id}', nodes='hs_gene_nodes.parquet', graph='hs_gene_graph.npz', host_bridges='', partner='', orthomcl='', contexts=frozenset({'Cells_Cultured_fibroblasts', 'Liver_Hepatocyte'}), targets=(), numbers=('gtex_fibroblast_median_tpm', 'gtex_lcm_hepatocyte_median_tpm'), hosts=(), vectors=(), distribution='pack')
@dataclass(frozen=True)
class HumanGeneBuild:

Source records, canonical gene rows and explicit many-to-many protein cross-references.

HumanGeneBuild( nodes: pandas.DataFrame, source_records: pandas.DataFrame, protein_links: pandas.DataFrame, gene_mapping: pandas.DataFrame, mapping_summary: dict)
nodes: pandas.DataFrame
source_records: pandas.DataFrame
gene_mapping: pandas.DataFrame
mapping_summary: dict
def read_gtex_gene_records(path) -> pandas.DataFrame:

Read both selected TPM summaries exactly, checking IDs and declared GCT dimensions.

Python float conversion rounds the original text to binary64 without pandas' fast-parser rounding. Genuine zero is retained; explicit missing tokens remain NaN. Source rows are one-based physical line numbers, including GCT headers.

def build_gene_foundation(source_records, protein_links) -> HumanGeneBuild:

Keep source gene measurements and quantify mapping ambiguity without projection.