meringlab / FlashWeave.jl

Inference of microbial interaction networks from large-scale heterogeneous abundance data
Other
70 stars 8 forks source link

first test with test set #15

Closed tapj closed 4 years ago

tapj commented 4 years ago

I have this error when I try FlasWeave. Any idea how to fix this ?

julia> data_path = "HMP_SRA_gut_tiny.tsv"
"HMP_SRA_gut_tiny.tsv"

julia> meta_data_path = "HMP_SRA_gut_tiny_meta.tsv"
"HMP_SRA_gut_tiny_meta.tsv"

julia> netw_results = learn_network(data_path, meta_data_path, sensitive=true, heterogeneous=false)

### Loading data ###

ERROR: MethodError: Cannot `convert` an object of type SubString{String} to an object of type Float64
Closest candidates are:
  convert(::Type{T}, ::T) where T<:Number at number.jl:6
  convert(::Type{T}, ::Number) where T<:Number at number.jl:7
  convert(::Type{T}, ::Base.TwicePrecision) where T<:Number at twiceprecision.jl:250
  ...
Stacktrace:
 [1] setindex!(::Array{Float64,2}, ::SubString{String}, ::Int64) at ./array.jl:826
 [2] copyto!(::Array{Float64,2}, ::Array{Any,2}) at ./multidimensional.jl:962
 [3] Array{Float64,2}(::Array{Any,2}) at ./array.jl:541
 [4] load_dlm(::String, ::String; transposed::Bool, type_data::Bool) at /home/julien/.julia/packages/FlashWeave/HO8wt/src/io.jl:172
 [5] load_data(::String, ::String; transposed::Bool, otu_data_key::String, meta_data_key::String, otu_header_key::String, meta_header_key::String) at /home/julien/.julia/packages/FlashWeave/HO8wt/src/io.jl:38
 [6] learn_network(::String, ::String; otu_data_key::String, otu_header_key::String, meta_data_key::String, meta_header_key::String, verbose::Bool, transposed::Bool, kwargs::Base.Iterators.Pairs{Symbol,Bool,Tuple{Symbol,Symbol},NamedTuple{(:sensitive, :heterogeneous),Tuple{Bool,Bool}}}) at /home/julien/.julia/packages/FlashWeave/HO8wt/src/learning.jl:297
 [7] top-level scope at REPL[4]:1
jtackm commented 4 years ago

Curious, this code works for me. Which version of FlashWeave are you using? You can check by typing ] followed by st and looking for the FlashWeave entry. And what do you see if you type versioninfo()?

tapj commented 4 years ago

thank you for your prompt reply, here there are:

(v1.1) pkg> st
    Status `~/.julia/environments/v1.1/Project.toml`
  [2be3f83a] FlashWeave v0.15.0
julia> versioninfo()
Julia Version 1.1.0
Commit 80516ca202 (2019-01-21 21:24 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, broadwell)
tapj commented 4 years ago

I tested with another computer, and I have the same issue

(@v1.4) pkg> st
Status `~/.julia/environments/v1.4/Project.toml`
  [2be3f83a] FlashWeave v0.15.0

julia> versioninfo()
Julia Version 1.4.1
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Core(TM) i5 CPU       M 540  @ 2.53GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-8.0.1 (ORCJIT, westmere)
jtackm commented 4 years ago

Thanks for the checks. This is definitely a weird one, your FlashWeave version is the latest release and I can't reproduce the error on any of my Julia setups (Julia 1.0, 1.3, 1.4, 1.5beta1). Note that the input data you are using is supposed to error with a different error message (ERROR: Dataset has an insufficient number of observation [...]) at a later step than indicated in your original post. Just to double check, you are getting a ERROR: MethodError: Cannotconvert[...] as reported above in all cases you tried?

Perhaps you can also try using the latest master (] + add FlashWeave#master) to see if that helps.

tapj commented 4 years ago

add FlashWeave#master

fix the issue, I have now the expected error that you mentionned above. thank you!

jtackm commented 4 years ago

Okay, but this is still very strange, the tagged version should work (and passed all automated integration tests). Perhaps something went wrong with your previous install, I will keep my eye open on this. I can soon tag a new version so you don't have to work on #master which does change and break from time to time.

jtackm commented 4 years ago

I just tagged a new release, once it has been merged (within the next couple of days) you can just install the new FlashWeave version 0.16.0 (rm Flashweave -> add FlashWeave) to get a stable installation.

tapj commented 4 years ago

all went fine!

