Skip to content
Prev 342786 / 398506 Next

mutually exclusive events

On Aug 2, 2014, at 11:11 AM, Adrian Johnson wrote:

            
#-------------
 dat <- read.table(text="Cluster      Gene      Mutated    not_mutated
  1             G1             1              0
  1             G2             1              0
  1             G3             0              1
  1             G4             0              1
  1             G5             1              0
  2             G1             0              1
  2             G2             1              0
  2             G3             1              0
  2             G4             0              0
  2             G5             1              0", header=TRUE, stringsAsFactors=FALSE)

 with(dat, table(Cluster, Gene, Mutated)  )
#----------------
, , Mutated = 0

       Gene
Cluster G1 G2 G3 G4 G5
      1  0  0  1  1  0
      2  1  0  0  1  0

, , Mutated = 1

       Gene
Cluster G1 G2 G3 G4 G5
      1  1  1  0  0  1
      2  0  1  1  0  1
#--------------
Or:
xtabs(Mutated ~ Cluster+Gene, data=dat)
#----------------
       Gene
Cluster G1 G2 G3 G4 G5
      1  1  1  0  0  1
      2  0  1  1  0  1


I'm a bit unclear about your goals. Are you trying to identify the "Gene"s that have only one "Cluster" mutated as the "G1-G3" events and the Gene's that have either-Cluster but not both as the "G2-G5" events?

If so you can choose the columns that have a sum of 2 for the first and columns with sum of 1 for the second.
It's even less clear what sort of "test" you propose. `fisher.test` is a test of association. It doesn't identify combinations.
This is a plain text mailing list.
David Winsemius
Alameda, CA, USA