Coder Social home page Coder Social logo

swvanderlaan / qtltoolkit Goto Github PK

View Code? Open in Web Editor NEW
6.0 5.0 6.0 38.07 MB

A workflow based on QTLtools to run cis- and trans-QTL analyses.

Home Page: https://swvanderlaan.github.io/QTLToolKit/

Shell 63.56% Python 17.13% R 16.99% Perl 2.32%
qtl qtl-analyses gene-expression methylation mqtl eqtl

qtltoolkit's People

Contributors

jaccoschaap avatar llandsmeer avatar swvanderlaan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

qtltoolkit's Issues

Detach RTC score

We should detach the RTC Score from the main script QTLAnalyzer.

Remove CpGs/probes containing SNPs

Add a routine (somewhere) to remove CpGs (probes) containing SNPs or that map to multiple locations. Refer to: Zhou W. et al. Nucleic Acids Res. 2016.

Summarizer: re-order results

There is an issue with the re-ordering of the nominal results: these are empty after attempting to re-order using the following statements:

if [[ ${QTL_TYPE} == "CIS" ]]; then
	
		if [[ ${CLUMP} == "Y" ]]; then
			echo "* Clumped ${QTL_TYPE}-QTL results."
			gzip -fv ${SUMMARY}/${STUDYNAME}_QC_qtlnom_clumped_summary.txt
			gzip -fv ${SUMMARY}/${STUDYNAME}_QC_qtlperm_clumped_summary.txt
			
			echo "* And re-ordering based on p-value."
			zcat ${SUMMARY}/${STUDYNAME}_QC_qtlnom_clumped_summary.txt.gz | (head -n 1 && tail -n +3  | sort -t , -k 24) > ${SUMMARY}/${STUDYNAME}_QC_qtlnom_clumped_summary.txt
			gzip -fv ${SUMMARY}/${STUDYNAME}_QC_qtlnom_clumped_summary.txt
		
		elif [[ ${ANALYSIS_TYPE} == "MQTL" ]]; then
			echo "* Non-clumped ${QTL_TYPE}-QTL results."
			gzip -fv ${SUMMARY}/${STUDYNAME}_QC_qtlperm_summary.txt
			
			echo "* And re-ordering based on p-value."
			cat ${SUMMARY}/${STUDYNAME}_QC_qtlnom_summary.txt | (head -n 1 && tail -n +3  | sort -t , -k 32) > ${SUMMARY}/${STUDYNAME}_QC_qtlnom_summary.txt
			gzip -fv ${SUMMARY}/${STUDYNAME}_QC_qtlnom_summary.txt
			
		else
			echo "* Non-clumped ${QTL_TYPE}-QTL results."
			gzip -fv ${SUMMARY}/${STUDYNAME}_QC_qtlperm_summary.txt
			
			echo "* And re-ordering based on p-value."
			cat ${SUMMARY}/${STUDYNAME}_QC_qtlnom_summary.txt | (head -n 1 && tail -n +3  | sort -t , -k 24) > ${SUMMARY}/${STUDYNAME}_QC_qtlnom_summary.txt
			gzip -fv ${SUMMARY}/${STUDYNAME}_QC_qtlnom_summary.txt
			
		fi

	elif [[ ${QTL_TYPE} == "TRANS" ]]; then
		gzip -fv ${SUMMARY}/${STUDYNAME}_QC_qtlnom_summary.txt

	fi

Environment checks

We should add in checks of the environment, similar to slideToolkit scripts.

Edit QC pipeline of QTL

Several items need improvement or fixing:

  • to check the delimiter automatically of the annotation file
  • add in the data.table() to read and write tables using fread or fwrite
  • the eQTL-part (nom/perm for cis) to match with the new 'strand' column (as the column numbers have changed by the addition of the 'strand' column in the output)
  • double check the trans-QTL-part to match with the new 'strand' column (as the column numbers have changed by the addition of the 'strand' column in the output)
  • double check the mQTL-part to match with the new 'strand' column (as the column numbers have changed by the addition of the 'strand' column in the output)

Plotting of mQTL analyses

We should think of a solution to plot mQTL results in a regional association plot, maybe using LocusZoom.

Add r^2 to results - SumEditor/SumParser

When running a QTL analysis - usually in cis with GWAS loci - we should always have the r^2 reported with the GWAS locus.
This is done when CLUMP="Y", but this should be done regardless. It is done using QTLSumEditor.py.
This connects to QTLSumParser.py, as since regular, non-clumped data does not have the r^2 plugged in, the QTLSumParser.py script cannot make the lists of interesting eGenes and eSNPs.

add proper --help flag

We should have a proper --help flag to aid in explaining the various options in the workflow.

QTL QC

We need to fix the Q-value calculation. This goes awry when there are a lot - or only - very significant p-values, or some NAs. Or too little values. Currently we use the Benjamini - Hochberg FDR correction, which is fine (a bit less conservative) and quite similar to Q-value (Storey & Tibshirani, which is the least conservative).

It pertains this part of the QTL_QC.R script:

  cat("\n* Least conservative correction: Storey & Tibshirani correction...\n")
  ### Storey & Tibshirani correction - Least conservative
  ### references:
  ###     - http://en.wikipedia.org/wiki/False_discovery_rate
  ###     - http://svitsrv25.epfl.ch/R-doc/library/qvalue/html/qvalue.html
  ### Requires a bioconductor package: "qvalue"
  if(opt$resulttype == "NOM") {
  #RESULTS$Q = qvalue(RESULTS$Nominal_P)$qvalues # original code
  RESULTS$Q = "Not calculated: throws an error when p-value is infinite or NA. NEED FIXING"
  } else if(opt$resulttype == "PERM") {
   #RESULTS$Q = qvalue(RESULTS$Approx_Perm_P)$qvalues # original code
   RESULTS$Q = ifelse(RESULTS$Approx_Perm_P > 0, qvalue(RESULTS$Approx_Perm_P)$qvalues, "NA")
  } else {
   cat ("\n\n*** ERROR *** Something is rotten in the City of Gotham; most likely a typo. Double back, please.\n\n",
        file=stderr()) # print error messages to stder
  }
  # RESULTS$Q = "Currently not calculated due to an issue with the qvalue() package."

Write Wiki

Update/write a proper wiki for more information and explanation of what is what.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.