Git Product home page Git Product logo

bigriverqtlplots.jl's Introduction

BigRiverQTLPlots.jl

Statistical plotting recipes for QTL analysis.

CI Coverage

BigRiverQTLPlots.jl is a versatile plotting package built in the Julia programming language. The package consists of specific plotting recipes, designed to streamline data visualization and enhance the process of statistical analysis in genetic studies. It's particularly suited for QTL (Quantitative Trait Loci) and eQTL (expression Quantitative Trait Loci) analyses, providing key features for clear and intuitive data representation.

Features

Here are the main functions provided by BigRiverQTLPlots.jl:

  • plot_QTL(): This function generates plots for LOD (logarithm of odds) scores with respect to marker positions. It's useful in viewing one genome scan result, or even multiple genome scan results, on a single plot. This helps to provide a broad overview of the QTL landscape.

  • plot_eQTL(): This function is specifically designed to plot eQTL analysis results, assisting in visualization of genetic associations with gene expression levels.

Installation

To install BigRiverQTLPlots.jl, you can use Julia's package manager. Here is the command:

using Pkg
Pkg.add("BigRiverQTLPlots")

Usage

After installing BigRiverQTLPlots.jl, you can include it in your Julia script using the following command:

using BigRiverQTLPlots

From there, you can start using plot_QTL and plot_eQTL to plot your data. For example:

# Assuming `single_results_perms` are restulting lod scores
# gInfo contains genotype information  
plot_QTL(single_results_perms, gInfo)
# Assuming `lod_scores` are in multipletraits_results
# pInfo contains phenotype information
# gInfo contains genotype information  
# thresh is your LOD threshold value
plot_eQTL(multipletraits_results, pInfo, gInfo; threshold = 5.0)

Examples

The following examples provide a basic idea of how to use the functions provided by BigRiverPlots.jl. Before proceeding, ensure that you've installed BigRiverPlots.jl and imported it into your Julia script using using BigRiverPlots along with Plots.jl. We use the package BulkLMM.jl to process the data.

Example 1: QTL Plot

using BigRiverQTLPlots, BulkLMM
using Plots

##############
# BXD spleen #
##############

########
# Data #
########
bulklmmdir = dirname(pathof(BulkLMM));

gmap_file = joinpath(bulklmmdir, "..", "data", "bxdData", "gmap.csv");
gInfo = BulkLMM.CSV.read(gmap_file, BulkLMM.DataFrames.DataFrame);

phenocovar_file = joinpath(bulklmmdir, "..", "data", "bxdData", "phenocovar.csv");
pInfo = BulkLMM.CSV.read(phenocovar_file, BulkLMM.DataFrames.DataFrame);

pheno_file = joinpath(bulklmmdir, "..", "data", "bxdData", "spleen-pheno-nomissing.csv");
pheno = BulkLMM.DelimitedFiles.readdlm(pheno_file, ',', header = false);
 # exclude the header, the first (transcript ID)and the last columns (sex)
pheno_processed = pheno[2:end, 2:(end-1)] .* 1.0;

geno_file = joinpath(bulklmmdir, "..", "data", "bxdData", "spleen-bxd-genoprob.csv")
geno = BulkLMM.DelimitedFiles.readdlm(geno_file, ',', header = false);
geno_processed = geno[2:end, 1:2:end] .* 1.0;

#################
# Preprocessing #
#################
traitID = 1112;
pheno_y = reshape(pheno_processed[:, traitID], :, 1);

###########
# Kinship #
###########
kinship = calcKinship(geno_processed);

########
# Scan #
########

single_results_perms = scan(
	pheno_y,
	geno_processed,
	kinship;
	permutation_test = true,
	nperms = 1000,
);

########
# Plot #
########
# to change bar color in the background use the keyword `barcolor`
plot_QTL(single_results_perms, gInfo, significance = [0.10, 0.05])

# or by specifying the thresholds values

thrs = BigRiverQTLPlots.perms_thresholds(single_results_perms.L_perms, [0.10, 0.05]);

plot_QTL(single_results_perms.lod, gInfo, thresholds = thrs);

alt QTL

The colors of the background bars and the threshold lines in the chart can be easily customized. To change the color of the background bars, use the barcolor argument, and to set the color of the threshold lines, use the thresholdcolor argument. These arguments accept standard Julia color codes, and HEX values.

Example 2: Manhattan Plot

Similarly, we can generate a manhattan plot using plot_manhattan function.

plot_manhattan(single_results_perms, gInfo, significance = [0.10, 0.05] );

alt QTL

Use the keywords manhattancolor to customize the scatter plot colors.

plot_manhattan(
	single_results_perms, gInfo, 
	significance = [0.10, 0.05],
	manhattancolor = ["#a6cee3", "#1f78b4"],
	);

alt QTL

Example 3: eQTL Plot

using BigRiverQTLPlots, BulkLMM
using Plots

##############
# BXD spleen #
##############

########
# Data #
########
bulklmmdir = dirname(pathof(BulkLMM));

gmap_file = joinpath(bulklmmdir, "..", "data", "bxdData", "gmap.csv");
gInfo = BulkLMM.CSV.read(gmap_file, BulkLMM.DataFrames.DataFrame);

phenocovar_file = joinpath(bulklmmdir, "..", "data", "bxdData", "phenocovar.csv");
pInfo = BulkLMM.CSV.read(phenocovar_file, BulkLMM.DataFrames.DataFrame);

pheno_file = joinpath(bulklmmdir, "..", "data", "bxdData", "spleen-pheno-nomissing.csv");
pheno = BulkLMM.DelimitedFiles.readdlm(pheno_file, ',', header = false);

geno_file = joinpath(bulklmmdir, "..", "data", "bxdData", "spleen-bxd-genoprob.csv")
geno = BulkLMM.DelimitedFiles.readdlm(geno_file, ',', header = false);
geno_processed = geno[2:end, 1:2:end] .* 1.0;

###########
# Kinship #
###########
kinship = calcKinship(geno_processed);

########
# Scan #
########

multipletraits_results, heritability_results = bulkscan_null(
	pheno_processed,
	geno_processed,
	kinship,
)

########
# Plot #
########
plot_eQTL(multipletraits_results, pInfo, gInfo; threshold = 5.0);

alt QTL

Contribution

Contributions to BigRiverQTLPlots.jl are welcome and appreciated. If you'd like to contribute, please fork the repository and make changes as you'd like. If you have any questions or issues, feel free to open an issue on the repository.

License

BigRiverQTLPlots.jl is licensed under the GNU AFFERO GENERAL PUBLIC LICENSE. For more information, please refer to the LICENSE file in the repository.

Support

If you have any problems or questions using BigRiverQTLPlots.jl, please open an issue on the GitHub repository. We'll be happy to help!

bigriverqtlplots.jl's People

Contributors

gregfa avatar

Watchers

Saunak Sen avatar

Forkers

gregfa

bigriverqtlplots.jl's Issues

Manhattan plot with points instead of lines

It would be good to have the QTL genome scan plot to be points instead of lines. I tried making the change, but that has two issues.

  • The plot takes a long time to render. I think this is because Julia is plotting every point (50K of them). Clearly, we need a way to "flatten" or compress this figure.
  • I could not change the marker size. The default size looks too big.

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

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.