From 788e0f9a0d26d74f6c92c1002afdb9947295396a Mon Sep 17 00:00:00 2001 From: Mike Archbold Date: Mon, 16 Dec 2024 11:25:55 -0800 Subject: [PATCH] comments --- .../loaders/genome/flybase_induced_types.pl | 623 +++++++++++++++++- 1 file changed, 609 insertions(+), 14 deletions(-) diff --git a/libraries/loaders/genome/flybase_induced_types.pl b/libraries/loaders/genome/flybase_induced_types.pl index 83af0993af1..aac9ddcdda4 100644 --- a/libraries/loaders/genome/flybase_induced_types.pl +++ b/libraries/loaders/genome/flybase_induced_types.pl @@ -1,3 +1,65 @@ +/* + * Project: MeTTaLog - A MeTTa to Prolog Transpiler/Interpreter + * Description: This file is part of the source code for a transpiler designed to convert + * MeTTa language programs into Prolog, utilizing the SWI-Prolog compiler for + * optimizing and transforming function/logic programs. It handles different + * logical constructs and performs conversions between functions and predicates. + * + * Author: Douglas R. Miles + * Contact: logicmoo@gmail.com / dmiles@logicmoo.org + * License: LGPL + * Repository: https://github.com/trueagi-io/metta-wam + * https://github.com/logicmoo/hyperon-wam + * Created Date: 8/23/2023 + * Last Modified: $LastChangedDate$ # You will replace this with Git automation + * + * Usage: This file is a part of the transpiler that transforms MeTTa programs into Prolog. For details + * on how to contribute or use this project, please refer to the repository README or the project documentation. + * + * Contribution: Contributions are welcome! For contributing guidelines, please check the CONTRIBUTING.md + * file in the repository. + * + * Notes: + * - Ensure you have SWI-Prolog installed and properly configured to use this transpiler. + * - This project is under active development, and we welcome feedback and contributions. + * + * Acknowledgments: Special thanks to all contributors and the open source community for their support and contributions. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +%********************************************************************************************* +% PROGRAM FUNCTION: Performs type induction, schema inference, and logical reasoning to dynamically +% query, integrate, and analyze biological datasets, often listing equivalent SQL versions for reference. +%********************************************************************************************* + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% IMPORTANT: DO NOT DELETE COMMENTED-OUT CODE AS IT MAY BE UN-COMMENTED AND USED +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + @@ -56,15 +118,44 @@ +%! linked_mutations(+Publication1, +Mutation1, +Publication2, +Mutation2) is nondet. +% +% Identifies linked mutations that are associated with the same publication. +% +% This predicate establishes a relationship between two mutations (Mutation1 +% and Mutation2) that are linked through the same publication. It ensures that +% the mutations are distinct, both in terms of their IDs and their content, while +% also checking that they appear in the same publication. +% +% @arg Publication1 The first publication associated with Mutation1. +% @arg Mutation1 The first mutation to be linked. +% @arg Publication2 The second publication associated with Mutation2. +% @arg Mutation2 The second mutation to be linked. +% +% @examples +% % Find linked mutations: +% ?- linked_mutations('Pub1', 'MutationA', 'Pub1', 'MutationB'). +% Publication1 = 'Pub1', +% Mutation1 = 'MutationA', +% Publication2 = 'Pub1', +% Mutation2 = 'MutationB'. +% linked_mutations(Publication1, Mutation1, Publication2, Mutation2) :- + % Retrieve the mutation ID associated with Mutation1. mutation(M1_id, Mutation1), + % Get the publication ID for Mutation1. mutation_publication(M1_id, MP1_id), + % Map the publication ID to its corresponding publication. publication(MP1_id, Publication1), + % Retrieve the mutation ID associated with Mutation2. mutation_publication(M2_id, MP2_id), mutation(M2_id, Mutation2), + % Map the publication ID to its corresponding publication. publication(MP2_id, Publication2), + % Ensure that the two mutations are distinct by ID and content. M1_id \= M2_id, Mutation1 \= Mutation2, + % Ensure the two mutations share the same publication ID. MP1_id = MP2_id. /* @@ -83,18 +174,52 @@ +%! related_genes_publication(+Gene1, +Mutation1, +Gene2, +Mutation2, +Title) is nondet. +% +% Finds related genes and their associated mutations based on shared publications. +% +% This predicate identifies pairs of genes (Gene1 and Gene2) and their associated +% mutations (Mutation1 and Mutation2) that are linked by the same publication (Title). +% It ensures the two genes are distinct and considers them related if they share +% the same function or pathway. +% +% @arg Gene1 The name of the first gene. +% @arg Mutation1 The name of the mutation associated with Gene1. +% @arg Gene2 The name of the second gene. +% @arg Mutation2 The name of the mutation associated with Gene2. +% @arg Title The title of the publication linking the genes and mutations. +% +% @examples +% % Example query to find related genes and mutations: +% ?- related_genes_publication('GeneA', 'MutationX', 'GeneB', 'MutationY', 'Some Publication'). +% Gene1 = 'GeneA', +% Mutation1 = 'MutationX', +% Gene2 = 'GeneB', +% Mutation2 = 'MutationY', +% Title = 'Some Publication'. +% related_genes_publication(Gene1, Mutation1, Gene2, Mutation2, Title) :- + % Retrieve details of the first gene, including its ID, name, function, and pathway. gene(G1_id, Gene1, Function1, Pathway1), + % Retrieve details of the mutation associated with the first gene. mutation(M1_id, Mutation1), + % Link the mutation to the first gene. mutation_gene(M1_id, G1_id), + % Retrieve the publication ID and title for the mutation. mutation_publication(M1_id, MP1_id), publication(MP1_id, Title), + % Retrieve details of the second gene, including its ID, name, function, and pathway. gene(G2_id, Gene2, Function2, Pathway2), + % Retrieve details of the mutation associated with the second gene. mutation(M2_id, Mutation2), + % Link the mutation to the second gene. mutation_gene(M2_id, G2_id), + % Retrieve the publication ID and title for the mutation. mutation_publication(M2_id, MP2_id), publication(MP2_id, Title), + % Ensure the two genes are distinct. G1_id \= G2_id, + % Consider the genes related if they share the same function or pathway. (Function1 = Function2; Pathway1 = Pathway2). /* @@ -113,23 +238,50 @@ */ - +%! linked_phenotypes(+Publication, +Mutation1, +Phenotype1, +Mutation2, +Phenotype2) is nondet. +% +% Finds mutations and their associated phenotypes linked through a common publication. +% +% This predicate identifies pairs of mutations (Mutation1 and Mutation2) and their +% associated phenotypes (Phenotype1 and Phenotype2) that are discussed in the same +% publication. It ensures that the two mutations are distinct. +% +% @arg Publication The title of the publication linking the mutations and phenotypes. +% @arg Mutation1 The name of the first mutation. +% @arg Phenotype1 The phenotype associated with the first mutation. +% @arg Mutation2 The name of the second mutation. +% @arg Phenotype2 The phenotype associated with the second mutation. +% +% @examples +% % Example query to find linked phenotypes: +% ?- linked_phenotypes('Shared Publication', 'MutationA', 'PhenotypeX', 'MutationB', 'PhenotypeY'). +% Publication = 'Shared Publication', +% Mutation1 = 'MutationA', +% Phenotype1 = 'PhenotypeX', +% Mutation2 = 'MutationB', +% Phenotype2 = 'PhenotypeY'. +% linked_phenotypes(Publication, Mutation1, Phenotype1, Mutation2, Phenotype2) :- + % Retrieve the ID of the first mutation. mutation(M1_id, Mutation1), + % Link the first mutation to its associated phenotype. mutation_phenotype(M1_id, P1_id), phenotype(P1_id, Phenotype1), + % Retrieve the publication ID and title for the first mutation. mutation_publication(M1_id, MP1_id), publication(MP1_id, Publication), + % Retrieve the publication ID and details for the second mutation. mutation_publication(M2_id, MP2_id), mutation(M2_id, Mutation2), + % Link the second mutation to its associated phenotype. mutation_phenotype(M2_id, P2_id), phenotype(P2_id, Phenotype2), + % Ensure the second mutation is linked to the same publication. publication(MP2_id, Publication), + % Ensure the two mutations are distinct. M1_id \= M2_id. - - /* Gene Expression and Phenotypes @@ -143,13 +295,36 @@ WHERE Expression.tissue = 'wing disc' AND Phenotype.description LIKE '%wing defects%' */ - - +%! gene_expression_phenotype(+GeneName, +Tissue, +PhenotypeDescription) is nondet. +% +% Identifies genes expressed in a specific tissue and their associated phenotypes. +% +% This predicate finds genes (GeneName) that are expressed in the tissue 'wing disc' +% and retrieves their associated phenotypes (PhenotypeDescription) that include +% the term 'wing defects' in their description. +% +% @arg GeneName The name of the gene being queried. +% @arg Tissue The tissue where the gene is expressed (must be 'wing disc'). +% @arg PhenotypeDescription The description of the phenotype associated with the gene, +% which must contain the substring 'wing defects'. +% +% @examples +% % Example query to find genes with 'wing defects' phenotypes in the 'wing disc': +% ?- gene_expression_phenotype('GeneX', Tissue, Description). +% GeneName = 'GeneX', +% Tissue = 'wing disc', +% PhenotypeDescription = 'wing defects observed in mutants'. +% gene_expression_phenotype(GeneName, Tissue, PhenotypeDescription) :- + % Retrieve the ID of the gene and match its name. gene(GeneId, GeneName), + % Check the tissue where the gene is expressed. expression(GeneId, Tissue), + % Ensure the tissue is specifically 'wing disc'. Tissue = 'wing disc', + % Retrieve the phenotype description associated with the gene. phenotype(GeneId, PhenotypeDescription), + % Check that the phenotype description contains the substring 'wing defects'. sub_string(PhenotypeDescription, _, _, _, 'wing defects'). /* @@ -164,13 +339,34 @@ */ - +%! protein_interaction(+ProteinName1, +ProteinName2) is nondet. +% +% Identifies interactions involving a specific protein of interest. +% +% This predicate finds pairs of proteins (ProteinName1 and ProteinName2) where +% ProteinName1 is a predefined 'protein_of_interest' and ProteinName2 interacts +% with it. The interaction is defined by the relationship between their protein IDs. +% +% @arg ProteinName1 The name of the first protein (must be 'protein_of_interest'). +% @arg ProteinName2 The name of the second protein interacting with ProteinName1. +% +% @examples +% % Example query to find proteins interacting with 'protein_of_interest': +% ?- protein_interaction('protein_of_interest', InteractingProtein). +% ProteinName1 = 'protein_of_interest', +% ProteinName2 = 'InteractingProteinX'. +% protein_interaction(ProteinName1, ProteinName2) :- + % Retrieve the ID of the first protein and match its name. protein(Protein1Id, ProteinName1), + % Ensure that the first protein is the 'protein_of_interest'. ProteinName1 = 'protein_of_interest', + % Find interactions involving the first protein's ID. interaction(Protein1Id, Protein2Id), + % Retrieve the name of the interacting protein. protein(Protein2Id, ProteinName2). + /* Genetic Modifiers of a Mutation SQL Version: @@ -184,12 +380,39 @@ */ - +%! genetic_modifier(+ModifierGeneName, +MutationName, +PhenotypeDescription) is nondet. +% +% Identifies genetic modifiers of a specific mutation and their impact on phenotype. +% +% This predicate finds genes (ModifierGeneName) that act as genetic modifiers +% for a specific mutation (MutationName). It also retrieves the associated +% phenotype (PhenotypeDescription) modified by the mutation. The mutation is +% restricted to the one named 'specific_mutation'. +% +% The logic corresponds to an SQL query that joins gene, genetic interaction, +% mutation, and phenotype tables to identify relevant genetic modifiers. +% +% @arg ModifierGeneName The name of the gene acting as a genetic modifier. +% @arg MutationName The name of the mutation being modified (must be 'specific_mutation'). +% @arg PhenotypeDescription The description of the phenotype modified by the mutation. +% +% @examples +% % Example query to find genetic modifiers of 'specific_mutation': +% ?- genetic_modifier(ModifierGene, 'specific_mutation', Phenotype). +% ModifierGeneName = 'ModifierGeneX', +% MutationName = 'specific_mutation', +% PhenotypeDescription = 'PhenotypeY'. +% genetic_modifier(ModifierGeneName, MutationName, PhenotypeDescription) :- + % Retrieve the ID and name of the genetic modifier gene. gene(ModifierGeneId, ModifierGeneName), + % Find the genetic interaction linking the modifier gene to a mutation. genetic_interaction(ModifierGeneId, MutationId), + % Retrieve the ID and name of the mutation. mutation(MutationId, MutationName), + % Restrict to the specific mutation of interest. MutationName = 'specific_mutation', + % Retrieve the phenotype associated with the mutation. phenotype(MutationId, PhenotypeDescription). /* @@ -202,11 +425,32 @@ WHERE Gene.name IN ('gene1', 'gene2', 'gene3') */ - - +%! gene_go_annotation(+GeneName, +GOTerm, +GODescription) is nondet. +% +% Retrieves Gene Ontology (GO) annotations for a specific set of genes. +% +% This predicate identifies GO annotations (GOTerm and GODescription) associated +% with a given set of genes. The genes are restricted to a predefined list +% ('gene1', 'gene2', 'gene3'). The logic corresponds to an SQL query that +% joins gene and GO annotation tables with a filter on gene names. +% +% @arg GeneName The name of the gene for which GO annotations are retrieved. +% @arg GOTerm The Gene Ontology term associated with the gene. +% @arg GODescription A description of the Gene Ontology term. +% +% @examples +% % Example query to find GO annotations for specific genes: +% ?- gene_go_annotation(Gene, GOTerm, Description). +% GeneName = 'gene1', +% GOTerm = 'GO:0001234', +% GODescription = 'Some biological process'. +% gene_go_annotation(GeneName, GOTerm, GODescription) :- + % Retrieve the ID and name of the gene. gene(GeneId, GeneName), + % Ensure the gene name is one of the specified set. fb-member(GeneName, ['gene1', 'gene2', 'gene3']), + % Retrieve the associated GO term and its description. go_annotation(GeneId, GOTerm, GODescription). @@ -229,14 +473,45 @@ */ - +%! gene_allele_disease(+GeneName, +AlleleName, -HumanDisease) is nondet. +% +% Identifies alleles of a specific gene and their associated diseases. +% +% This predicate finds alleles (AlleleName) linked to a specific gene (GeneName) +% and retrieves the associated human disease (HumanDisease). If no disease is +% associated with an allele, the HumanDisease is set to 'No associated disease'. +% The logic corresponds to an SQL query that performs a left join between the +% gene, allele, and disease tables, filtered by a specific gene name. +% +% @arg GeneName The name of the gene being queried (must be 'target_gene_name'). +% @arg AlleleName The name of the allele associated with the gene. +% @arg HumanDisease The human disease associated with the allele, or 'No associated disease'. +% +% @examples +% % Example query to find alleles and diseases for the target gene: +% ?- gene_allele_disease('target_gene_name', AlleleName, HumanDisease). +% GeneName = 'target_gene_name', +% AlleleName = 'AlleleX', +% HumanDisease = 'DiseaseY'. +% +% % Example result for an allele with no associated disease: +% GeneName = 'target_gene_name', +% AlleleName = 'AlleleZ', +% HumanDisease = 'No associated disease'. +% gene_allele_disease(GeneName, AlleleName, HumanDisease) :- + % Retrieve the ID and name of the target gene. gene(GeneId, GeneName), + % Ensure the gene is 'target_gene_name'. GeneName = 'target_gene_name', + % Retrieve the ID and name of the allele associated with the gene. allele(GeneId, AlleleId, AlleleName), + % Attempt to find a disease associated with the allele. ( disease(AlleleId, HumanDisease) + % If no disease is associated, set to 'No associated disease'. ; HumanDisease = 'No associated disease'). + /* Transcription Factors Regulating a Gene @@ -250,10 +525,36 @@ +%! transcription_factor_regulation(+TranscriptionFactorName, +TargetGeneName, +RegulationType) is nondet. +% +% Identifies transcription factors that regulate a specific target gene. +% +% This predicate finds transcription factors (TranscriptionFactorName) that regulate +% a specific target gene (TargetGeneName) and retrieves the type of regulation +% (RegulationType). The target gene is restricted to the one named 'specific_target_gene'. +% +% The logic corresponds to an SQL query that joins the gene and gene regulation tables +% to identify transcription factors and their regulatory relationships. +% +% @arg TranscriptionFactorName The name of the transcription factor. +% @arg TargetGeneName The name of the target gene being regulated (must be 'specific_target_gene'). +% @arg RegulationType The type of regulation (e.g., activation, repression). +% +% @examples +% % Example query to find transcription factors regulating 'specific_target_gene': +% ?- transcription_factor_regulation(TranscriptionFactor, 'specific_target_gene', RegulationType). +% TranscriptionFactorName = 'TF1', +% TargetGeneName = 'specific_target_gene', +% RegulationType = 'activation'. +% transcription_factor_regulation(TranscriptionFactorName, TargetGeneName, RegulationType) :- + % Retrieve the ID and name of the transcription factor. gene(TranscriptionFactorId, TranscriptionFactorName), + % Find the regulation linking the transcription factor to the target gene. gene_regulation(TranscriptionFactorId, TargetGeneId, RegulationType), + % Retrieve the ID and name of the target gene. gene(TargetGeneId, TargetGeneName), + % Restrict the target gene to 'specific_target_gene'. TargetGeneName = 'specific_target_gene'. /* @@ -269,11 +570,36 @@ */ - +%! mutation_publication_info(+MutationName, +Title, +Authors) is nondet. +% +% Retrieves publications associated with a specific gene mutation. +% +% This predicate finds publications (Title and Authors) that are related to a +% specific mutation (MutationName). The mutation is restricted to the one named +% 'specific_mutation_name'. +% +% The logic corresponds to an SQL query that joins the mutation, mutation publication, +% and publication tables to identify relevant publications for the specified mutation. +% +% @arg MutationName The name of the mutation being queried (must be 'specific_mutation_name'). +% @arg Title The title of the publication associated with the mutation. +% @arg Authors The authors of the publication associated with the mutation. +% +% @examples +% % Example query to find publications related to 'specific_mutation_name': +% ?- mutation_publication_info('specific_mutation_name', Title, Authors). +% MutationName = 'specific_mutation_name', +% Title = 'Significant Research on Mutation', +% Authors = 'Author1, Author2, Author3'. +% mutation_publication_info(MutationName, Title, Authors) :- + % Retrieve the ID and name of the mutation. mutation(MutationId, MutationName), + % Restrict the mutation to 'specific_mutation_name'. MutationName = 'specific_mutation_name', + % Link the mutation to its associated publication ID. mutation_publication(MutationId, PublicationId), + % Retrieve the title and authors of the publication. publication(PublicationId, Title, Authors). /* @@ -290,10 +616,36 @@ +%! rnai_knockdown_phenotype(+GeneName, +RNAiDescription, +PhenotypeDescription) is nondet. +% +% Identifies the effects of RNAi knockdown on phenotypes for a specific gene. +% +% This predicate finds RNAi experiments (RNAiDescription) and their associated +% phenotypes (PhenotypeDescription) for a specific gene (GeneName). The query +% is restricted to the gene named 'gene_of_interest'. +% +% The logic corresponds to an SQL query that joins the gene, RNAi experiment, +% and phenotype tables to identify the RNAi knockdown effects for the specified gene. +% +% @arg GeneName The name of the gene being queried (must be 'gene_of_interest'). +% @arg RNAiDescription The description of the RNAi experiment associated with the gene. +% @arg PhenotypeDescription The description of the phenotype resulting from the RNAi experiment. +% +% @examples +% % Example query to find RNAi knockdown effects for 'gene_of_interest': +% ?- rnai_knockdown_phenotype('gene_of_interest', RNAiDesc, PhenotypeDesc). +% GeneName = 'gene_of_interest', +% RNAiDescription = 'Knockdown of gene in tissue X', +% PhenotypeDescription = 'Phenotype Y observed'. +% rnai_knockdown_phenotype(GeneName, RNAiDescription, PhenotypeDescription) :- + % Retrieve the ID and name of the gene. gene(GeneId, GeneName), + % Restrict the query to the specific gene of interest. GeneName = 'gene_of_interest', + % Retrieve the RNAi experiment details linked to the gene. rnai_experiment(GeneId, RNAiId, RNAiDescription), + % Retrieve the phenotype associated with the RNAi experiment. phenotype(RNAiId, PhenotypeDescription). @@ -306,9 +658,35 @@ INNER JOIN StockCenter ON Strain.stock_center_id = StockCenter.id WHERE Strain.name LIKE '%desired_trait%' */ + +%! stock_center_info(+StrainName, +StockCenterName, +Location) is nondet. +% +% Retrieves stock center information for specific strains. +% +% This predicate finds stock centers (StockCenterName and Location) associated +% with strains (StrainName) that match a specific trait. The query filters strains +% whose names contain the substring 'desired_trait'. +% +% The logic corresponds to an SQL query that joins the strain and stock center +% tables and applies a filtering condition on strain names. +% +% @arg StrainName The name of the strain being queried (must contain 'desired_trait'). +% @arg StockCenterName The name of the stock center associated with the strain. +% @arg Location The location of the stock center. +% +% @examples +% % Example query to find stock centers for strains with 'desired_trait': +% ?- stock_center_info(StrainName, StockCenterName, Location). +% StrainName = 'StrainX_desired_trait', +% StockCenterName = 'CenterY', +% Location = 'LocationZ'. +% stock_center_info(StrainName, StockCenterName, Location) :- + % Retrieve the ID and name of the strain. strain(StrainId, StrainName), + % Ensure the strain name contains the substring 'desired_trait'. sub_string(StrainName, _, _, _, 'desired_trait'), + % Retrieve the stock center information linked to the strain. stock_center(StrainId, StockCenterId, StockCenterName, Location). @@ -316,7 +694,23 @@ - +%! flybase_tables(-Tables) is det. +% +% Provides a list of tables available in the FlyBase database schema. +% +% This predicate defines a comprehensive list of tables that are part of the FlyBase +% database. FlyBase is a database for Drosophila genetics and molecular biology. +% +% @arg Tables A list of table names representing the FlyBase database schema. +% +% @examples +% % Example query to retrieve all FlyBase tables: +% ?- flybase_tables(Tables). +% Tables = [ +% analysis, analysisfeature, analysisgrp, analysisgrpmember, analysisprop, +% audit_chado, cell_line, cell_line_loaderm, cell_line_loadermprop, ... +% ]. +% flybase_tables([ analysis, analysisfeature, analysisgrp, analysisgrpmember, analysisprop, audit_chado, cell_line, cell_line_loaderm, cell_line_loadermprop, cell_line_dbxref, cell_line_feature, cell_line_library, cell_line_libraryprop, cell_line_pub, cell_line_relationship, cell_line_strain, @@ -367,7 +761,23 @@ table_n_type(pmid_fbgn_uniprot, 4, 'UniprotKB/Swiss-Prot/TrEMBL_accession', _). */ - +%! ncRNA_genes_fb_scheme(-JSONSchema) is det. +% +% Provides the JSON schema for RNAcentral ncRNA objects. +% +% This predicate contains the JSON schema definition for representing ncRNA +% (non-coding RNA) objects in RNAcentral. The schema ensures that the entries +% adhere to specific requirements, such as including primary identifiers, taxon +% IDs, sequence ontology (SO) terms, and DNA sequences. It also includes various +% optional properties like names, descriptions, and cross-references. +% +% @arg JSONSchema A string representing the JSON schema for ncRNA objects. +% +% @examples +% % Example query to retrieve the ncRNA schema: +% ?- ncRNA_genes_fb_scheme(Schema). +% Schema = '{ "$schema": "http://json-schema.org/draft-04/schema#", ... }'. +% ncRNA_genes_fb_scheme( ' { @@ -541,10 +951,40 @@ }'). % #genotype_symbols genotype_FBids phenotype_name phenotype_id qualifier_names qualifier_ids reference + +% 'dynamic' allows runtime changes to the predicate while 'module_transparent' means that +% each goal associated with a transparent-declared predicate will inherit the context module from its parent goal. :- dynamic maybe_corisponds/2. :- dynamic numeric_value_p_n/3. :- module_transparent maybe_corisponds/2. :- module_transparent numeric_value_p_n/3. + +%! column_names(+TableName, -Columns) is det. +% +% Provides the column names for a specific table in the FlyBase schema. +% +% This predicate defines the structure of various tables by listing their column names. +% The `column_names/2` predicate maps the table name (`TableName`) to a list of +% column names (`Columns`) that describe the attributes of each table. Some column +% definitions include compound structures such as `listOf/1` to represent arrays or +% specific formatting details. +% +% @arg TableName The name of the table being queried. +% @arg Columns A list of column names defining the table structure. +% +% @examples +% % Example query to retrieve column names for the 'cyto-genetic-seq' table: +% ?- column_names('cyto-genetic-seq', Columns). +% Columns = ['Cytogenetic_map_position', 'Genetic_map_position', +% 'Sequence_coordinates_(release_6)', 'R6_conversion_notes']. +% +% % Example query to retrieve column names for 'Dmel_enzyme': +% ?- column_names('Dmel_enzyme', Columns). +% Columns = [gene_group_id, gene_group_name, listOf(gene_group_GO_id), +% listOf(gene_group_GO_name), listOf(gene_group_EC_number), +% listOf(gene_group_EC_name), gene_id, gene_symbol, gene_name, +% listOf(gene_EC_number), listOf(gene_EC_name)]. +% column_names('cyto-genetic-seq', ['Cytogenetic_map_position', 'Genetic_map_position', 'Sequence_coordinates_(release_6)', 'R6_conversion_notes']). column_names('Dmel_enzyme', [gene_group_id, gene_group_name, listOf(gene_group_GO_id), listOf(gene_group_GO_name), listOf(gene_group_EC_number), listOf(gene_group_EC_name), gene_id, gene_symbol, gene_name, listOf(gene_EC_number), listOf(gene_EC_name)]). column_names('scRNA-Seq_gene_expression', ['Pub_ID', 'Pub_miniref', 'Clustering_Analysis_ID', 'Clustering_Analysis_Name', 'Source_Tissue_Sex', 'Source_Tissue_Stage', 'Source_Tissue_Anatomy', 'Cluster_ID', 'Cluster_Name', 'Cluster_Cell_Type_ID', 'Cluster_Cell_Type_Name', 'Gene_ID', 'Gene_Symbol', 'Mean_Expression', 'Spread']). @@ -587,10 +1027,106 @@ column_names(physical_interactions_mitab, [listOf('ID_Interactor_A'), listOf('ID_Interactor_B'), listOf('Alt_ID_Interactor_A'), listOf('Alt_ID_Interactor_B'), listOf('Alias_Interactor_A'), listOf('Alias_Interactor_B'), listOf('Interaction_Detection_Method'), listOf('Publication_1st_Author'), listOf('Publication'), 'Taxid_Interactor_A', 'Taxid_Interactor_B', listOf('Interaction_Type'), listOf('Source_Database'), listOf('Interaction_Identifier'), listOf('Confidence_Value'), listOf('Expansion_Method'), listOf('Biological_Role_Interactor_A'), listOf('Biological_Role_Interactor_B'), listOf('Experimental_Role_Interactor_A'), listOf('Experimental_Role_Interactor_B'), listOf('Type_Interactor_A'), listOf('Type_Interactor_B'), listOf('Xref_Interactor_A'), listOf('Xref_Interactor_B'), listOf('Interaction_Xref'), listOf('Annotation_Interactor_A'), listOf('Annotation_Interactor_B'), listOf('Interaction_Annotation'), listOf('Host_Organism'), 'Interaction_Parameters', 'Creation_Date', 'Update_Date', 'Checksum_Interactor_A', 'Checksum_Interactor_B', 'Interaction_Checksum', 'Negative', listOf('Feature_Interactor_A'), listOf('Feature_Interactor_B'), 'Stoichiometry_Interactor_A', 'Stoichiometry_Interactor_B', listOf('Identification_Method_Participant_A'), listOf('Identification_Method_Participant_B')]). column_names(pmid_fbgn_uniprot, ['FBrf', 'PMID', 'FBgn', 'UniProt_database', 'UniProt_id']). column_names(synonym, [primary_FBid, organism_abbreviation, current_symbol, current_fullname, listOf(fullname_synonym), listOf(symbol_synonym)]). + +%! column_names_ext(+TableName, -Columns) is det. +% +% Provides the extended column names for specific tables in the FlyBase schema. +% +% This predicate defines the structure of specific tables by listing their extended +% column names, including additional formatting or structures such as `listOf/2`. +% It expands on the basic `column_names/2` predicate by accommodating more complex +% tables and datasets. +% +% @arg TableName The name of the table being queried. +% @arg Columns A list of extended column names defining the table structure. +% +% @examples +% % Example query to retrieve extended column names for 'gene_genetic_interactions': +% ?- column_names_ext(gene_genetic_interactions, Columns). +% Columns = [listOf('Starting_gene_symbol', ['|']), +% listOf('Starting_gene_FBgn', ['|']), +% listOf('Interacting_gene_symbol', ['|']), +% listOf('Interacting_gene_FBgn', ['|']), +% 'Interaction_type', 'Publication_FBrf']. +% +% % Example query to retrieve extended column names for 'gene_rpkm_matrix': +% ?- column_names_ext(gene_rpkm_matrix, Columns). +% Columns = [gene_primary_id, gene_symbol, gene_fullname, gene_type, +% 'BCM_1_E2-4hr_(FBlc0000061)', 'BCM_1_E14-16hr_(FBlc0000062)', ...]. +% column_names_ext(gene_genetic_interactions, [listOf('Starting_gene_symbol', ['|']), listOf('Starting_gene_FBgn', ['|']), listOf('Interacting_gene_symbol', ['|']), listOf('Interacting_gene_FBgn', ['|']), 'Interaction_type', 'Publication_FBrf']). column_names_ext(gene_rpkm_matrix, [gene_primary_id, gene_symbol, gene_fullname, gene_type, 'BCM_1_E2-4hr_(FBlc0000061)', 'BCM_1_E14-16hr_(FBlc0000062)', 'BCM_1_E2-16hr_(FBlc0000063)', 'BCM_1_E2-16hr100_(FBlc0000064)', 'BCM_1_L3i_(FBlc0000065)', 'BCM_1_L3i100_(FBlc0000066)', 'BCM_1_P3d_(FBlc0000067)', 'BCM_1_FA3d_(FBlc0000068)', 'BCM_1_MA3d_(FBlc0000069)', 'BCM_1_P_(FBlc0000070)', 'BCM_1_L_(FBlc0000071)', 'BCM_1_A17d_(FBlc0000072)', 'mE_mRNA_em0-2hr_(FBlc0000086)', 'mE_mRNA_em2-4hr_(FBlc0000087)', 'mE_mRNA_em4-6hr_(FBlc0000088)', 'mE_mRNA_em6-8hr_(FBlc0000089)', 'mE_mRNA_em8-10hr_(FBlc0000090)', 'mE_mRNA_em10-12hr_(FBlc0000091)', 'mE_mRNA_em12-14hr_(FBlc0000092)', 'mE_mRNA_em14-16hr_(FBlc0000093)', 'mE_mRNA_em16-18hr_(FBlc0000094)', 'mE_mRNA_em18-20hr_(FBlc0000095)', 'mE_mRNA_em20-22hr_(FBlc0000096)', 'mE_mRNA_em22-24hr_(FBlc0000097)', 'mE_mRNA_L1_(FBlc0000098)', 'mE_mRNA_L2_(FBlc0000099)', 'mE_mRNA_L3_12hr_(FBlc0000100)', 'mE_mRNA_L3_PS1-2_(FBlc0000101)', 'mE_mRNA_L3_PS3-6_(FBlc0000102)', 'mE_mRNA_L3_PS7-9_(FBlc0000103)', 'mE_mRNA_WPP_(FBlc0000104)', 'mE_mRNA_P5_(FBlc0000105)', 'mE_mRNA_P6_(FBlc0000106)', 'mE_mRNA_P8_(FBlc0000107)', 'mE_mRNA_P9-10_(FBlc0000108)', 'mE_mRNA_P15_(FBlc0000109)', 'mE_mRNA_AdF_Ecl_1days_(FBlc0000110)', 'mE_mRNA_AdF_Ecl_5days_(FBlc0000111)', 'mE_mRNA_AdF_Ecl_30days_(FBlc0000112)', 'mE_mRNA_AdM_Ecl_1days_(FBlc0000113)', 'mE_mRNA_AdM_Ecl_5days_(FBlc0000114)', 'mE_mRNA_AdM_Ecl_30days_(FBlc0000115)', 'mE_mRNA_A_MateF_1d_head_(FBlc0000207)', 'mE_mRNA_A_MateF_4d_ovary_(FBlc0000208)', 'mE_mRNA_A_MateM_1d_head_(FBlc0000209)', 'mE_mRNA_A_VirF_1d_head_(FBlc0000210)', 'mE_mRNA_A_VirF_4d_head_(FBlc0000211)', 'mE_mRNA_A_MateF_20d_head_(FBlc0000212)', 'mE_mRNA_A_MateF_4d_head_(FBlc0000213)', 'mE_mRNA_A_MateM_20d_head_(FBlc0000214)', 'mE_mRNA_A_MateM_4d_acc_gland_(FBlc0000215)', 'mE_mRNA_A_MateM_4d_head_(FBlc0000216)', 'mE_mRNA_A_MateM_4d_testis_(FBlc0000217)', 'mE_mRNA_A_1d_carcass_(FBlc0000218)', 'mE_mRNA_A_1d_dig_sys_(FBlc0000219)', 'mE_mRNA_A_20d_carcass_(FBlc0000220)', 'mE_mRNA_A_20d_dig_sys_(FBlc0000221)', 'mE_mRNA_A_4d_carcass_(FBlc0000222)', 'mE_mRNA_A_4d_dig_sys_(FBlc0000223)', 'mE_mRNA_P8_CNS_(FBlc0000224)', 'mE_mRNA_L3_CNS_(FBlc0000225)', 'mE_mRNA_L3_Wand_carcass_(FBlc0000226)', 'mE_mRNA_L3_Wand_dig_sys_(FBlc0000227)', 'mE_mRNA_L3_Wand_fat_(FBlc0000228)', 'mE_mRNA_L3_Wand_imag_disc_(FBlc0000229)', 'mE_mRNA_L3_Wand_saliv_(FBlc0000230)', 'mE_mRNA_A_VirF_20d_head_(FBlc0000231)', 'mE_mRNA_A_VirF_4d_ovary_(FBlc0000232)', 'mE_mRNA_WPP_fat_(FBlc0000233)', 'mE_mRNA_WPP_saliv_(FBlc0000234)', 'mE_mRNA_P8_fat_(FBlc0000235)', 'mE_mRNA_A_4d_Cold1_(FBlc0000237)', 'mE_mRNA_A_4d_Cold2_(FBlc0000238)', 'mE_mRNA_L3_Cu_0.5mM_(FBlc0000239)', 'mE_mRNA_L3_late_Zn_5mM_(FBlc0000240)', 'mE_mRNA_A_4d_Cu_15mM_(FBlc0000241)', 'mE_mRNA_A_4d_Zn_4.5mM_(FBlc0000242)', 'mE_mRNA_A_4d_Caffeine_25mg/ml_(FBlc0000243)', 'mE_mRNA_A_4d_Caffeine_2.5mg/ml_(FBlc0000244)', 'mE_mRNA_L3_Caffeine_1.5mg/ml_(FBlc0000245)', 'mE_mRNA_A_4d_Cd_0.1M_(FBlc0000246)', 'mE_mRNA_A_4d_Cd_0.05M_(FBlc0000247)', 'mE_mRNA_L3_Cd_12h_(FBlc0000248)', 'mE_mRNA_L3_Cd_6hr_(FBlc0000249)', 'mE_mRNA_A_4d_Paraquat_5mM_(FBlc0000250)', 'mE_mRNA_A_4d_Paraquat_10mM_(FBlc0000251)', 'mE_mRNA_L3_Rotenone_8ug_(FBlc0000252)', 'mE_mRNA_L3_Rotenone_2ug_(FBlc0000253)', 'mE_mRNA_L3_EtOH_10_(FBlc0000254)', 'mE_mRNA_L3_EtOH_5_(FBlc0000255)', 'mE_mRNA_L3_EtOH_2.5_(FBlc0000256)', 'mE_mRNA_A_4d_Heatshock_(FBlc0000257)', 'mE_mRNA_A_10d_Resveratrol_100uM_(FBlc0000672)', 'mE_mRNA_A_10d_Rotenone_Starved_(FBlc0000673)', 'mE_mRNA_F_Sindbis_virus_(FBlc0000674)', 'mE_mRNA_L_Sindbis_virus_(FBlc0000675)', 'mE_mRNA_M_Sindbis_virus_(FBlc0000676)', 'mE_mRNA_P_Sindbis_virus_(FBlc0000677)', 'mE_mRNA_CME-W2_cells_(FBlc0000261)', 'mE_mRNA_GM2_cells_(FBlc0000262)', 'mE_mRNA_mbn2_cells_(FBlc0000263)', 'mE_mRNA_BG2-c2_cells_(FBlc0000264)', 'mE_mRNA_D20-c5_cells_(FBlc0000265)', 'mE_mRNA_S3_cells_(FBlc0000266)', 'mE_mRNA_1182-4H_cells_(FBlc0000267)', 'mE_mRNA_CME_L1_cells_(FBlc0000268)', 'mE_mRNA_Kc167_cells_(FBlc0000269)', 'mE_mRNA_BG1-c1_cells_(FBlc0000270)', 'mE_mRNA_D11_cells_(FBlc0000271)', 'mE_mRNA_D16-c3_cells_(FBlc0000272)', 'mE_mRNA_D17-c3_cells_(FBlc0000273)', 'mE_mRNA_D21_cells_(FBlc0000274)', 'mE_mRNA_D32_cells_(FBlc0000275)', 'mE_mRNA_D4-c1_cells_(FBlc0000276)', 'mE_mRNA_D8_cells_(FBlc0000277)', 'mE_mRNA_D9_cells_(FBlc0000278)', 'mE_mRNA_S1_cells_(FBlc0000279)', 'mE_mRNA_S2R+_cells_(FBlc0000280)', 'mE_mRNA_Sg4_cells_(FBlc0000281)', 'mE_mRNA_OSS_cells_(FBlc0000282)', 'mE_mRNA_OSC_cells_(FBlc0000283)', 'mE_mRNA_fGS_cells_(FBlc0000284)', 'Knoblich_mRNA_L3_CNS_neuroblast_(FBlc0000505)', 'Knoblich_mRNA_L3_CNS_neuron_(FBlc0000506)', 'RNA-Seq_Profile_FlyAtlas2_Adult_Female_Brain_(FBlc0003619)', 'RNA-Seq_Profile_FlyAtlas2_Adult_Female_Crop_(FBlc0003620)', 'RNA-Seq_Profile_FlyAtlas2_Adult_Female_Carcass_(FBlc0003621)', 'RNA-Seq_Profile_FlyAtlas2_Adult_Female_Eye_(FBlc0003622)', 'RNA-Seq_Profile_FlyAtlas2_Adult_Female_FatBody_(FBlc0003623)', 'RNA-Seq_Profile_FlyAtlas2_Adult_Female_Head_(FBlc0003624)', 'RNA-Seq_Profile_FlyAtlas2_Adult_Female_Hindgut_(FBlc0003625)', 'RNA-Seq_Profile_FlyAtlas2_Adult_Female_Midgut_(FBlc0003626)', 'RNA-Seq_Profile_FlyAtlas2_Adult_Female_Ovary_(FBlc0003627)', 'RNA-Seq_Profile_FlyAtlas2_Adult_Female_RectalPad_(FBlc0003628)', 'RNA-Seq_Profile_FlyAtlas2_Adult_Female_SalivaryGland_(FBlc0003629)', 'RNA-Seq_Profile_FlyAtlas2_Adult_Female_ThoracicoAbdominalGanglion_(FBlc0003630)', 'RNA-Seq_Profile_FlyAtlas2_Adult_Female_MalpighianTubule_(FBlc0003631)', 'RNA-Seq_Profile_FlyAtlas2_Adult_Female_Mated_Spermathecum_(FBlc0003632)', 'RNA-Seq_Profile_FlyAtlas2_Adult_Female_Virgin_Spermathecum_(FBlc0003633)', 'RNA-Seq_Profile_FlyAtlas2_Adult_Female_Whole_(FBlc0003634)', 'RNA-Seq_Profile_FlyAtlas2_Adult_Male_Brain_(FBlc0003635)', 'RNA-Seq_Profile_FlyAtlas2_Adult_Male_Crop_(FBlc0003636)', 'RNA-Seq_Profile_FlyAtlas2_Adult_Male_Carcass_(FBlc0003637)', 'RNA-Seq_Profile_FlyAtlas2_Adult_Male_Eye_(FBlc0003638)', 'RNA-Seq_Profile_FlyAtlas2_Adult_Male_FatBody_(FBlc0003639)', 'RNA-Seq_Profile_FlyAtlas2_Adult_Male_Head_(FBlc0003640)', 'RNA-Seq_Profile_FlyAtlas2_Adult_Male_Hindgut_(FBlc0003641)', 'RNA-Seq_Profile_FlyAtlas2_Adult_Male_Midgut_(FBlc0003642)', 'RNA-Seq_Profile_FlyAtlas2_Adult_Male_RectalPad_(FBlc0003643)', 'RNA-Seq_Profile_FlyAtlas2_Adult_Male_SalivaryGland_(FBlc0003644)', 'RNA-Seq_Profile_FlyAtlas2_Adult_Male_ThoracicoAbdominalGanglion_(FBlc0003645)', 'RNA-Seq_Profile_FlyAtlas2_Adult_Male_MalpighianTubule_(FBlc0003646)', 'RNA-Seq_Profile_FlyAtlas2_Adult_Male_Testis_(FBlc0003647)', 'RNA-Seq_Profile_FlyAtlas2_Adult_Male_AccessoryGland_(FBlc0003648)', 'RNA-Seq_Profile_FlyAtlas2_Adult_Male_Whole_(FBlc0003649)', 'RNA-Seq_Profile_FlyAtlas2_L3_CNS_(FBlc0003650)', 'RNA-Seq_Profile_FlyAtlas2_L3_FatBody_(FBlc0003651)', 'RNA-Seq_Profile_FlyAtlas2_L3_Hindgut_(FBlc0003652)', 'RNA-Seq_Profile_FlyAtlas2_L3_MalpighianTubule_(FBlc0003653)', 'RNA-Seq_Profile_FlyAtlas2_L3_Midgut_(FBlc0003654)', 'RNA-Seq_Profile_FlyAtlas2_L3_SalivaryGland_(FBlc0003655)', 'RNA-Seq_Profile_FlyAtlas2_L3_Trachea_(FBlc0003656)', 'RNA-Seq_Profile_FlyAtlas2_L3_Carcass_(FBlc0003657)', 'RNA-Seq_Profile_FlyAtlas2_L3_Whole_(FBlc0003658)', 'RNA-Seq_Profile_FlyAtlas2_Adult_Female_Heart_(FBlc0003724)', 'RNA-Seq_Profile_FlyAtlas2_Adult_Male_Heart_(FBlc0003725)']). column_names_ext(pmid_fbgn_uniprot, ['FBrf_id', 'PMID', 'FBgn_id', 'UniProt_database', 'UniProt_id']). -guess_rest(P,N,T,Guess):- table_n_type(P,N,T,Guess),var(Guess),fb_pred_nr(P,A),functor(C,P,A),arg(N,C,Guess),once(call(C)). + +%! guess_rest(+Predicate, +ArgIndex, +Type, -Guess) is nondet. +% +% Makes a guess for a missing value in a specific argument position of a predicate. +% +% This predicate attempts to determine a value (`Guess`) for a given argument position +% (`ArgIndex`) in a predicate (`Predicate`). The guess is constrained by the argument's +% expected type (`Type`) and is generated by analyzing the table structure and calling +% the predicate dynamically. +% +% The process involves: +% 1. Using `table_n_type/4` to infer the possible types of arguments in the predicate. +% 2. Ensuring that `Guess` is initially unbound (`var(Guess)`). +% 3. Determining the arity of the predicate using `fb_pred_nr/2`. +% 4. Constructing a callable term using `functor/3` and setting the target argument +% position using `arg/3`. +% 5. Dynamically calling the predicate with `call/1` and extracting the value of `Guess`. +% +% @arg Predicate The name of the predicate being queried. +% @arg ArgIndex The index of the argument to guess (1-based). +% @arg Type The expected type of the argument. +% @arg Guess The guessed value for the argument. +% +% @examples +% % Example query to guess a value for the second argument of a predicate: +% ?- guess_rest('some_predicate', 2, 'integer', Guess). +% Guess = 42. +% +guess_rest(P, N, T, Guess) :- + % Use the table structure to infer the argument type and prepare a guess. + table_n_type(P, N, T, Guess), + % Ensure that the guess is unbound. + var(Guess), + % Retrieve the arity of the predicate. + fb_pred_nr(P, A), + % Construct a callable term for the predicate. + functor(C, P, A), + % Set the target argument position to guess. + arg(N, C, Guess), + % Dynamically call the predicate and extract the value. + once(call(C)). + +%! maybe_corisponds(+ConceptA, +ConceptB) is det. +% +% Defines potential correspondences between two conceptual mappings. +% +% The predicate `maybe_corisponds/2` identifies potential relationships between +% two conceptual mappings. These mappings are defined using the `ConceptMapFn/3` +% functor, which describes how data fields or properties in different data sources +% might correspond to one another. +% +% The mappings include field names, field indices, and the data source (with +% arity) from which the fields originate. These correspondences are particularly +% useful for establishing links between disparate data sources, such as databases +% or file formats. +% +% @arg ConceptA The first conceptual mapping, defined as `ConceptMapFn(Field, Index, Source/Arity)`. +% @arg ConceptB The second conceptual mapping, also defined as `ConceptMapFn(Field, Index, Source/Arity)`. +% +% @examples +% % Example: Checking if two concepts correspond: +% ?- maybe_corisponds('ConceptMapFn'('FBgn', 1, disease_model_annotations/12), +% 'ConceptMapFn'('FBgn', 1, dmel_paralogs/11)). +% true. +% +% % Example: Iterating over all correspondences: +% ?- maybe_corisponds(ConceptA, ConceptB). +% ConceptA = 'ConceptMapFn'('FBgn', 1, disease_model_annotations/12), +% ConceptB = 'ConceptMapFn'('FBgn', 1, dmel_paralogs/11). +% maybe_corisponds('ConceptMapFn'('Allele_used_in_model_(symbol)', 8, disease_model_annotations/12), 'ConceptMapFn'(current_symbol, 3, synonym/6)). maybe_corisponds('ConceptMapFn'('Allele_used_in_model_(symbol)', 8, disease_model_annotations/12), 'ConceptMapFn'(description, 6, stocks/7)). maybe_corisponds('ConceptMapFn'('Allele_used_in_model_(symbol)', 8, disease_model_annotations/12), 'ConceptMapFn'(uniquename, 5, stocks/7)). @@ -1201,6 +1737,34 @@ maybe_corisponds('ConceptMapFn'(identical_protein, 4, dmel_unique_protein_isoforms/4), 'ConceptMapFn'(polypeptide_symbol, 11, fbgn_fbtr_fbpp_expanded/11)). maybe_corisponds('ConceptMapFn'(polypeptide_symbol, 11, fbgn_fbtr_fbpp_expanded/11), 'ConceptMapFn'(representative_protein, 3, dmel_unique_protein_isoforms/4)). maybe_corisponds('ConceptMapFn'(so_term_name, 3, dmel_gene_sequence_ontology_annotations/4), 'ConceptMapFn'(transcript_type, 7, fbgn_fbtr_fbpp_expanded/11)). + +%! numeric_value_p_n(+Table, +Column, +Name) is det. +% +% Maps numeric or identifier columns in a table to their respective names. +% +% This predicate associates numeric column indexes (Column) in a specific +% table (Table) to their descriptive names (Name). The `numeric_value_p_n/3` +% predicate is dynamic and serves as a metadata reference for identifying +% the meaning of numeric columns within structured data tables. +% +% @arg Table The name of the table where the column exists. +% @arg Column The numeric index of the column within the table. +% @arg Name The descriptive name associated with the column index. +% +% @examples +% % Example: Retrieving the column name of a specific column in a table: +% ?- numeric_value_p_n(dmel_paralogs, 11, Name). +% Name = 'DIOPT_score'. +% +% % Example: Listing all column names for a table: +% ?- numeric_value_p_n(dmel_paralogs, Column, Name). +% Column = 5, +% Name = 'Strand' ; +% Column = 10, +% Name = 'Paralog_Strand' ; +% Column = 11, +% Name = 'DIOPT_score'. +% numeric_value_p_n(dmel_human_orthologs_disease, 6, 'DIOPT_score'). numeric_value_p_n(dmel_human_orthologs_disease, 7, 'OMIM_Phenotype_IDs'). numeric_value_p_n(dmel_paralogs, 10, 'Paralog_Strand'). @@ -1384,6 +1948,37 @@ numeric_value_p_n(insertion_mapping, 5, orientation). numeric_value_p_n(organism_list, 5, 'NCBI_taxon'). numeric_value_p_n(pmid_fbgn_uniprot, 2, gene_symbol). + +%! table_n_type(+Table, +Column, +Name, +Type) is det. +% +% Defines the metadata for tables, associating columns with their names and types. +% +% This predicate describes the structure of various tables by mapping column +% indexes (Column) to their descriptive names (Name) and optionally to their +% types (Type). The `table_n_type/4` predicate is dynamic and serves as a +% metadata reference for interpreting data from different tables. +% +% @arg Table The name of the table. +% @arg Column The numeric index of the column within the table. +% @arg Name The descriptive name of the column. +% @arg Type The optional type of the column, such as an identifier type or other metadata. +% +% @examples +% % Example: Finding the name of a specific column in a table: +% ?- table_n_type(dmel_paralogs, 11, Name, Type). +% Name = 'DIOPT_score', +% Type = _. +% +% % Example: Listing all columns for a table: +% ?- table_n_type(dmel_paralogs, Column, Name, Type). +% Column = 1, +% Name = 'FBgn', +% Type = 'FBgn' ; +% Column = 2, +% Name = 'GeneSymbol', +% Type = _ ; +% ... +% table_n_type('cyto-genetic-seq', 1, 'Cytogenetic_map_position', _). table_n_type('cyto-genetic-seq', 2, 'Genetic_map_position', _). table_n_type('cyto-genetic-seq', 3, 'Sequence_coordinates_(release_6)', _).