Skip to content

Commit 763796c

Browse files
authored
Merge pull request #47 from senresearch/main
Update dev from main
2 parents b4e13b3 + 009a1d6 commit 763796c

36 files changed

+29170
-2476
lines changed

.github/workflows/CompatHelper.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: CompatHelper
2+
on:
3+
schedule:
4+
- cron: 0 0 * * *
5+
workflow_dispatch:
6+
permissions:
7+
contents: write
8+
pull-requests: write
9+
jobs:
10+
CompatHelper:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Check if Julia is already available in the PATH
14+
id: julia_in_path
15+
run: which julia
16+
continue-on-error: true
17+
- name: Install Julia, but only if it is not already available in the PATH
18+
uses: julia-actions/setup-julia@v1
19+
with:
20+
version: '1'
21+
arch: ${{ runner.arch }}
22+
if: steps.julia_in_path.outcome != 'success'
23+
- name: "Add the General registry via Git"
24+
run: |
25+
import Pkg
26+
ENV["JULIA_PKG_SERVER"] = ""
27+
Pkg.Registry.add("General")
28+
shell: julia --color=yes {0}
29+
- name: "Install CompatHelper"
30+
run: |
31+
import Pkg
32+
name = "CompatHelper"
33+
uuid = "aa819f21-2bde-4658-8897-bab36330d9b7"
34+
version = "3"
35+
Pkg.add(; name, uuid, version)
36+
shell: julia --color=yes {0}
37+
- name: "Run CompatHelper"
38+
run: |
39+
import CompatHelper
40+
CompatHelper.main()
41+
shell: julia --color=yes {0}
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }}
45+
# COMPATHELPER_PRIV: ${{ secrets.COMPATHELPER_PRIV }}

.github/workflows/TagBot.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: TagBot
2+
on:
3+
issue_comment:
4+
types:
5+
- created
6+
workflow_dispatch:
7+
jobs:
8+
TagBot:
9+
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: JuliaRegistries/TagBot@v1
13+
with:
14+
token: ${ secrets.GITHUB_TOKEN }
15+
ssh: ${ secrets.DOCUMENTER_KEY }

.github/workflows/ci.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: CI
2+
on:
3+
pull_request:
4+
push:
5+
branches: [main]
6+
jobs:
7+
test:
8+
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
9+
runs-on: ${{ matrix.os }}
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
version:
14+
- '1.6'
15+
- '1' # automatically expands to the latest stable 1.x release of Julia
16+
- 'nightly'
17+
os:
18+
- ubuntu-latest
19+
arch:
20+
- x64
21+
steps:
22+
- uses: actions/checkout@v2
23+
- uses: julia-actions/setup-julia@v1
24+
with:
25+
version: ${{ matrix.version }}
26+
arch: ${{ matrix.arch }}
27+
- uses: actions/cache@v1
28+
env:
29+
cache-name: cache-artifacts
30+
with:
31+
path: ~/.julia/artifacts
32+
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
33+
restore-keys: |
34+
${{ runner.os }}-test-${{ env.cache-name }}-
35+
${{ runner.os }}-test-
36+
${{ runner.os }}-
37+
- uses: julia-actions/julia-buildpkg@v1
38+
- uses: julia-actions/julia-runtest@v1
39+
env:
40+
JULIA_NUM_THREADS: 4
41+
- uses: julia-actions/julia-processcoverage@v1
42+
- uses: codecov/codecov-action@v1
43+
with:
44+
file: lcov.info

Project.toml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,26 @@ version = "0.1.0"
77
BigRiverQTLPlots = "042156b7-ffc6-4e52-80f3-70a9c31dd28f"
88
BulkLMM = "b8d15608-0852-4141-ae38-222578e2ed7b"
99
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
10-
CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597"
1110
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
12-
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
1311
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
1412
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
13+
Missings = "e1d29d7a-bbdc-5cf2-9ac0-f12de2c33e28"
14+
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
1515
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1616
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
1717

