This is a test version of Biostars. For the public version, visit https://www.biostars.org.
eQTL Analysis

I am new in eQTL. I am trying to work in Matrix EQTL in R. I have gene expression txt file and SNP.txt file. In SNP.txt , I don't have all rsids.

  1. May I have to remove those SNPs where no rsid is assigned?
  2. When I am uploading text file in R then it shows error in file (description = filename, open = rt, blocking = false, raw = false)

Kindly help me to analyze eQTL in R or any other tool .

genotypic gene-expression snp
  1. It may not be necessary to remove SNPs without rsids. I'm guessing the SNPs must have IDs of sorts, you can use other SNP IDs in addition to rsid.

  2. It is quite difficult to help you with this without seeing your lines of code.

library(MatrixEQTL) base.dir = find.package("MatrixEQTL") useModel = modelLINEAR SNP_file_name = paste(base.dir, "/Users/user1/Desktop/Plant_1/eqtl/209_40.txt", sep = "") expression_file_name = paste(base.dir, "/Users/user1/Desktop/Plant_1/eqtl/Gene_expression.txt.", sep = "") covariates_file_name to character() Error: unexpected symbol in "covariates_file_name to" 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 ) Error in file(description = filename, open = "rt", blocking = FALSE, raw = FALSE) : cannot open the connection In addition: Warning message: In file(description = filename, open = "rt", blocking = FALSE, raw = FALSE) : cannot open file 'C:/Program Files/R/R-4.0.3/library/MatrixEQTL/209_40.txt': No such file or directory

