R - Count number of Samples with mutation per gene
1
0
Entering edit mode
8.5 years ago
jan.haas • 0

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!

R SNP next-gen • 2.8k views
ADD COMMENT
0
Entering edit mode
8.5 years ago

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 COMMENT

Login before adding your answer.

Traffic: 1840 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6