Entering edit mode
3.6 years ago
peter.berry5
▴
60
I have a dataframe containing a list of enriched GO terms resulting from a differential expression analysis. I want to filter out GO terms of interest by filtering with a second dataframe containing those GO terms I'm looking for.
Based on this post
https://community.rstudio.com/t/dplyr-filter-from-another-dataframe/7207
I wrote the following code
Extracted_GO <- filter(BP_1_5, GO_Accession_Number == GO_Search$GO_Accession_Number)
which gives the following error
longer object length is not a multiple of shorter object length
and
str(BP_1_5)
gives
tibble [5,325 x 5] (S3: tbl_df/tbl/data.frame)
$ GO_Accession_Number: chr [1:5325] "GO:0000028" "GO:0000045" "GO:0000045" "GO:0000070" ...
$ Biological.Process : chr [1:5325] "ribosomal small subunit assembly" "autophagosome assembly" "autophagosome assembly" "mitotic sister chromatid segregation" ...
$ HGNC_Symbol : chr [1:5325] "ERAL1" "UBQLN1" "STX12" "INCENP" ...
$ Gene.name : chr [1:5325] "Eral1" "Ubqln1" "Stx12" "Incenp" ...
$ GO.domain : chr [1:5325] "P" "P" "P" "P" ... data.frame': 5325 obs. of 6 variables:
and
str(GO_Search)
gives
tibble [1,727 x 2] (S3: tbl_df/tbl/data.frame)
$ GO_Accession_Number: chr [1:1727] "GO:0062201" "GO:0098610" "GO:0075003" "GO:0075002" ...
$ Description : chr [1:1727] "actin wave" "adhesion between unicellular organisms" "adhesion of symbiont appressorium to host" "adhesion of symbiont germination tube to host" ...
Given my two dataframes are of fixed length and can't be changed is there a way of achieving my goal?
you can also do inner join of GO terms of interest with main data frame.