Learn R Programming

GSNA (version 0.1.4.2)

gsIntersect: gsIntersect

Description

For two character vectors, returns the set of shared elements. This is used by GSNA to find shared genes in two gene sets.

Usage

gsIntersect(gs1, gs2)

Value

A character vector consisting of the overlap of the two gene sets.

Arguments

gs1

A character vector representing gene symbols in a gene set.

gs2

A character vector representing gene symbols in a second gene set.

Details

This version of the function is used in gsnORAtest_cpp. (In another version of the function, used in gsnFilterGeneSetCollectionList() and accessible only from C++ the first argument is gs1Set, a set of strings of type std::set<std::string>.)

This function does essentially what R's base::intersect does, so it is not necessarily useful to export.

Examples

Run this code

library(GSNA)

# We can extract 2 gene sets from the sample data:
Bai.gsc <- tmod2gsc( Bai_gsc.tmod )
M29994.gs = Bai.gsc[['M29994']]
M40825.gs = Bai.gsc[['M40825']]

# Find the intersection:
intersect.gs <- gsIntersect( gs1 = M29994.gs, gs2 = M40825.gs )

Run the code above in your browser using DataLab