I tried as setwd() (the directory where the files are. Same Error I got.

1 answer

Apparantly you're trying to import the data from a wrong location. Try the following code

library(MatrixEQTL)

useModel = modelLINEAR

SNP_file_name = paste("/Users/user1/Desktop/Plant_1/eqtl/209_40.txt", sep = "")

expression_file_name = paste( "/Users/user1/Desktop/Plant_1/eqtl/Gene_expression.txt.", sep = "")

#covariates_file_name to character() Error: unexpected symbol in "covariates_file_name to" 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 )

Afterwards, I am getting this error: Error in dim(data) = c(length(rowvals[[1]]), length(rowvals)) : dims [product 48375] do not match the length of object [48362]

When I did as you told in directory path. It loading file then gave the above error. As I am doing same for expression _file_name. I am getting the error:

gene$LoadFile(gene_file_name) Error in scan(file = fid, what = double(), nlines = 1, quiet = TRUE, sep = fileDelimiter, : scan() expected 'a real', got '0,715703853'

Now that's different.

I think your current error is related with the file separator in your gene expression data. Try

expression_file_name = paste( "/Users/user1/Desktop/Plant_1/eqtl/Gene_expression.txt.", sep = ",")

snps$LoadFile( SNP_file_name ) Error in dim(data) = c(length(rowvals[[1]]), length(rowvals)) : dims [product 48375] do not match the length of object [48362]

Please make sure that your genotype file is properly formatted.

Thank you! I check if you tell me some format, let me know about geneloc.txt and snpsloc.txt file. I am new in this. Kindly help me..I will be heartily thankful to you. SNP.txt/genotype.txt ::::::::::::::::::.

id Genotype1 Genotype2 Genotype3 Genotype4 Genotype5 Genotype6 rs1457723673 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 rs779258992 1 1 2 2 1 1 1 1 2 1 1 1 2 1 3 1 2 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 3 1 3 3 1 1 2 1 . 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 0 1 1 1 1 0 1 0 1 1 1 1 1 3 1 1 1 1 1 rs1366371903 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 0 1 0 1 1 1 1 0 1 0 1 1 1 1 1 0 1 1 1 1 1 rs150969722 1 1 1 1 1 3 0 1 0 0 0 0 0 0 1 1 0 1 1 0 0 1 1 1 1 1 1 1 1 1 0 0 1 1 0 0 2 0 1 1 0 1 1 rs1351390918 1 1 1 1 1 1 1 1 1 0 1 1 1 0 2 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 0 1 1 1 0 1 0 1 1 0 1 1 rs1363828207 1 1 1 1 3 1 1 1 1 0 1 0 1 0 1 1 1 1 0 1 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 . 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 2 1 1 0 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 3 1 1 1 1 1 1 1 1 1 . 1 1 1 1 0 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 3 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 rs112766696 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2
rs112155239 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2

GE.txt::::::::::::::::::::::::::::::::::::::::::::::::::::::..

Gene Name Genotype1 Genotype2 Genotype3 Genotype4 TDRD15 0 0 0 0 0 0 0,715703853 4,867835693 1,425570794 0 0 6,885279071 0 0 5,722333577 0 0 0 0 0 6,10864446 0 0 0 0 0 0,93578208 0 0 0 0 0,765428608 0 0 1,126985068 0 0 1,05248477 0 0,901486543 0 0 0 0 MUC6 7,11467435 0 5,058384035 1,715474394 3,087855906 2,092686548 1,431407707 1,622611898 3,563926985 0,769839311 20,09758353 12,78694685 4,155671386 1,095621927 6,539809802 3,097609343 1,269429196 1,531118425 8,785508613 2,349644018 26,47079266 1,96772158 6,990179634 6,415850489 162,429992 60,00159812 5,614692478 11,1475922 6,16534423 21,53173012 8,603341455 4,592571647 5,252903685 0 23,66668642 6,95651337 2,752636952 9,472362929 1,586980156 0,901486543 14,81455623 14,27594589 4,058902353 13,1806022 LOC105377527 0 1,170601218 2,529192017 12,86605795 15,43927953 2,092686548 1,431407707 0 0,712785397 0,769839311 1,747615959 2,950833888 1,662268554 9,860597347 13,89709583 2,065072896 1,269429196 1,531118425 5,490942883 7,048932053 2,03621482 10,82246869 3,994388362 2,13861683 4,972346693 2,069020625 4,678910399 0 22,34937283 4,784828915 2,150835364 10,71600051 1,750967895 0,857878039 4,507940271 1,987575248 6,193433142 7,367393389 3,967450389 2,70445963 0 2,379324314 3,247121882 0 COL2A1 15,41512776 1,170601218 50,58384035 24,87437871 6,175711811 2,092686548 80,15883159 1,622611898 7,840639367 1,539678622 55,04990272 0,983611296 18,2849541 20,81681662 4,087381127 21,6832654 86,32118532 12,2489474 51,6148631 1,566429345 0 103,3053829 1,997194181 24,59409354 10,77341784 10,34510312 3,743128319 15,60662908 6,936012258 62,20277589 143,0305517 6,123428863 3,50193579 73,77751139 19,15874615 10,93166387 2,064477714 14,73478678 6,347920622 32,45351556 5,555458586 79,70736453 25,16519459 11,42318858 CST2 0 31,60623288 2,529192017 0 9,263567717 12,55611929 4,294223121 4,056529744 7,840639367 9,238071732 6,990463837 3,934445184 0 1,095621927 4,087381127 3,097609343 8,886004371 1,531118425 2,196377153 1,566429345 1,01810741 4,91930395 0,998597091 3,207925245 1,657448898 18,62118562 10,29360288 4,45903688 3,082672115 11,1646008 4,301670728 0 31,51742211 9,436658433 1,126985068 0 0,688159238 3,15745431 0 4,507432717 12,9627367 9,517297257 16,23560941 1,757413627 LOC102723730 5,928895292 1,170601218 22,76272816 6,861897574 18,52713543 6,278059644 12,88266936 0 13,54292254 2,309517933 30,58327929 5,901667775 3,324537109 3,286865782 4,904857352 14,45551027 2,538858392 13,01450662 13,17826292 4,699288035 3,05432223 6,887025529 14,97895636 4,27723366 6,629795591 9,310592812 16,84407744 23,40994362 0 81,34209155 24,73460668 21,43200102 3,50193579 1,715756079 2,253970136 4,968938121 24,77373257 28,41708879 9,521880934 12,62081161 4,629548822 17,84493236 8,117804706 10,54448176 ATP8A2 8,300453408 3,511803653 22,76272816 4,288685984 0 1,046343274 3,578519267 1,622611898 5,702283176 2,309517933

  1. Based on the error you get when you try to import the SNP file, it appears you that some missing values in your SNP file are not denoted by NA. Try importing the data with read.table() to figure that out.
  2. You'll need to create the geneloc.txt and snpsloc.txt files. geneloc.txt should contain information about where the genes in your GE.txt file are located in the genome formatted like this. snpsloc.txt should contain information about where the SNPs in your SNP.txt file are located in the genome formatted like this

Dear Solomon,

Thank you. SNPloc.txt and geneloc.txt, I checked the format. I am sure how to access information for my data

Log in to answer this question.