(@v1.4) pkg> update FlashWeave
   Updating registry at `~/.julia/registries/General`
   Updating git-repo `https://github.com/JuliaRegistries/General.git`
  Installed QuadGK ───── v2.4.0
  Installed FlashWeave ─ v0.16.0
   Updating `~/.julia/environments/v1.4/Project.toml`
  [2be3f83a] ↑ FlashWeave v0.15.0 ⇒ v0.16.0
   Updating `~/.julia/environments/v1.4/Manifest.toml`
  [2be3f83a] ↑ FlashWeave v0.15.0 ⇒ v0.16.0
  [1fd47b50] ↑ QuadGK v2.3.1 ⇒ v2.4.0

(@v1.4) pkg> st
Status `~/.julia/environments/v1.4/Project.toml`
  [2be3f83a] FlashWeave v0.16.0

julia> using FlashWeave
[ Info: Precompiling FlashWeave [2be3f83a-7913-5748-9f20-7d448995b934]

julia> data_path = "HMP_SRA_gut_tiny.tsv"
"HMP_SRA_gut_tiny.tsv"

julia> meta_data_path = "HMP_SRA_gut_tiny_meta.tsv"
"HMP_SRA_gut_tiny_meta.tsv"

julia> netw_results = learn_network(data_path, meta_data_path, sensitive=true, heterogeneous=false)

### Loading data ###

Inferring network with FlashWeave - sensitive (conditional)

Run information:
sensitive - true
heterogeneous - false
max_k - 3
alpha - 0.01
sparse - false
workers - 1
OTUs - 19
MVs - 3

### Normalizing ###

Removing variables with 0 variance (or equivalently 1 level) and samples with 0 reads
Discarded 2 samples and 0 variables.

Normalization

### Learning interactions ###

Automatically setting 'n_obs_min' to 20 for enhanced reliability.
ERROR: Dataset has an insufficient number of observations, need at least 20 ('n_obs_min') for reliable tests. Try using a smaller 'max_k' parameter (at the cost of higher numbers of indirect associations).
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] prepare_lgl(::Array{Float32,2}, ::String, ::Float64, ::String, ::Bool, ::Int64, ::Int64, ::Int64, ::Bool, ::Bool, ::Bool, ::Bool, ::String, ::String) at /home/julien/.julia/packages/FlashWeave/16aV0/src/learning.jl:66
 [3] LGL(::Array{Float32,2}; test_name::String, max_k::Int64, alpha::Float64, hps::Int64, n_obs_min::Int64, max_tests::Int64, convergence_threshold::Float64, FDR::Bool, parallel::String, fast_elim::Bool, no_red_tests::Bool, weight_type::String, edge_rule::String, nonsparse_cond::Bool, verbose::Bool, update_interval::Float64, edge_merge_fun::typeof(FlashWeave.maxweight), tmp_folder::String, debug::Int64, time_limit::Float64, header::Array{String,1}, meta_variable_mask::Nothing, dense_cor::Bool, recursive_pcor::Bool, cache_pcor::Bool, correct_reliable_only::Bool, feed_forward::Bool, track_rejections::Bool, all_univar_nbrs::Nothing) at /home/julien/.julia/packages/FlashWeave/16aV0/src/learning.jl:213
 [4] macro expansion at ./util.jl:308 [inlined]
 [5] learn_network(::Array{Any,2}; sensitive::Bool, heterogeneous::Bool, max_k::Int64, alpha::Float64, conv::Float64, header::Array{String,1}, meta_mask::BitArray{1}, feed_forward::Bool, normalize::Bool, track_rejections::Bool, verbose::Bool, transposed::Bool, prec::Int64, make_sparse::Bool, make_onehot::Bool, max_tests::Int64, hps::Int64, FDR::Bool, n_obs_min::Int64, cache_pcor::Bool, time_limit::Float64, update_interval::Float64, parallel_mode::String) at /home/julien/.julia/packages/FlashWeave/16aV0/src/learning.jl:442
 [6] learn_network(::String, ::String; otu_data_key::String, otu_header_key::String, meta_data_key::String, meta_header_key::String, verbose::Bool, transposed::Bool, kwargs::Base.Iterators.Pairs{Symbol,Bool,Tuple{Symbol,Symbol},NamedTuple{(:sensitive, :heterogeneous),Tuple{Bool,Bool}}}) at /home/julien/.julia/packages/FlashWeave/16aV0/src/learning.jl:312
 [7] top-level scope at REPL[9]:1

julia> versioninfo()
Julia Version 1.4.1
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Core(TM) i5 CPU       M 540  @ 2.53GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-8.0.1 (ORCJIT, westmere)

julia>