Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#Error. Could not read input tissue database. #6

Open
hust-yyan opened this issue Mar 8, 2022 · 5 comments
Open

#Error. Could not read input tissue database. #6

hust-yyan opened this issue Mar 8, 2022 · 5 comments

Comments

@hust-yyan
Copy link

Hi, I recently performed a TWAS study on miRNA expression. After creating the predict database using our miRNA expression and genotype data, we encountered the following error during s-Predixcan analysis.
image
Here is the code I used to create the Predict database
library(DBI)
library(RSQLite)
"%&%" <- function(a,b) paste(a,b, sep='')
driver <- dbDriver('SQLite')
model_summaries <- read.table('./summary/Model_training_chr1_model_summaries_filter.txt',header = T, stringsAsFactors = F)
tiss_summary <- read.table('./summary/Model_training_chr1_summary.txt', header = T, stringsAsFactors = F)
n_samples <- tiss_summary$n_samples
for (i in 2:22) {
model_summaries <- rbind(model_summaries,
read.table('./summary/Model_training_chr'%&%as.character(i) %&% '_model_summaries_filter.txt', header = T, stringsAsFactors = F))
tiss_summary <- rbind(tiss_summary,
read.table('./summary/Model_training_chr' %&% as.character(i) %&% '_summary.txt', header = T, stringsAsFactors = F))
}
model_summaries <- rename(model_summaries, gene = gene_id)

Create a database connection

conn <- dbConnect(drv = driver, './dbs/miRNA_expression_204.db')
dbWriteTable(conn, 'model_summaries', model_summaries, overwrite = TRUE)
dbExecute(conn, "CREATE INDEX gene_model_summary ON model_summaries (gene)")

Weights Table -----

weights <- read.table('./weights/Model_training_chr1_weights.txt', header = T,stringsAsFactors = F)
for (i in 2:22) {
weights <- rbind(weights,
read.table('./weights/Model_training_chr' %&% as.character(i) %&% '_weights.txt', header = T, stringsAsFactors = F))

}
weights <- rename(weights, gene = gene_id)
dbWriteTable(conn, 'weights', weights, overwrite = TRUE)
dbExecute(conn, "CREATE INDEX weights_rsid ON weights (rsid)")
dbExecute(conn, "CREATE INDEX weights_gene ON weights (gene)")
dbExecute(conn, "CREATE INDEX weights_rsid_gene ON weights (rsid, gene)")

Sample_info Table ----

sample_info <- data.frame(n_samples = n_samples, population = 'EAS') # Provide the population info
dbWriteTable(conn, 'sample_info', sample_info, overwrite = TRUE)

Construction Table ----

construction <- tiss_summary %>%
select(chrom, cv_seed) %>%
rename(chromosome = chrom)
dbWriteTable(conn, 'construction', construction, overwrite = TRUE)
dbDisconnect(conn)

@Fnyasimi
Copy link
Collaborator

Fnyasimi commented Mar 8, 2022

Hi @hust-yyan can you share the command you are using to run SPrediXcan and the full error log? Also add --verbosity 1 and --throw to log in more run info.

@hust-yyan
Copy link
Author

hust-yyan commented Mar 9, 2022

Thanks for your quick reply!
this is my command to run SPrediXcan:
/home/yyan/software/MetaXcan/software/SPrediXcan.py
--model_db_path ./input/miRNA_expression_204.db
--covariance ./input/Model_training_covariances.txt.gz
--gwas_folder /data1/yyan_tmp/miRNA_eqtl/TWAS/GWAS_data
--gwas_file_pattern "${trait}.auto.rsq07.mac10.txt.gz"
--snp_column SNPID
--effect_allele_column Allele2
--non_effect_allele_column Allele1
--beta_column BETA
--se_column SE
--pvalue_column p.value
--output_file ./results/${trait}_TAWS.csv
--verbosity 1
--throw

and this is the error info
image

And I didn't find the weight column in the weights file, which is the weight file generated by PredictDB.
image

@Fnyasimi
Copy link
Collaborator

Fnyasimi commented Mar 9, 2022

@hust-yyan the beta is the weight. You need the right columns in your weights table in the db.

weights <- weights %>%
       dplyr::rename(gene = gene_id, ref_allele = ref, eff_allele = alt, weight = beta)

@hust-yyan
Copy link
Author

Hello, my previous problem has been solved. Now the program can run successfully.But there was a warning.He said that these three genes skipped. I checked weights file and found that weights of two genes were missing. Is this normal?
image
image

@Fnyasimi
Copy link
Collaborator

That's not normal. I would advice you to look back at your filtering/QC step if everything worked well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants