Problem with snp function in R
1
0
Entering edit mode
2.6 years ago
gosssheen • 0

Hello,

I've a big problem with snp function.

I must use it in first step of my analysis. If I use example of alleles (find -> https://www.rdocumentation.org/packages/SNPassoc/versions/2.0-11/topics/snp) everything is ok but if I use my data R give me error Error in snp(test, sep = "") : SNP must have only two alleles.

I check my data and it's the same class (character). Both datasets look the same.

test - my data

dat2 - example

I don't know what I've to do now... Please help. enter image description here

snpassoc snpfunction SNP R GWAS • 1.4k views
ADD COMMENT
1
Entering edit mode
2.6 years ago
Ram 44k

Read the documentation and understand your situation. For a biallelic diploid locus, there can only be 3 possible unphased configurations: HOM-REF, HET and HOM-ALT. Your "test" dataset has all 4 nucleotides, so obviously it's not a SNP at a single locus but a collection of SNPs - meaning, not all 10 configurations are possible at the same location.

Contrast this to dat2 where the only 2 alleles are A and G. Either change your dataset so it's compatible or use sapply(test, snp, sep = "") to get 10 SNP objects (not a meaningful thing to do)

ADD COMMENT
0
Entering edit mode

Now, I understand, thanks :)

But I have one more question. It's my sample of individuals and I've got more than two alleles. For examples in E1 are C,G and A. What should I do with this problem? enter image description here

ADD REPLY
0
Entering edit mode

Did you try snp(vector_of_genotypes, sep = "")? That should work with E1, as long as it's a sensible vector. The E1 example is a diploid multi-allelic (not biallelic) locus (or a polyploid locus), so there are a lot more possibilities.

ADD REPLY
0
Entering edit mode

Yes, I tried and R shows me a error "SNP must have only two alleles"

ADD REPLY
0
Entering edit mode

Show me your exact code please.

ADD REPLY
0
Entering edit mode

enter image description here

ADD REPLY
0
Entering edit mode

Please do not paste screenshots of plain text content, it is counterproductive. You can copy paste the content directly here (using the code formatting option shown below), or use a GitHub Gist if the content volume exceeds allowed length here.

code_formatting

ADD REPLY
0
Entering edit mode

Oops, I did not see the E1 vector properly, just assumed it was sensible. Can you please explain how those genotypes can be found at the same site biologically? What is the REF allele and what are the various ALT alleles?

ADD REPLY

Login before adding your answer.

Traffic: 1637 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6