18+
[compat]
19+
BigRiverQTLPlots = "0.2"
20+
BulkLMM = "^1.2"
21+
CSV = "0.10, 1"
22+
DataFrames = "0.22, 1"
23+
JSON = "0.21, 1"
24+
Missings = "1"
25+
Reexport = "1.2"
26+
Statistics = "1"
27+
StatsBase = "0.34"
28+
julia = "1"
29+
1830
[extras]
1931
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
2032
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

README.md

Lines changed: 94 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,42 @@
1-
# BigRiverQTL.jl
1+
[![CI](https://github.com/senresearch/BigRiverQTL.jl/actions/workflows/ci.yml/badge.svg?branch=testing)](https://github.com/senresearch/BigRiverQTL.jl/actions/workflows/ci.yml)
2+
[![codecov](https://codecov.io/gh/senresearch/BigRiverQTL.jl/branch/testing/graph/badge.svg?token=uHM6utUQoi)](https://codecov.io/gh/senresearch/BigRiverQTL.jl)
3+
[![Pkg Status](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
24

35

6+
# BigRiverQTL.jl
47

58
*A Statistical Toolbox for QTL Analysis*
69

7-
`BigRiverQTL.jl` is a user-friendly Julia package that supports efficient and interpretable quantitative trait locus (QTL) analysis. This comprehensive toolbox encompasses three core components tailored to streamline the entire QTL analysis workflow: preprocessing, genomic scanning, and result visualization.
10+
`BigRiverQTL.jl` is a user-friendly Julia package that supports
11+
efficient and interpretable quantitative trait locus (QTL)
12+
analysis. This comprehensive toolbox encompasses three core components
13+
tailored to streamline the entire QTL analysis workflow:
14+
preprocessing, genomic scanning, and result visualization.
815

9-
- **Preprocessing:** The preprocessing functions are designed to seamlessly import and convert genomic data into an efficient and memory-conservative format. This component also offers function capabilities for quickly calculating kinship matrices, ensuring data readiness for subsequent analysis phases.
16+
- **Preprocessing:** The preprocessing functions are designed to
17+
seamlessly import and convert genomic data into an efficient and
18+
memory-conservative format. This component also offers function
19+
capabilities for quickly calculating kinship matrices, ensuring data
20+
readiness for subsequent analysis phases.
1021

11-
- **Genomic Scanning:** `BigRiverQTL.jl` provides advanced genomic scanning capabilities through `BulkLMM.jl` for swift single-trait scans, which surpass other methods in terms of computational speed. For analyses involving multiple traits, the package employs `FlxQTL.jl`, a cutting-edge approach that detects complex trait interrelations.
22+
- **Genomic Scanning:** `BigRiverQTL.jl` provides advanced genomic
23+
scanning capabilities through `BulkLMM.jl` for swift single-trait
24+
scans, which surpass other methods in terms of computational
25+
speed. For analyses involving multiple traits, the package employs
26+
`FlxQTL.jl`, a cutting-edge approach that detects complex trait
27+
interrelations.
1228

13-
- **Result Visualization:** The third component of `BigRiverQTL.jl` enriches the analytical experience by offering plotting tools designed to illustrate the outcomes of genomic scans. The plotting functions are useful for interpreting the results and aid in the derivation of meaningful conclusions
29+
- **Result Visualization:** The third component of `BigRiverQTL.jl`
30+
enriches the analytical experience by offering plotting tools
31+
designed to illustrate the outcomes of genomic scans. The plotting
32+
functions are useful for interpreting the results and aid in the
33+
derivation of meaningful conclusions
1434

1535

1636
## Installation
17-
To install `BigRiverQTL.jl`, you can use Julia's package manager. Here is the command:
37+
38+
To install `BigRiverQTL.jl`, you can use Julia's package manager. Here
39+
is the command:
1840

1941
```julia
2042
using Pkg
@@ -24,61 +46,78 @@ Pkg.add("BigRiverQTL")
2446

2547

2648
## Contribution
27-
Contributions to BigRiverQTL.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
2849

50+
Contributions to BigRiverQTL.jl are welcome and appreciated. If you
51+
would like to contribute, please fork the repository, make your
52+
changes, and send us a pull request. If you have a question or think
53+
you have found a bug, please open an issue.
2954

30-
## Examples
31-
```julia
32-
using Pkg
33-
Pkg.activate("../")
34-
```
3555

56+
# Example QTL
57+
___
3658

37-
```julia
38-
using Revise
39-
```
59+
This example is also available as a
60+
[notebook](example/example_qtl.ipynb) in the 'example' directory.
61+
62+
## Data
63+
64+
In this example, we will use a dataset available from the `R/qtl2`
65+
package. Specifically, we will use the BXD dataset, which is obtained
66+
from the [GeneNetwork](https://genenetwork.org/) website.
67+
68+
You can download the BXD genotype data from the following link:
69+
[Download BXD Genotype
70+
Data](https://raw.githubusercontent.com/rqtl/qtl2data/master/BXD/bxd.zip)
71+
72+
73+
### Example - BXD
4074

4175

4276
```julia
43-
using BigRiverQTLPlots
44-
using BulkLMM
45-
using Random, Statistics
46-
using Plots
47-
using Helium
77+
# Libraries
4878
using BigRiverQTL
49-
using CSV
50-
using DataFrames
79+
using Plots
5180
```
5281

82+
#### Data
5383

54-
```julia
55-
##############
56-
# BXD spleen #
57-
##############
84+
We assume that the data is stored in `..\data\BXD` directory.
5885

86+
87+
```julia
5988
########
6089
# Data #
6190
########
6291
data_dir = joinpath(@__DIR__, "../data/BXD/");
6392
file = joinpath(data_dir, "bxd.json");
6493
```
6594

95+
Load bxd data using the function `get_geneticstudydata()`:
96+
6697

6798
```julia
68-
# Transforming data to a optimised and accessible data type
99+
# Load bxd data
69100
data = get_geneticstudydata(file);
70101
```
71102

72103

73104
```julia
74-
gInfo=data.gmap;
75-
pInfo=data.phenocov;
76-
pheno=data.pheno;
77-
pheno=data.pheno.val;
78-
geno=data.geno.val[1];
79-
geno_processed=convert(Array{Float64}, geno);
105+
# Data types
106+
# makers info
107+
gInfo = data.gmap;
108+
# pehnotype info
109+
pInfo = data.phenocov;
110+
# phenotype values
111+
pheno = data.pheno.val;
112+
113+
# We can get the genotype matrix using the following command:
114+
geno = reduce(hcat, data.geno.val);
115+
# For computing reasons, we need to convert the geno matrix in Float64
116+
geno_processed = convert(Array{Float64}, geno);
80117
```
81118

119+
#### Preprocessing
120+
82121

83122
```julia
84123
#################
@@ -87,17 +126,22 @@ geno_processed=convert(Array{Float64}, geno);
87126
traitID = 1112;
88127
pheno_y = pheno[:, traitID];
89128
pheno_y2=ones(length(pheno_y));
90-
pheno_y2[findall(x->x!=nothing,pheno_y)]=pheno_y[findall(x->x!=nothing,pheno_y)];
129+
idx_nothing = findall(x->x!=nothing,pheno_y)
130+
pheno_y2[idx_nothing]=pheno_y[idx_nothing];
91131
```
92132

133+
#### Kinship
134+
93135

94136
```julia
95137
###########
96138
# Kinship #
97139
###########
98-
kinship = kinship_gs(geno_processed,.99)
140+
kinship = kinship_gs(geno_processed,.99);
99141
```
100142

143+
#### Scan
144+
101145

102146
```julia
103147
########
@@ -113,14 +157,24 @@ single_results_perms = scan(
113157
);
114158
```
115159

160+
#### Preprocessing
161+
162+
#### Plots
163+
116164

117165
```julia
118-
########
119-
# Plot #
120-
########
166+
#########
167+
# Plots #
168+
#########
121169

122-
plot_QTL(single_results_perms, gInfo)
170+
# QTL plots
171+
plot_QTL(single_results_perms, gInfo, mbColname = "Pos")
123172

173+
```
174+
![image](images/QTL_example.png)
124175

176+
```julia
177+
# Manhattan plots
178+
plot_manhattan(single_results_perms, gInfo, mbColname = "Pos")
125179
```
126-
[]()
180+
![image](images/manhattan_example.png)

0 commit comments

Comments
 (0)