Help needed
0
0
Entering edit mode
3 months ago
Nai ▴ 20
var snp_id=0;
var samples = header.getSampleNamesInOrder();
out.print("id");
for(var i=0;i< samples.size();++i)
    {
    out.print("\t"+samples.get(i));
    }
out.println();

while(iter.hasNext()) {
 var ctx= iter.next();
 ++snp_id;
 out.print(new java.lang.Integer(snp_id));
 for(var i=0;i< samples.size();++i)
    {
    out.print("\t");
    var g= ctx.getGenotype(samples.get(i));
    if(g.isHomRef())
        {
        out.print("1");
        }
    else if(g.isHet())
        {
        out.print("2");
        }
    else if(g.isHomVar())
        {
        out.print("3");
        }
    else 
        {
        out.print("0");
        }
    }

 out.println();
 }

I used this script and converted .vcf to snp.txt. While I am pasting it in MATRIXEQTL in R via following way:

library(MatrixEQTL)
useModel = modelLINEAR
SNP_file_name = paste("SNP.txt", sep = "")
expression_file_name = paste( “Gene_expression.txt.", sep = "")
covariates_file_name = character()
output_file_name = tempfile()
pvOutputThreshold = 1e-2
errorCovariance = numeric()
snps = SlicedData$new()
snps$fileDelimiter = "\t"
snps$fileOmitCharacters = "NA"
snps$fileSkipRows = 1
snps$fileSkipColumns = 1
snps$fileSliceSize = 2000
snps$LoadFile(SNP_file_name)

Then file started loading, then I got an

Error in dim(data) = c(length(rowvals[[1]]), length(rowvals)) :
  dims [product 50625] do not match the length of object [50611]
using SNP.txt bioaclaide • 345 views
ADD COMMENT
0
Entering edit mode

I removed parts of your title, if people feel to comment or answer they will, there is no on-request support from specific people here. Also added formatting. Please format your code with the code button 10101. By the way, if you use tags and want to attract the developer then avoid typos. The tool is not named like this: http://lindenb.github.io/jvarkit/BioAlcidae.html

ADD REPLY
0
Entering edit mode

I don't think it's related to bioalcidae anyway.

ADD REPLY
0
Entering edit mode

Sorry for a specific person name here. Thank you to correct my post. I converted vcf file to snp matrrix.txt. Here id column have "." I would like to replace with rsid and the snp does not have snpid replace with chromosomal position.

ADD REPLY
0
Entering edit mode

Kindly help me to resolve this issue in SNPmatrix.txt

ADD REPLY

Login before adding your answer.

Traffic: 1854 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