Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6788911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:32:28+00:00 2026-05-26T17:32:28+00:00

Background: I am in the process of annotating SNPs from a GWAS in an

  • 0

Background: I am in the process of annotating SNPs from a GWAS in an organism without much annotation. I am using the chained tBLASTn table from UCSC along with biomaRt to map each SNP to a probable gene(s).

I have a dataframe that looks like this:

            SNP   hu_mRNA     gene
 chr1.111642529 NM_002107    H3F3A
 chr1.111642529 NM_005324    H3F3B
 chr1.111801684 BC098118     <NA>
 chr1.111925084 NM_020435    GJC2
  chr1.11801605 AK027740     <NA>
  chr1.11801605 NM_032849    C13orf33
 chr1.151220354 NM_018913    PCDHGA10
 chr1.151220354 NM_018918    PCDHGA5

What I would like to end up with is a single row for each SNP, and comma delimit the genes and hu_mRNAs. Here is what I am after:

            SNP            hu_mRNA    gene
 chr1.111642529 NM_002107,NM_005324   H3F3A
 chr1.111801684  BC098118,NM_020435   GJC2
  chr1.11801605  AK027740,NM_032849   C13orf33
 chr1.151220354 NM_018913,NM_018918   PCDHGA10,PCDHGA5

Now I know I can do this with a flick of the wrist in perl, but I really want to do this all in R. Any suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:32:29+00:00Added an answer on May 26, 2026 at 5:32 pm

    You can use aggregate with paste for each one and merge at the end:

    x <- structure(list(SNP = structure(c(1L, 1L, 2L, 3L, 4L, 4L, 5L, 
    5L), .Label = c("chr1.111642529", "chr1.111801684", "chr1.111925084", 
    "chr1.11801605", "chr1.151220354"), class = "factor"), hu_mRNA = structure(c(3L, 
    4L, 2L, 7L, 1L, 8L, 5L, 6L), .Label = c("AK027740", "BC098118", 
    "NM_002107", "NM_005324", "NM_018913", "NM_018918", "NM_020435", 
    "NM_032849"), class = "factor"), gene = structure(c(4L, 5L, 1L, 
    3L, 1L, 2L, 6L, 7L), .Label = c("<NA>", "C13orf33", "GJC2", "H3F3A", 
    "H3F3B", "PCDHGA10", "PCDHGA5"), class = "factor")), .Names = c("SNP", 
    "hu_mRNA", "gene"), class = "data.frame", row.names = c(NA, -8L
    ))
    
    a1 <- aggregate(hu_mRNA~SNP,data=x,paste,sep=",")
    a2 <- aggregate(gene~SNP,data=x,paste,sep=",")
    merge(a1,a2)
                 SNP              hu_mRNA              gene
    1 chr1.111642529 NM_002107, NM_005324      H3F3A, H3F3B
    2 chr1.111801684             BC098118              <NA>
    3 chr1.111925084            NM_020435              GJC2
    4  chr1.11801605  AK027740, NM_032849    <NA>, C13orf33
    5 chr1.151220354 NM_018913, NM_018918 PCDHGA10, PCDHGA5
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting images from background process by using url.To dispaly images i have
I want to trigger a long running background process (coded as a service) from
Can I run a PHP CGI script as a background process using exec() ?
I have a spring based webapp and I also have a background process. From
We have a database that is updated via a background process. We are using
How to refresh a page every 10 minutes using php background process? When i
Possible Duplicate: In Linux, how to prevent a background process from being stopped after
I start a background process from my shell script, and I would like to
I am using a ProgressDialog to be shown while my background process goes on,
Getting a background process ID is easy to do from the prompt by going:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.