Entering edit mode
8.2 years ago
Bioiris
▴
10
Hi;
I have two tables with a large count table (A) and the second with a list of genes (B) I want to extract a table with the gene_id present in the array of genes (B)
table(A)
————————
gene_id sample1 sample2 sample3 . ……..sample20
g1 23 0 1 3
g2 35 1 4 8
g3 4 6 70 0
g4 98 12 7 6
g5 60 2 8 12
.
.
.
g1907 13 0 0 0
table(B)
———————
gene_id
g1
g2
g3
g4
g5
.
.
.
g100
i need to get;
table(c)
————————
gene_id sample1 sample2 sample3 . ……..sample20
g1 23 0 1 3
g2 35 1 4 8
g3 4 6 70 0
g4 98 12 7 6
g5 60 2 8 12
.
.
.
g100 1 100 5 0
if anyone can help me (I worked with R)!! thanks
thank you It's work !! but, I lost all counts !!!!!!!!! all genes count in all tusses ==0
Could it be originating from the fact that gene_id columns might be factors and not characters? If that's the problem, the following might solve it.
tableA$gene_id = as.character(tableA$gene_id)
tableB$gene_id = as.character(tableB$gene_id)
tableC = tableA[which(tableA$gene_id %in% tableB$gene_id), ]
same problem counts==0
Check to see if that's not in fact the correct result then. The command is correct.