How to prepare files from QTLtools for METAL

In this tutorial, we will see how to prepare nominal files from QTLtools for a meta-analysis using the METAL software.

Columns from QTLtools

On the one hand, here are some output columns from QTLtools:

  • gene ID (1st column)
  • variant ID (8th column)
  • p_value (12th column)
  • regression slope (14th column)

Columns for METAL

On the other hand, here are the input columns for METAL:

  • marker name
  • tested allele
  • other allele
  • p_value
  • regression slope / effect
  • sample size / weight

Preparation

First, we need to compute the sample size. The phenotype file that QTLtools takes as input is a BED file where the first 6 columns correspond to the chromosome, the start and end positions, the phenotype ID, the phenotype group ID and the strand. The other columns correspond to the individuals:

weight=$(expr $(head -1 gene_expression.bed | tr '\t' '\n' | wc -l) - 6)

Then, we need to format the nominal files:

  • combine the gene ID with the variant ID to obtain a unique marker name
  • extract the tested and other alleles information from the variant ID
  • keep the p_value and effect columns as they are
  • add a column with the weight computed in the previous step (we will have the same weight for all the markers)
gunzip -c nominal.txt.gz | awk -v awkvar=${weight} 'BEGIN{print "marker""\t""tested""\t""other""\t""p_value""\t""effect""\t""weight"}; {split($8,a,/:/); print $1"_"$8"\t"a[3]"\t"a[4]"\t"$12"\t"$14"\t"awkvar}' > nominal_for_metal.txt

Conclusion

In conclusion, we need some steps to prepare nominal files from QTLtools for METAL. Is this blog post helpful to you?

Related posts

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply