This function takes a GeneDiscoveRobject and criteria for filtering genes, such as name, p-value, odds ratio, and sign. It searches through the filtered genes in the GeneDiscoveRobject and returns the index of the first gene that matches all the specified criteria. If no matching gene is found, it returns NULL.

select_filtered_gene_index(
  GeneDiscoveRobject = NULL,
  name = NULL,
  pvalue = NULL,
  oddsRatio = NULL,
  sign = NULL
)

Arguments

GeneDiscoveRobject

A GeneDiscoveR object containing filtered genes.

name

The name of the identification to match.

pvalue

The p-value of the filtering performed to match.

oddsRatio

The odds ratio of the filtering performed to match.

sign

The sign of the filtering performed to match.

Value

The index of the matching filtering performed, or NULL if no matching with any filtering performed.

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")

select_filtered_gene_index(GeneDiscoveRobject, pvalue = 0.05, oddsRatio = 1, sign = ">=", name = "PerOBtype")
#> [1] 1
# Output: 1
select_filtered_gene_index(GeneDiscoveRobject, pvalue = 0.05, oddsRatio = 1, sign = "<=", name = "PerOBtype")
#> [1] 2
# Output: 2
select_filtered_gene_index(GeneDiscoveRobject, pvalue = 0.05, oddsRatio = 1, sign = "<=", name = "OB")
#> NULL
# Output: NULL