2
$\begingroup$

I have a table with information about SNPs, the table has a total of 55127 rows.

How can I know the number of gene mutations in the table and if a gene is present?

The table is in xls format.

enter image description here

$\endgroup$
5
  • 3
    $\begingroup$ Hi Sofia, recommend a package for what? Could you edit the question and explain what is your goal? Also I assume you mean SNP or what is a SNIP? As a side note all post are already signed with the account of the creator, please do not sign them in the body of the post. $\endgroup$
    – llrs
    May 18 '18 at 10:01
  • $\begingroup$ Thanks for the edits, but the main question stills remain. What is your goal, what do you want to do with this data? Do you have a question in mind, a disease, a problem, a treatment? Could you be more clear on this regard, otherwise is too unclear to try an answer $\endgroup$
    – llrs
    May 18 '18 at 10:23
  • $\begingroup$ thanks for the answer, i want to know the number of gene mutations. and to know if a certain gene is in the table. $\endgroup$
    – Sofia
    May 18 '18 at 10:26
  • $\begingroup$ It would be helpful to know the format of the data and the file size. Can you post an example of what the data look like. $\endgroup$ May 18 '18 at 10:33
  • 2
    $\begingroup$ Please edit your question and explain exactly what you are trying to do. What output do you need? Do you want a list of SNPs per gene? A list of genes in the file? None of these need to be done in R (nor is R particularly well suited for this sort of simple text parsing), do you need R? Also, what operating system are you using? We need to know that to know what tools you have easily available. Finally, what format is the file in? Is that an excel file? A csv? Tab separated? Space separated? $\endgroup$
    – terdon
    May 18 '18 at 10:56
1
$\begingroup$

For working with a relatively small dataset in tabular format, I would recommend dplyr. You can read in a excel file using readxl

library(readxl)
library(dplyr)

df <- read_excel(FILENAME)

To get the number of mutations per gene:

df %>% group_by(`Gene name`) %>%
  summarise(num_mutations=n())

If you want to know if there are mutations in a particular gene:

df %>% filter(`Gene name` == QUERY)
$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.