This function filter the previuos identification with gene_identification_by_phenotype. Permit to filter genes by p-value and odds ratio for found orthogroups enriched in genes from species with one phenotype and not in other. With the formula("firstPhenotype ~ secondPhenotype"). If odds ratio is greater than 1, the orthogroups are enriched in genes from species with the first phenotype. If odds ratio is less than 1, the orthogroups are enriched in genes from species with the second phenotype.

select_genes_by_phenotype(
  GeneDiscoveRobject,
  name = NULL,
  pvalue = 0.05,
  oddsRatio = 1,
  sign = ">="
)

Arguments

GeneDiscoveRobject

The GeneDiscoveR object containing the necessary data.

name

The name of the identification execution.

pvalue

The p-value threshold for filtering genes.

oddsRatio

The odds ratio threshold for filtering genes.

sign

The sign of the comparison operator for odds ratio filtering genes. Must be one of '>=', '<=', '<', or '>'.

Value

The updated GeneDiscoveRobject with the filtered genes added to the FilteredGenes list.

Examples

# Create a GeneDiscoveR object
N0sDir <- system.file("extdata", "N0-1dot3-6", package = "GeneDiscoveR")
overallsDir <- system.file("extdata", "Comparatives-1dot3-6", package = "GeneDiscoveR")
dataFile <- system.file("extdata", "annotatedCDSs.tsv", package = "GeneDiscoveR")
minInflation <- 1.3
maxInflation <- 6
stepInflation <- 0.1

GeneDiscoveRobject <- GeneDiscoveR(overallsDir = overallsDir, N0sDir = N0sDir, dataFile = dataFile, minInflation = minInflation, maxInflation = maxInflation, stepInflation = stepInflation)

# Set active run
GeneDiscoveRobject <- set_run_active(GeneDiscoveRobject, InflationValue = 1.8)
#> -----------From OrthoFinder-----------
#> The process has been completed successfully

# Select species by phenotype
GeneDiscoveRobject <- select_species_by_phenotype(GeneDiscoveRobject = GeneDiscoveRobject, columnPhenotype = "Oil-body-type", columnID = "OrthofinderID", type = "one_in_specialized_cell")
GeneDiscoveRobject <- select_species_by_phenotype(GeneDiscoveRobject = GeneDiscoveRobject, columnPhenotype = "Oil-body-type", columnID = "OrthofinderID", type = "many_in_all_cells")

# Gene identification by phenotype
GeneDiscoveRobject <- gene_identification_by_phenotype(GeneDiscoveRobject = GeneDiscoveRobject, formula = as.formula("one_in_specialized_cell ~ many_in_all_cells"), statistic = "Fisher", name = "PerOBtype", cores = 8)

# Select genes by phenotype
GeneDiscoveRobject <- select_genes_by_phenotype(GeneDiscoveRobject, pvalue = 0.05, oddsRatio = 1, sign = ">=", name = "PerOBtype")
GeneDiscoveRobject <- select_genes_by_phenotype(GeneDiscoveRobject, pvalue = 0.05, oddsRatio = 1, sign = "<=", name = "PerOBtype")

# View filtered genes table

filteredGenes <- get_filtered_genes_table(GeneDiscoveRobject, name = "PerOBtype", pvalue = 0.05, oddsRatio = 1, sign = ">=")
# Output: A table with the filtered orthogroups enrichment in genes from species with phenotype "one_in_specialized_cell".
filteredGenes <- get_filtered_genes_table(GeneDiscoveRobject, name = "PerOBtype", pvalue = 0.05, oddsRatio = 1, sign = "<=")
# Output: A table with the filtered orthogroups enrichment in genes from species with phenotype "many_in_all_cells".