Question: R - Count number of Samples with mutation per gene
0
gravatar for jan.haas
2.8 years ago by
jan.haas0
jan.haas0 wrote:

Hey,

I have an annotated VCF file in R. So basically one column with the gene name and multiple columns with the genotype (0,1,2, = WT, HET, HOM). Now I would like to summarize the number of how many individual samples have one or more mutation per gene. Any ideas on how to do that ?

Thanks!

snp next-gen R • 1.1k views
ADD COMMENTlink modified 2.8 years ago by Nicola Casiraghi440 • written 2.8 years ago by jan.haas0
0
gravatar for Nicola Casiraghi
2.8 years ago by
Germany, Heidelberg, DKFZ EMBL
Nicola Casiraghi440 wrote:

you can apply the function table() for each row in your VCF:

> GENE1 = c(1,2,2,2,2,0,0,1,1,1) 
> table(GENE1)
GENE1
0 1 2
2 4 4

thus the result is a vector with a counter for each genotype found in the considered gene.

ADD COMMENTlink modified 2.8 years ago • written 2.8 years ago by Nicola Casiraghi440
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2225 users visited in the last hour