I am planning on doing eQTL analysis using the MatrixEQTL R (MatrixEQTL link) package and I need to extract genotype information and create a SnpMatrix file for that like the one given here SNP.txt file link. I have tried vcftools to create a similar looking file but to no avail, I have tried
Is there any other way to extract genotype information from the VCF file and convert it to that format?
Thanks
Description of the SnpMatrix file - In VCF files, 0 represents the reference allele and integers greater than 0
represent the alternate alleles (i.e., 2, 3, 4 would indicate the 2nd, 3rd
or 4th allele in the ALT field for a particular variant). This function only
supports variants with a single alternate allele and therefore the alternate
values will always be 1. Genotypes are stored in the SnpMatrix
as 0, 1, 2 or 3 where 0 = missing, 1 = "0/0", 2 = "0/1" or "1/0" and
3 = "1/1". In SnpMatrix terminology, "A" is the reference allele
and "B" is the risk allele. Equivalent statements to those made with 0 and 1
allele values would be 0 = missing, 1 = "A/A", 2 = "A/B" or "B/A" and 3 = "B/B".
I am not familiar with using javascript and am unclear as to how to implement the script posted. Here is a solution in R that I believe may be simpler:
What will you do in multiallelic cases? I have some GT values like 3/3, 1/2, 4/4 etc. You think the coding should be like:
0/0 --> 1
Any other heterozygous combination [1/2, 0/1 etc] --> 2
All other homozygous combination [1/1, 3/3 etc] --> 3
But those positions are ignored when I run BioAlcidae. Can you please share your ideas about this issue? Thanks.
I know you posted this a long time ago, but I just wanted to say THANK YOU! I got this to work after a lot of time spent trying to get the right output using bcftools and VCF-Simplify (both of which I've used before, but they failed me this time). I was afraid to try and use a java tool since I haven't before, but this was not hard and it works beautifully to get a snpmatrix in the form I needed for snpReady. I'm going to keep using the jvarkit tools because there are some really amazing options there. Just wish I'd found it earlier during my several years of attempting to become a capable person in bioinformatics (despite really being a wet lab molecular biologist with evolutionary theory as my passion). ;-)
Hi Pierre, I used the Bioalcidae tool and the provided script for generating the matrix, I wanted to ask is it possible to replace the first field (ID's) of the resulting matrix to the respective variant ID's from the vcf file? or is using the tools such as cut or awk to replace the ids is the only option.
Hi@Pierre Lindenbaum.
I am also facing with the same problem as @Dhana. I have a filtered vcf file and I want to create something exactly similar to SNP.txt file that @Dhana showed above.
Does this script has been created for this purpose? I could not get very well what is the input format of @Dhana's file!
What will you do in multiallelic cases? I have some GT values like 3/3, 1/2, 4/4 etc. You think the coding should be like:
0/0 --> 1
Any other heterozygous combination [1/2, 0/1 etc] --> 2
All other homozygous combination [1/1, 3/3 etc] --> 3
But those positions are ignored when I run your script. Can you please share your ideas about this issue? Thanks.
Hi, I have the same problem - I am attempting to use a vcf file to create a snp matrix formatted for analysis with MatrixEQTL.
I was not able to follow the solution below and I am not familiar with javascript. Could further details be provided for this solution?
Are there complimentary approaches using plink, vcftools, python, R or some combination thereof? Thanks
what's wrong ? https://meta.stackexchange.com/questions/147616/
I am not familiar with using javascript and am unclear as to how to implement the script posted. Here is a solution in R that I believe may be simpler:
the interpreter is a java program named bioalcidae. And it is invoked using
What will you do in multiallelic cases? I have some GT values like 3/3, 1/2, 4/4 etc. You think the coding should be like:
0/0 --> 1 Any other heterozygous combination [1/2, 0/1 etc] --> 2 All other homozygous combination [1/1, 3/3 etc] --> 3 But those positions are ignored when I run BioAlcidae. Can you please share your ideas about this issue? Thanks.