I have the following data.frame :
Name Expr FC FDR
probe1 gene1 1 1.5 0.005
probe2 gene2 1 1.3 0.02
probe3 gene1 2 1.2 0.000003
probe4 gene4 3 1.8 0.5
probe5 gene5 4 1.9 0.00008
probe6 gene2 5 1.3 0.03
probe7 gene4 3 1.2 0.0001
probe8 gene8 10 1.3 0.01
probe9 gene8 11 1.8 0.01
There are many probes representing the same gene. I would like to select only 1 probe per gene based on the FDR, ie, select for each gene, the probe with smallest FDR. If 2 probes for the same gene have the same FDR, select one randomly. I would like to have the following data.frame as output :
Name Expr FC FDR
probe3 gene1 2 1.2 0.000003
probe4 gene5 4 1.9 0.00008
probe6 gene4 3 1.2 0.0001
probe2 gene2 1 1.3 0.02
probe8 gene8 10 1.3 0.01
Thanks in advance for your help !