gravatar for blacktomato27

2 hours ago by

United States

Dear all
good afternoon
i have example snp genotyping data like this

LOCUS POS REF ALLELE 2000 3000
MC10 713 T C NA NA
MC10 760 T C NA NA
now i want to replace MC10 with SNP1, SNP2 and so no down the file and would like to insert chr column with dummy chromosome number let 1, also would like replace A with A/A, T with T/T, G with G/G and C with C/C in both REF and ALLELE columns and also replace NA with REF column values (ex NA of 2000 column to T/T). Finally i want to concatenate LOCUS, CHR and POS columns with _ into like this SNP1_1_713. I wish to like to like have data like this

LOCUS CHR POS MAR REF ALLELE 2000 3000
SNP1 1 713 SNP1_1_713 T/T C/C T/T T/T
SNP2 1 760 SNP2_1_760 T/T C/C T/T T/T

I tried with gsub, mutate etc in tidyverse and dplyr packages and tried within function to achieve my target but unsuccessful. please find my example data here

www.dropbox.com/scl/fi/q5mmr48qn1564tukijtm8/New-Microsoft-Excel-Worksheet.xlsx?dl=0&rlkey=ixzyl2e3zyvzf8msu6v7jj0ww

can any one help me to get my expected results with R? anyhelp in this regard will be highly appreciated
Thanks in advance



Source link