Skip to content

Commit

Permalink
Merge pull request #3 from ChelseaTrotter/master
Browse files Browse the repository at this point in the history
Create Binary for Genenetwork, working version for data input in Rqtl2 format
  • Loading branch information
sens authored Oct 28, 2020
2 parents 499bb13 + 575bb93 commit e9631ad
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 285 deletions.
9 changes: 0 additions & 9 deletions bin/MyApp/Project.toml

This file was deleted.

3 changes: 0 additions & 3 deletions bin/MyApp/precompile_app.jl

This file was deleted.

67 changes: 0 additions & 67 deletions bin/MyApp/src/MyApp.jl

This file was deleted.

6 changes: 0 additions & 6 deletions bin/build-bin.jl

This file was deleted.

6 changes: 0 additions & 6 deletions bin/install_packages.jl

This file was deleted.

31 changes: 0 additions & 31 deletions r/Rqtl2scan.R

This file was deleted.

99 changes: 0 additions & 99 deletions r/cleaning.R

This file was deleted.

22 changes: 0 additions & 22 deletions sh/rqtl-julia.sh

This file was deleted.

12 changes: 0 additions & 12 deletions sh/run_lmgpu.sh

This file was deleted.

10 changes: 4 additions & 6 deletions src/LMGPU.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,19 @@ using LinearAlgebra
using Base.Threads
using ZipFile
using CUDA
# using CuArrays
# using CUDAnative
# using CUDAdrv
# import CuArrays.CuArray


#put all your source file here.
include("data_io.jl")
export get_geno_data, get_pheno_data, get_gmap_file
include("util.jl")
include("cpu.jl")
export cpurun
include("gpu.jl")
include("common_func.jl")
include("match_gmap_info.jl")
export get_gmap_info, match_gmap
# include("cli.jl")

#put all your public functions (functions that you want user to use) here.
export get_geno_data, get_pheno_data, cpurun, get_gmap_info, match_gmap #, gpurun

end # module
7 changes: 4 additions & 3 deletions src/cpu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ end


##################### Running CPU Function ###################
function cpurun(a::AbstractArray{<:Real, 2}, b::AbstractArray{<:Real, 2}, n::Int, maxlod::Bool)
function cpurun(a::AbstractArray{<:Real, 2}, b::AbstractArray{<:Real, 2}, n::Int, export_matrix::Bool)
a_std = get_standardized_matrix(a);
b_std = get_standardized_matrix(b);
#step 2: calculate R, matrix of corelation coefficients
Expand All @@ -70,8 +70,9 @@ function cpurun(a::AbstractArray{<:Real, 2}, b::AbstractArray{<:Real, 2}, n::Int
# lod = lod_score(n, r);
lod = lod_score_multithread(n,r)

if maxlod
println("exporting max lod")

if !export_matrix
println("Calculating max lod")
return find_max_idx_value(lod)
else
println("exporting matrix.")
Expand Down
17 changes: 14 additions & 3 deletions src/data_io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,24 @@ end
# return convert(Array{datatype,2}, pheno)
# end

function try_string2num(num)
return tryparse(Float64,num) != nothing
end


function get_pheno_data(file, datatype; transposed=true)

#first column is individual ID such as : BXD1
pheno = readdlm(file, ','; skipstart=1)
#first column is individual ID such as : BXD1 , need to be removed.
pheno = readdlm(file, ','; skipstart=1)[:, 2:end]

if pheno[1,end] == "f" || pheno[1,end] == "m"
@info "Removing sex column of phenotype. "
pheno = pheno[:, 1:end-1]

end

pheno = convert(Array{datatype,2}, pheno)
# pheno = convert2float.(pheno, datatype)

if transposed
return transpose(pheno) |> collect
else
Expand Down
20 changes: 2 additions & 18 deletions src/match_gmap_info.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,8 @@ function extension(url::String)
end
end

function get_gmap_info(rqtl_file)

# if passing in rqtl_file as a zip, extract gmap file.
if extension(rqtl_file) == ".zip"
dir = ZipFile.Reader(rqtl_file)
f = findfile(dir, "gmap.csv")
gmap = readdlm(f, ',')
close(dir)
# if passing in just gmap file.
elseif extension(rqtl_file) == ".csv"
if occursin("gmap.csv", rqtl_file)
gmap = readdlm(rqtl_file, ',')
else
error("no gmap file found.")
end
else
error("Rqtl file is not passed in as a .zip, need to handle this.")
end
function get_gmap_info(gmap_file)
gmap = readdlm(gmap_file, ',', header=true)
return gmap

end
Expand Down

0 comments on commit e9631ad

Please sign in to comment.