sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
ffdee6f49874983feae4a4998a6ba8f89735d36b93fe238adb6e7c7b9fc6ce48 | Julia | 1,324 | 66 | ######### Jags line program example ###########
using StatsPlots, Jags, Statistics
ProjDir = joinpath(dirname(@__FILE__))
cd(ProjDir) do
line = "
model {
for (i in 1:n) {
mu[i] <- alpha + beta*(x[i] - x.bar);
y[i] ~ dnorm(mu[i],tau);
}
x.bar <- mean(x[]);
alpha ~ dnorm... |
b07067dd88ad628f01f810b0f272b6e42d71c59cbd8039f51e8116b0cdc9534b | Julia | 1,325 | 66 | ######### Jags line program example ###########
using StatsPlots, Jags, Statistics
ProjDir = joinpath(dirname(@__FILE__))
cd(ProjDir) do
line = "
model {
for (i in 1:n) {
mu[i] <- alpha + beta*(x[i] - x.bar);
y[i] ~ dnorm(mu[i],tau);
}
x.bar <- mean(x[]);
alpha ~ dnorm... |
c76029870fed922ce2c8627b8958990c7f32b89890ff9fd7ff7c8d775df722cf | Julia | 1,335 | 42 | using QSM: GaussSeidel
using QSM: BackwardSweep, ForwardSweep, SymmetricSweep
using QSM: Poisson2, __norm_residual, residual!
@testset "Gauss-Seidel" for T in (Float32, Float64)
Random.seed!(501)
for sz in [(16, 17, 18), (19, 20, 21)]
maxit = 2*prod(sz)
R = CartesianIndices(map(n -> 2:n-1, sz)... |
146bbdafcbe4388caf3fd28bb35852cb51ccd2004e123a9ae421969673f6da6d | Julia | 1,348 | 47 | ## Simulate quartets and aminoacid sequences as in Zou2019
## Using PAML, see notebook.md
## Note that this simulations is hard-coded for quartets only
## (cannot be extended to any size of tree)
## Claudia March 2020
using PhyloNetworks, Random, Distributions, Flux
include("functions-zou2019.jl")
## Input
rseed = 90... |
7ca542648c04a565f332b3151746e5355f5f8aae36e4e4a812572d40b29e54db | Julia | 1,348 | 47 | ## Simulate quartets and aminoacid sequences as in Zou2019
## Using PAML, see notebook.md
## Note that this simulations is hard-coded for quartets only
## (cannot be extended to any size of tree)
## Claudia March 2020
using PhyloNetworks, Random, Distributions, Flux
include("functions-zou2019.jl")
## Input
rseed = 48... |
057ce0b372f2f7bc0d928ccac4b210ab6b4b88dd2d2b8b650b9b42de19c672a7 | Julia | 1,349 | 47 | ## Simulate quartets and aminoacid sequences as in Zou2019
## Using PAML, see notebook.md
## Note that this simulations is hard-coded for quartets only
## (cannot be extended to any size of tree)
## Claudia March 2020
using PhyloNetworks, Random, Distributions, Flux
include("functions-zou2019.jl")
## Input
rseed = 45... |
108506a6f035189df271c791240ef4275f4ad5e9bc5dee9d56112218a4b00c2e | Julia | 1,349 | 47 | ## Simulate quartets and aminoacid sequences as in Zou2019
## Using PAML, see notebook.md
## Note that this simulations is hard-coded for quartets only
## (cannot be extended to any size of tree)
## Claudia March 2020
using PhyloNetworks, Random, Distributions, Flux
include("functions-zou2019.jl")
## Input
rseed = 85... |
391a6d60ba82d37e7be487afaaea8b8eca978aaef72d5f8d39c7d263ac145113 | Julia | 1,349 | 47 | ## Simulate quartets and aminoacid sequences as in Zou2019
## Using PAML, see notebook.md
## Note that this simulations is hard-coded for quartets only
## (cannot be extended to any size of tree)
## Claudia March 2020
using PhyloNetworks, Random, Distributions, Flux
include("functions-zou2019.jl")
## Input
rseed = 23... |
3b8ecd855ea58110394e8a9589c3c5cc70f310b6e281f5c6bfd74d7953f11569 | Julia | 1,349 | 47 | ## Simulate quartets and aminoacid sequences as in Zou2019
## Using PAML, see notebook.md
## Note that this simulations is hard-coded for quartets only
## (cannot be extended to any size of tree)
## Claudia March 2020
using PhyloNetworks, Random, Distributions, Flux
include("functions-zou2019.jl")
## Input
rseed = 66... |
6e6a19c0372200568c3cadb49547b44c31c10aedec2c946f42b9d389fa922796 | Julia | 1,349 | 47 | ## Simulate quartets and aminoacid sequences as in Zou2019
## Using PAML, see notebook.md
## Note that this simulations is hard-coded for quartets only
## (cannot be extended to any size of tree)
## Claudia March 2020
using PhyloNetworks, Random, Distributions, Flux
include("functions-zou2019.jl")
## Input
rseed = 66... |
a88c1e6b3830fd867fe5e55fecba3bb796e902563583bf74e13cd2c246f57c3e | Julia | 1,349 | 47 | ## Simulate quartets and aminoacid sequences as in Zou2019
## Using PAML, see notebook.md
## Note that this simulations is hard-coded for quartets only
## (cannot be extended to any size of tree)
## Claudia March 2020
using PhyloNetworks, Random, Distributions, Flux
include("functions-zou2019.jl")
## Input
rseed = 50... |
adc8f5abd6a0e755573320a7e4d4a82d18755dbae1067b77c53502482f6ea104 | Julia | 1,349 | 47 | ## Simulate quartets and aminoacid sequences as in Zou2019
## Using PAML, see notebook.md
## Note that this simulations is hard-coded for quartets only
## (cannot be extended to any size of tree)
## Claudia March 2020
using PhyloNetworks, Random, Distributions, Flux
include("functions-zou2019.jl")
## Input
rseed = 86... |
d187fe8211372bfc559764d805e17e67f0d97f4e3ec6f45c869fff2b359946fe | Julia | 1,349 | 47 | ## Simulate quartets and aminoacid sequences as in Zou2019
## Using PAML, see notebook.md
## Note that this simulations is hard-coded for quartets only
## (cannot be extended to any size of tree)
## Claudia March 2020
using PhyloNetworks, Random, Distributions, Flux
include("functions-zou2019.jl")
## Input
rseed = 40... |
ee07be72a4397cd97ae0020fd2fc2978c70c35009f590128c9fb15e57d015398 | Julia | 1,349 | 47 | ## Simulate quartets and aminoacid sequences as in Zou2019
## Using PAML, see notebook.md
## Note that this simulations is hard-coded for quartets only
## (cannot be extended to any size of tree)
## Claudia March 2020
using PhyloNetworks, Random, Distributions, Flux
include("functions-zou2019.jl")
## Input
rseed = 91... |
72f29e92be67bb119da1f2e45b36dac784daea71519aef1331da718621edd275 | Julia | 1,350 | 47 | ## Simulate quartets and aminoacid sequences as in Zou2019
## Using PAML, see notebook.md
## Note that this simulations is hard-coded for quartets only
## (cannot be extended to any size of tree)
## Claudia March 2020
using PhyloNetworks, Random, Distributions, Flux
include("functions-zou2019.jl")
## Input
rseed = 03... |
7d5ba8a314bfb27a0b8053c158171f2e711befcf082cbefd880e51f44bd21dba | Julia | 1,350 | 47 | ## Simulate quartets and aminoacid sequences as in Zou2019
## Using PAML, see notebook.md
## Note that this simulations is hard-coded for quartets only
## (cannot be extended to any size of tree)
## Claudia March 2020
using PhyloNetworks, Random, Distributions, Flux
include("functions-zou2019.jl")
## Input
rseed = 01... |
37a9eebb5abdacd0e5f2b875e841686049530a29d313da2482267a83657075da | Julia | 1,359 | 47 | ## Input:
## -- .out files from mcmc bistro with list of sampled trees with branch lengths
## Output:
## -- List of adjacency matrices
## Claudia October 2019
using PhyloNetworks, CSV, DataFrames, LinearAlgebra, HDF5 ##, DelimitedFiles
include("functions.jl")
dat1 = CSV.read("../data/after---0-249.out", delim=' ',ign... |
df827c323f9f25146cf65376037f9e7bd6f327ca0f9228055baab6486435724a | Julia | 1,370 | 51 | function precompile_model()
redirect_stdout(devnull) do
ProjDir = tempdir()
cd(ProjDir) do
line = "
model {
for (i in 1:n) {
mu[i] <- alpha + beta*(x[i] - x.bar);
y[i] ~ dnorm(mu[i],tau);
}
x.bar <- mean(x[]);
... |
77866fca3337957936fdc95113fd1cfc561bcc1c92c5af89c907cf22532b51a9 | Julia | 1,381 | 48 | ## Simulate quartets and aminoacid sequences as in Zou2019
## Using PAML, see notebook.md
## Note that this simulations is hard-coded for quartets only
## (cannot be extended to any size of tree)
## Claudia March 2020
using PhyloNetworks, Random, Distributions, Flux
include("functions-zou2019.jl")
## Input
rseed = 83... |
0b817cc4ba22bdeb1df003a5f28cf51b33fd22bef9bd2fcd859107aef8b9870c | Julia | 1,459 | 72 | ######### Jags batch program example ###########
using StatsPlots, Jags, Statistics
ProjDir = @__DIR__
cd(ProjDir)
dyes = "
model {
for (i in 1:BATCHES) {
for (j in 1:SAMPLES) {
y[i,j] ~ dnorm(mu[i], tau.within);
}
mu[i] ~ dnorm(theta, tau.between);
}
theta ~ dnorm(0.0, 1.0E-10)... |
27e05ad5941b472218abd2e342dc722bc6ec050e63b1d66c07bc797ac75bdaf1 | Julia | 1,472 | 43 | ## Input:
## -- DNA sequences in FASTA file
## Output:
## -- List of simulated {(tree, branch lengths, Q matrix)} along with the likelihood score
## Note that (tree, bl) are represented as adjacency matrix
## Details:
## For i=1,...,nrep, this script will:
## 1) Simulate NJ bootstrap tree T_i from the DNA sequence fi... |
d86d010ffa62ef7d0ceda02b13c3fe91c4a3ac92c25e0708005464e5bcd752ab | Julia | 1,545 | 87 | #=
import Base: *
if !isdefined(Main, :Stan)
function *(c1::Cmd, c2::Cmd)
res = deepcopy(c1)
for i in 1:length(c2.exec)
push!(res.exec, c2.exec[i])
end
res
end
function *(c1::Cmd, sa::Array{String, 1})
res = deepcopy(c1)
for i in 1:length(sa)
push!(res.exec, sa[i])
end
... |
ff7232cf2c10c009dffa4c588716e4a2eaf2b2e0fd440c0f0170e4eca11bf135 | Julia | 1,546 | 70 | module Jags
using Compat, CSV, Pkg, Documenter, DelimitedFiles, Unicode, MCMCChains
using PrecompileTools
#### Includes ####
include("jagsmodel.jl")
include("jagscode.jl")
if !isdefined(Main, :Stanmodel)
include("utilities.jl")
end
if VERSION >= v"1.9"
include("precompile.jl")
@compile_workload begin
... |
f95c967f8c7122b8418bdb2bd190f7e6c28e36932fc563be553acb1c35bfa17a | Julia | 1,570 | 63 | ## Simulate quintets and aminoacid sequences (as in Zou2019,
## but for n=5)
## Using PAML, see notebook.md
## Note that this simulations is hard-coded for quintets only
## (cannot be extended to any size of tree)
## Claudia April 2020
using PhyloNetworks, Random, Distributions, Combinatorics
include("../../simulation... |
498f62c5ea6b9297da5ec28001c9a5da50b09edc73ede23833fbed2d575a026f | Julia | 1,724 | 69 | ProjDir = dirname(@__FILE__)
tmpdir = joinpath(ProjDir, "tmp")
inits1 = [
Dict("alpha" => 0,"beta" => 0,"tau" => 1),
Dict("alpha" => 1,"beta" => 2,"tau" => 1),
Dict("alpha" => 3,"beta" => 3,"tau" => 2),
Dict("alpha" => 5,"beta" => 2,"tau" => 5)
]
function test(init::Array{Dict{String, Int64},1}... |
c593efebbc58bd317270187e847b5f12f9c67e685c14cf9aafcb664efbb10e3b | Julia | 1,786 | 63 | ## Simulate quartets and aminoacid sequences as in Zou2019
## Using PAML, see notebook.md
## Note that this simulations is hard-coded for quartets only
## (cannot be extended to any size of tree)
## Claudia March 2020
using PhyloNetworks, Random, Distributions, Flux
include("functions-zou2019.jl")
## Input
rseed = 03... |
fa758f35b8eae3d85d01049ccaa4cf7028828de329d1f59b16bbd03d0cafd771 | Julia | 1,830 | 66 | ## convert PHYLIP to FASTA
function convertPHYLIP2FASTA(file::String)
lines = readlines(file);
lines = lines[3:end]
lines = string.(">",lines)
rootname = split(file,"phy")[1]
io1 = open(string(rootname,"fasta"), "w")
for l in lines
l2 = split(l,' ')
write(io1,string(l2[1],"\n",l2... |
278553bb52b806de1d30ad08f5b0bb0cf54e4a5bd516a4e16808c0e3193f8eb0 | Julia | 1,932 | 53 | #=
Create/Plot individual velocities
=#
using FileIO, JSON, DataFrames, Statistics, CSV
# perso
push!(LOAD_PATH,"lib")
using Plot_df_cells
# loading
folderDataTrackMate = "../data_tracking/step1_data_trackMate/"
folderDataFilter = "../data_tracking/step2_data_filtered/"
folderDataZone = "../data_tracking/step3_data_z... |
e2a8bfd6af57b986de804d068fabbd146d1cf41e339886a107b761006c205b6d | Julia | 1,997 | 71 | using QSM: Poisson2
using QSM: wrapped_laplacian
using QSM: wrapped_laplacian_boundary_neumann!
using QSM: wrapped_laplacian_boundary_periodic!
using QSM: solve_poisson_dct, solve_poisson_fft, solve_poisson_mgpcg
L2norm(x) = norm(x) / sqrt(length(x))
function test_problem(::Type{T}, sz::NTuple{3, Integer}) where {T<... |
cdc1712b1d902f722008cf2cd247daba1022ec7d12f39fc64daf04bc64a1f97d | Julia | 2,114 | 86 | ######### Jags line program example ###########
using StatsPlots, Jags, Statistics
ProjDir = joinpath(dirname(@__FILE__))
cd(ProjDir) do
line = "
model {
for (i in 1:n) {
mu[i] <- alpha + beta*(x[i] - x.bar);
y[i] ~ dnorm(mu[i],tau);
}
x.bar <- mean(x[]);
alpha ~ dnorm... |
4352ff2a88ee4de9fdd350409133b26dd266197533a7f761a33789276ac463c9 | Julia | 2,583 | 95 | ## Simulate quartets and aminoacid sequences as in Zou2019
## Using PAML, see notebook.md
## Note that this simulations is hard-coded for quartets only
## (cannot be extended to any size of tree)
## Claudia March 2020
using PhyloNetworks, Random, Distributions, Flux, HDF5
include("functions-zou2019.jl")
## Input
rsee... |
2d3c56b0b675600e2c6a869d5839d45fe5021b155233057e4e2bced89935bb02 | Julia | 2,586 | 95 | using QSM: V, W, F, Multigrid, cycle!
using QSM: BackwardSweep, ForwardSweep, SymmetricSweep, EarlyStopping, GaussSeidel
using QSM: restrict!, correct_prolong!
using QSM: residual!, tfill!
#####
##### TODO: Smoothing factor check
#####
@testset "Smoothers" begin
include("smoothers.jl")
end
@testset "Transfer" b... |
37c247dc3dc955f7068c646524a9f044e39cb13f48f71d86d52b2d72d4fc093b | Julia | 2,670 | 111 | using QSM: prolong!, restrict!, restrict_size
using QSM: Poisson2
@testset "Restriction" for T in (Float32, Float64)
Random.seed!(501)
for sz in [(16, 17, 18), (19, 20, 21)]
szc = restrict_size(sz)
R = CartesianIndices(map(n -> 2:n-1, sz))
Rc = CartesianIndices(map(n -> 2:n-1, szc))
... |
1ce8e9c9a89c03902c47fc5c0163f81865c5b4ed926eac21a7c1179c91850368 | Julia | 2,675 | 165 | datafile = "test0.in"
lines = readlines(datafile)
fastafile = "test0.fasta"
io = open(fastafile, "w")
n = length(lines)
l = length(lines[1])
write(io,"$n $l \n")
for i in 1:n
write(io, string(">",i,"\n"))
write(io, lines[i])
write(io, "\n")
end
close(io)
datafile = "test1.in"
lines = readlines(datafile)
fas... |
feb7e852aa2ec16ec4a60c2a62a10fba2310e8f40e676b7ddc191f959e3d7972 | Julia | 2,743 | 74 | #=
Create/Plot individual velocities
=#
using FileIO, JSON, DataFrames
# perso
push!(LOAD_PATH,"lib")
using Create_df_cells
# parameters
#-----------
list_nameExp = ["NPA_stich_3"]
velocity_or_correlation = "correlation" # "velocity" or "correlation"
dist_boundary = 20.0 # in microns
rMax = 80.0 ... |
f747269a5ff198a4d5ec10c2f834c4b1300d6ddab981c56da2e547c977b17ca5 | Julia | 2,820 | 92 | #####
##### Tests copied from IterativeSolvers.jl
##### https://github.com/JuliaLinearAlgebra/IterativeSolvers.jl/blob/v0.9.2/src/lsmr.jl
#####
# Type used in Dampenedtest
# solve (A'A + diag(v).^2 ) x = A'b
# using LSMR in the augmented space à = [A ; diag(v)] b̃ = [b; zeros(size(A, 2)]
struct DampenedMatrix{Tv,TA<:... |
9c9a9a903c4ce31e992dd44a60871981cdf18a56e49fe288191b6abde8ae0706 | Julia | 2,982 | 106 | using StatsPlots, Jags, Statistics
ProjDir = dirname(@__FILE__)
cd(ProjDir) do
## Data
rats = Dict{String, Any}(
"Y" =>
[151 199 246 283 320;
145 199 249 293 354;
147 214 263 312 328;
155 200 237 272 297;
135 188 230 280 323;
159 210 252 298 331;
141 189 231 275... |
5a450ea37fa62de4f83b0e063fa21f7e269efd3d1d06150481c8518785d4eaf2 | Julia | 3,374 | 111 | using QSM: padfastfft, padarray!, unpadarray!
@testset "LSMR" begin
include("lsmr.jl")
end
@testset "Poisson solver" begin
include("poisson_solver/poisson_solver.jl")
end
@testset "Multi-echo" begin
include("multi_echo.jl")
end
@testset "padfastfft and psf2otf" for T in (Float32, Float64)
Random.se... |
5d1e368b4118daa6d3ad944ed803b0da61ee4e5ad7fdaca2937094a3b5289e15 | Julia | 3,402 | 124 | module QSM
using Base: @propagate_inbounds, require_one_based_indexing
using Base.Threads: nthreads
using CPUSummary: num_cores
using DSP: Windows
using FastPow: @fastpow
using IrrationalConstants: inv2π, twoπ
using LinearMaps: LinearMap
using MacroTools: @capture, postwalk
using NIfTI: NIVolume, niread, niwrite
usi... |
a570cc44ab568eea115ff2284d64fd5f995d8f7486bef3af52bf002ed6025c72 | Julia | 3,819 | 99 | #=
Smooth the cell's trajectories
=#
using ProgressMeter
using CSV, JSON, DataFrames, FileIO
using DSP, Statistics
# parameter
list_nameExp = ["NPA_stich_3"]
folderData = "../data_tracking/step1_data_trackMate/"
folderSave = "../data_tracking/step2_data_filtered/"
l = 4 # filter
σ = 2
funct... |
da970151b93c7a3e0c0fe53fe47e0e33e870c1dcee63c38e7c15ee31a060802f | Julia | 4,041 | 121 | @testset "Average" for T in (Float32, Float64)
Random.seed!(501)
for sz in [(8, 9, 10), (11, 12, 13)]
for NT in (1, 2, 5, 6, 12, 32, 48, 96)
y = zeros(T, sz)
x = randn(T, sz..., NT)
t = rand(T, NT)
W = rand(T, sz..., NT)
m = rand(Bool, sz...)
... |
d8f7c269d66ca2262b5b1d0ef0ef8e9eb0947be1a54059610c5cccfab636e6ad | Julia | 4,139 | 187 | abstract type Cycle end
struct V <: Cycle end
struct W <: Cycle end
struct F <: Cycle end
struct Grid{TA, Pre, Post}
A::TA
presmoother::Pre
postsmoother::Post
end
Base.size(grid::Grid) = size(grid.A)
Base.eltype(grid::Grid) = eltype(grid.A)
struct MultigridWorkspace{Tx}
x::Vector{Tx}
b::Vector{... |
94d315cba03b85c60d1e665852842debc49f32d47ebfb81cb62620b1e802de87 | Julia | 4,358 | 171 | """
function ismv(
f::AbstractArray{<:AbstractFloat, N ∈ (3, 4)},
mask::AbstractArray{Bool, 3},
vsz::NTuple{3, Real};
r::Real = 2*maximum(vsz),
tol::Real = 1e-3,
maxit::Integer = 500,
verbose::Bool = false,
) -> Tuple{typeof(similar(f)), typeof(similar(mas... |
6512bf08a8b7ba2a88c4cadeb459df5a929687223c36581d3dcacad3c92941a2 | Julia | 4,560 | 155 | # TODO: input and document
__DEFAULT_LBV_PRE(nlevels::Integer) = ntuple(nlevels-1) do l
Smoothers(
RedBlackGaussSeidel(ForwardSweep(), iter=2^(l-1)),
RedBlackGaussSeidel(BoundarySweep(ForwardSweep()), iter=2^l),
)
end
__DEFAULT_LBV_COARSE() = Smoothers(
RedBlackGaussSeidel(ForwardSweep(), i... |
fc17bf91a7c1941f9e6482def31da8ddedd1cc4c32433fd3674aff74b47f3c04 | Julia | 5,049 | 194 | include("multigrid/utils.jl")
include("multigrid/poisson.jl")
include("multigrid/transfer.jl")
include("multigrid/smoothers.jl")
include("multigrid/multigrid.jl")
include("mgpcg.jl")
function solve_poisson_mgpcg(
d2u::AbstractArray{<:AbstractFloat, N},
mask::AbstractArray{Bool, 3},
dx::NTuple{3, Real};
... |
e8926acda2b1c562fcdcba100c9b0f222968680d98c88249611ac1e515a42415 | Julia | 5,689 | 240 | #####
##### Sweeps
#####
abstract type Sweep end
struct BackwardSweep <: Sweep end
struct ForwardSweep <: Sweep end
struct SymmetricSweep <: Sweep end
struct BoundarySweep{S <: Sweep} <: Sweep end
BoundarySweep() = BoundarySweep{SymmetricSweep}()
BoundarySweep(S::Sweep) = BoundarySweep{typeof(S)}()
#####
##### Smo... |
cb3cf1523c76f33e26af37484f21e7f14cbcc569333b844b79d22fe319ab195c | Julia | 5,834 | 216 | """
pdf(
f::AbstractArray{<:AbstractFloat, N ∈ (3, 4)},
mask::AbstractArray{Bool, 3},
vsz::NTuple{3, Real};
W::Union{Nothing, AbstractArray{<:AbstractFloat, M ∈ (3, N)}} = nothing,
pad::NTuple{3, Integer} = (0, 0, 0),
bdir::NTuple{3, Real} = (0, 0, 1),
Dkernel... |
b2d04de8c1e32912943e34fb797df39d19515b3386379b0dc914b1b9df161691 | Julia | 6,246 | 246 | # CG preconditioners must be symmetric and positive definite.
# Multigrid cycles will satisfy these requirements for V- and W-cycles if
# * Restriction is the adjoint of prolongation (up to scaling)
# * Postsmoothing is performed in reverse order of presmoothing
# * The coarse solver is either exact or symmetric ... |
15617119883be9d57937e2c9288e9bc035e567c9a613bc638e83d074124c093d | Julia | 6,448 | 227 | """
homodyne(
u::AbstractArray{<:Complex{<:AbstractFloat}, N > 1},
wsz::Union{Integer, NTuple{2, Integer}},
window::Symbol,
args...
) -> typeof(similar(u))
homodyne!(
u::AbstractArray{<:Complex{<:AbstractFloat}, N > 1},
wsz::Union{Integer, NTuple{2, Integer}}... |
44ca3de003aa75b6dacb4397bf13757186efc9ec9c9282b185258d9cb9aeffc1 | Julia | 6,647 | 137 | ######### Jags program example ###########
using StatsPlots, Jags, Statistics
ProjDir = joinpath(dirname(@__FILE__))
cd(ProjDir) do
bones = "
model {
for (i in 1:nChild) {
theta[i] ~ dnorm(0.0, 0.001);
for (j in 1:nInd) {
# Cumulative probability of > grade k given theta
... |
f48f188ca19d358027c542e6d0d68b4a458a3d4038f19d4f3d76cfb3ee60b2f1 | Julia | 7,198 | 191 | module Create_df_cells
using Revise
using PyPlot
using FileIO, DataFrames, ProgressMeter, Statistics, LinearAlgebra
# perso
using Winding_number
export create_df_velocity, create_df_velocity_zone, create_df_t_xy_uv_zone,
create_df_correlation, create_df_correlation_zone
""" create the dataframe with all the spee... |
2a37478cc7bb820d4b4416ba3082955892db07680478f216f87cdd4d29fdd6c3 | Julia | 7,219 | 146 | ######### Jags program example ###########
using StatsPlots, Jags, Statistics
ProjDir = dirname(@__FILE__)
cd(ProjDir) do
bones = "
model {
for (i in 1:nChild) {
theta[i] ~ dnorm(0.0, 0.001);
for (j in 1:nInd) {
# Cumulative probability of > grade k given theta
for (k... |
590aeadef4bcca96e5fcea296ad2ad7f2d5ce3789357d12ca34a844099f37cdc | Julia | 7,420 | 281 | function restrict(A::Poisson2{T}) where {T}
interiorc = restrict(A.interior)
sz = size(A.interior)
szc = size(interiorc)
dxc = ((sz .- 1) ./ (szc .- 1)) .* A.dx
return Poisson2(T, interiorc, dxc)
end
function restrict(interior::AbstractArray{Bool, 3})
sz = size(interior)
szc = restrict_siz... |
cadcb7ba2dddaabd10ba49fc06ee77cce4fe859903cecd09e18ae32c9bc4b9de | Julia | 7,720 | 257 | import Base: show
mutable struct Jagsmodel
name::String
ncommands::Int
nchains::Int
adapt::Int
nsamples::Int
thin::Int
jagsthin::Int
monitor::Dict
deviance::Bool
dic::Bool
popt::Bool
model::String
model_file::String
data::Dict{String,Any}
data_file::String
init::Array{Dict{String,Any},1... |
c80c3a0d0cab36602961557e0a56ebcb752cfa7a5a5fb6d2c5f8b530949a43fc | Julia | 8,002 | 274 | """
tkd(
f::AbstractArray{<:AbstractFloat, N ∈ (3, 4)},
mask::AbstractArray{Bool, 3},
vsz::NTuple{3, Real};
pad::NTuple{3, Integer} = (0, 0, 0),
bdir::NTuple{3, Real} = (0, 0, 1),
Dkernel::Symbol = :k,
thr::Real = 0.15,
) -> typeof(similar(f))
Truncated k... |
d4d30f69fc0d34c9ff7f14ceeb298bf8994aa4c999ebc18fb087f1750944f14e | Julia | 8,247 | 267 | """
unwrap_laplacian(
phas::AbstractArray{<:AbstractFloat, N ∈ (3, 4)},
mask::AbstractArray{Bool, 3},
vsz::NTuple{3, Real};
solver::Symbol = :mgpcg
) -> typeof(similar(phas))
Laplacian phase unwrapping [1].
The Laplacian is computed using second order central finite differences... |
48d814cf602ae984028c0ab9cff5ca734c27887cadab7181b6cc752d5f23075f | Julia | 8,416 | 302 | function mis2str(x::Missing) return "NA" end
function mis2str(x::Char) return x end
function mis2str(x) return string(x) end
function jags(
model::Jagsmodel,
data = Dict{String, Any}(),
init = Dict{String, Any}(),
ProjDir=pwd();
updatedatafile::Bool=true,
updateinitfiles::Bool=true
)
try
if update... |
6a68f05666d53536c5827545610f8315ee97e25684569df0541d03cff1e1126e | Julia | 8,746 | 323 | struct Poisson2{T<:AbstractFloat, N, TD<:AbstractArray{Bool, N}, TR8, TR27, TRI}
dx::NTuple{N, T}
idx2::NTuple{N, T}
D::T
iD::T
interior::TD
boundary::TD
R8::TR8
R27::TR27
RI::TRI
end
Poisson2(interior, dx) = Poisson2(Float64, interior, dx)
function Poisson2(
::Type{T},
int... |
0f0e3ff2da0def56b9d03e01a800b3cf6a06ad803c5ffcdc7f455b0a0ddbc352 | Julia | 9,232 | 280 | ## to make seeds odd because PAML needs odd seeds
function makeOdd!(seeds::Vector{Int64})
mod = seeds .% 2
seeds[mod.==0]=seeds[mod.==0] .+ 1
end
## create the control file for PAML
## to simulate aminoacid sequences on a given tree
## note: tree is assumed to be a quartet
## name: name of the output control f... |
5615f4a50dc99363a269a99c332314cdeebebbcde5890072eb8f8603daeeeacf | Julia | 9,239 | 280 | ## to make seeds odd because PAML needs odd seeds
function makeOdd!(seeds::Vector{Int64})
mod = seeds .% 2
seeds[mod.==0]=seeds[mod.==0] .+ 1
end
## create the control file for PAML
## to simulate aminoacid sequences on a given tree
## note: tree is assumed to be a quartet
## name: name of the output control f... |
a16e81734d6774970b131049d6594860312899f5c253318f770d5b4aaf122a03 | Julia | 9,281 | 281 | ## to make seeds odd because PAML needs odd seeds
function makeOdd!(seeds::Vector{Int64})
mod = seeds .% 2
seeds[mod.==0]=seeds[mod.==0] .+ 1
end
## create the control file for PAML
## to simulate aminoacid sequences on a given tree
## note: tree is assumed to be a quartet
## name: name of the output control f... |
164b6d26dfaa17bd402905bc3af5efb6ead8d9b2c4e3755b9db56a065ed6a54d | Julia | 9,363 | 322 | module PIC_method
export PIC_2D, PIC_1D, Ngrid_2D, Ngrid_1D
#=
Particle-In-Cell method to estimate density in 1D/2D:
. nearest-grid: classical 'histogram' (order 1)
. PIC: method of order 2
Input:
. xMin,xMax,yMin,yMax: bounding box
. Δx,Δy: grid size
. x,y: positions partic... |
f4822cf51b1bb0f30f05fe4ff505b054963006f2b5162c99373cacc70febf52d | Julia | 9,697 | 322 | """
rts(
f::AbstractArray{<:AbstractFloat, N ∈ (3, 4)},
mask::AbstractArray{Bool, 3},
vsz::NTuple{3, Real};
pad::NTuple{3, Integer} = (0, 0, 0),
Dkernel::Symbol = :k,
bdir::NTuple{3, Real} = (0, 0, 1),
lstol::Integer = 4,
delta::Real = 0.15,
mu... |
58499f2083544899154fd5c067559ced6ace085a64caceb5b64ba39d26a634ea | Julia | 10,048 | 379 | #####
##### SHARP
#####
"""
sharp(
f::AbstractArray{<:AbstractFloat, N ∈ (3, 4)},
mask::AbstractArray{Bool, 3},
vsz::NTuple{3, Real};
r::Real = 18*minimum(vsz),
thr::Real = 0.05,
) -> Tuple{typeof(similar(f)), typeof(similar(mask))}
Sophisticated harmonic artifact reduc... |
248b8c3852aa84d7544739e32b56a96d6e829eaa7b44e90f0c162c20888611a0 | Julia | 10,176 | 251 | module Plot_df_cells
using Revise
using FileIO, DataFrames, Statistics, LinearAlgebra
using PyPlot
using LaTeXStrings
# perso
using PIC_method
export plot_distri_angle, plot_distri_angle_zones, plot_distri_angle_BeforeAfter
export plot_distri_speed, plot_distri_speed_zones, plot_distri_velocity, plot_corr2D
""" Plo... |
483bb5efd90df05e81e8337f1fd4092e45bfdaad9d840d3c20ed4bf61f895230 | Julia | 11,069 | 402 | #####
##### Gradient, forward finite-differences, periodic boundaries
#####
"""
gradfp(
u::AbstractArray{<:AbstractFloat, 3},
h::NTuple{3, Real}
) -> NTuple{3, typeof(similar(u))}
First order forward difference gradient with periodic boundaries.
### Arguments
- `u::AbstractArray{<:AbstractFlo... |
747a072437d905b15ecd2a5c247994e98763cc3492ceabfbe8b0bedd0d9d5675 | Julia | 11,776 | 430 | #####
##### LSMR implementation copied from IterativeSolvers.jl
##### modified to make it non-allocating and to add multi-threading
##### https://github.com/JuliaLinearAlgebra/IterativeSolvers.jl/blob/v0.9.2/src/lsmr.jl
#####
struct LSMRWorkspace{TA, Tx, Tb, Tw}
A::TA
x::Tx
b::Tb
v::Tw
h::Tw
hb... |
322f698cfb40c178c1ac3e22e41c4e684c57222d0d9864527c02b80deaf6454f | Julia | 12,350 | 382 | """
tv(
f::AbstractArray{<:AbstractFloat, N ∈ (3, 4)},
mask::AbstractArray{Bool, 3},
vsz::NTuple{3, Real};
W::Union{Nothing, AbstractArray{<:AbstractFloat, M ∈ (3, N)}} = nothing,
Wtv::Union{Nothing, AbstractArray{<:AbstractFloat, M ∈ (3, N)}} = nothing,
pad::NTuple{3... |
a268833de9c47bcd23c38b578650907b4446b9e9607d738866b510422b4ed2a9 | Julia | 13,568 | 419 | """
nltv(
f::AbstractArray{<:AbstractFloat, N ∈ (3, 4)},
mask::AbstractArray{Bool, 3},
vsz::NTuple{3, Real};
W::Union{Nothing, AbstractArray{<:AbstractFloat, M ∈ (3, N)}} = nothing,
Wtv::Union{Nothing, AbstractArray{<:AbstractFloat, M ∈ (3, N)}} = nothing,
pad::NTuple... |
556098759955ffc5aebee5aa93ef0716972d6c0e627e1df7afe7a7b662c048cb | Julia | 15,897 | 574 | #####
##### Dipole kernel
#####
"""
dipole_kernel(sz, vsz; kwargs...) =
dipole_kernel(Float64, sz, vsz; kwargs...)
dipole_kernel(
::Type{T<:AbstractFloat},
sz::NTuple{3, Integer},
vsz::NTuple{3, Real};
bdir::NTuple{3, Real} = (0, 0, 1),
method::Symbol = :kspace,... |
fae3b9b6ee1904d970c02c412d18265e9adf02e0b9b8b030c06943832fd1e4e9 | Julia | 16,293 | 559 | #####
##### Average
#####
"""
multi_echo_average(
phas::AbstractArray{<:AbstractFloat, N > 1};
TEs::Union{Nothing, AbstractVector{<:Real}} = nothing,
W::Union{Nothing, AbstractArray{<:AbstractFloat, N}} = nothing,
mask::Union{Nothing, AbstractArray{Bool, N-1}} = nothing,
) -> ty... |
3bbcb408b4be7e6c9e92d9de4034dcb0fc2c31cdbfb4a92883c4946e0e59723d | Julia | 16,890 | 525 | """
r2star_ll(
mag::AbstractArray{<:AbstractFloat, N > 1},
TEs::AbstractVector{<:Real},
mask::Union{Nothing, AbstractArray{Bool, N-1}} = nothing
) -> typeof(similar(mag, size(mag)[1:N-1]))
Log-linear fit.
### Arguments
- `mag::AbstractArray{<:AbstractFloat, N > 1}`: multi-echo magnitud... |
4ae1c7ec7ca868304a9709d868557093b1edbb7733c61fa562f1a0ceb9fbe4a8 | Julia | 18,539 | 795 | include("fd.jl")
include("fsl.jl")
include("kernels.jl")
include("lsmr.jl")
include("multi_echo.jl")
include("poisson_solver/poisson_solver.jl")
include("r2star.jl")
include("swi.jl")
#####
##### FFT helpers
#####
const FAST_FFT_FACTORS = (2, 3, 5, 7)
nextfastfft(n::Real) = nextprod(FAST_FFT_FACTORS, n)
nextfastfft... |
ba5266faa08a740828f01846543a51298436439f3f7c3db810d7a9674da53d1d | Jupyter | 27 | 5 | # %%
import metroem
# %%
|
29d2d013f1868d9a0e636c723e42e8707ca3f1fa9c403df8c1bc9d1ca57c80c2 | Jupyter | 40 | 8 | # %%
print("hello world")
# %%
# %%
|
647bb6022b37d93ad6b51b7c2a834116f1102ef2cfe868c50d93a5253c69e1de | Jupyter | 88 | 2 | # %%
CLUSTER_META = json.load("/fastscratch/verhaak-lab/GLASS-WG/conf/cluster.json")
|
d21e9a6b6d07b269f0a7ca250ce75b4459fe29098badb5166f91068230c063f9 | Jupyter | 106 | 5 | # %%
from sequal.sequence import Sequence
from curtainutils.common import read_fasta
import pandas as pd
|
9234ce5c0c83d861fe386554299203ffedfa39fe10408d89a55e9c8722144f1c | Jupyter | 134 | 14 | # %%
!sh freesolv_graphkernel.sh
# %%
!sh freesolv_seqkernel.sh
# %%
!sh clintox_seqkernel.sh
# %%
!sh sider_graphkernel.sh
# %%
|
0d10407892e8230074055b8e44076065c1e7739c85b36f308ebd71c3dcd61639 | Jupyter | 165 | 11 | # %%
import os
os.chdir('../')
# %%
from DeepPurpose import oneliner
from DeepPurpose.dataset import *
oneliner.virtual_screening(*load_IC50_1000_Samples())
# %%
|
fbc08d43842eaff9a0e99306b822a08c3db245c62f9f389f496905955e2fa06b | Jupyter | 174 | 13 | # %%
%load_ext autoreload
%autoreload 2
%matplotlib widget
# %%
from hnn_core.gui import HNNGUI
from IPython.display import display
gui = HNNGUI()
display(gui.compose())
|
3ac7f31b3560720cc7926979860ba47848b194bfa8cc2529dba0cca5cecad504 | Jupyter | 201 | 12 | # %%
import os
os.chdir('../')
# %%
from DeepPurpose import oneliner
from DeepPurpose.dataset import *
oneliner.repurpose(*load_SARS_CoV2_Protease_3CL(), *load_antiviral_drugs(no_cid = True))
# %%
|
8d1ff75c1942b6b1319c96e8a46ea68b28da5f4a76ffeebbf1708c080b2ab584 | Jupyter | 363 | 45 | # %% [markdown]
# 1. one
# 2. two
# 3. three
# * a
# * b
# * c
# 4. four
# %%
x = 6 * 7 + 12
print(x)
# %% [markdown]
# $\sum_{i=1}^{N} 2^{-i} \approx 1$
# %%
import math
# %%
help(math)
# %%
import numpy
# %%
import pandas
help(pandas)
# %%
! pip install SQLAlchemy
# %%
import SQLAlchemy
# %%
im... |
e2c7e5ea8a08b56d4e39a67dbb8b2c5b4954da84c4ea49a456c3cac1bce98170 | Jupyter | 397 | 25 | # %%
import os
current_dir = os.getcwd()
os.chdir("../../")
# %%
import chromadb
client = chromadb.PersistentClient()
col = client.get_or_create_collection('test_collection')
print(col)
col1=client.get_collection(id=col.id)
print(col1.tenant)
assert col1.id == col.id
assert col1.tenant == col.tenant
assert col... |
4e1c56f320aed4b74e431ef9e3175e454c5a3cd21f40d3a24ba0138cd4c85d5b | Jupyter | 403 | 19 | # %%
import os
os.chdir('../')
# %%
import DeepPurpose.oneliner as oneliner
from DeepPurpose import dataset
# %%
target, target_name = dataset.load_LCK()
# %%
target
# %%
oneliner.repurpose(target = target,
target_name = target_name,
save_dir = './save_folder',
... |
d897223ece85f43514815bf32c2abc3f86587dc5d442e6312cdb86df3a7c9217 | Jupyter | 410 | 23 | # %%
datafile = "dataset/sequences12062021.in"
all_seq = readlines(datafile)
for i in 1:100
lines = all_seq[((i-1)*5+1) : i*5]
fastafile = "fasta/test$i.fasta"
io = open(fastafile, "w")
n = length(lines)
l = length(lines[1])
write(io,"$n $l \n")
for i in 1:n
write(io, string(">",i,"... |
73491872250f3358fe5966f8116985b45f47e5cc4b8be41bb420da65b9ee3fb5 | Jupyter | 414 | 15 | # %%
import os
os.chdir('../')
# %%
from DeepPurpose import oneliner
from DeepPurpose.dataset import *
FILE_PATH = load_AID1706_txt_file()
oneliner.repurpose(*load_SARS_CoV_Protease_3CL(), *load_antiviral_drugs(no_cid = True), *read_file_training_dataset_bioassay(FILE_PATH), \
split='HTS', convert_y = False, fr... |
db2c1dd436c2fab2d1779e6746a43d9fee9bbbe1faeb7b6fb156010237e157ff | Jupyter | 491 | 22 | # %%
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
d = pd.read_table('./Binary_classification_AvsS_accuracy.txt')
# %%
n_boot = 5000
boot = []
# %%
for i in range(n_boot):
boot.append((d['Accuracy']*pd.Series(np.random.random(d.shape[0]) > .5).replace({True:1, False:-1})).mean())
boot = ... |
5ffde22dc15f61d70b73968b19f159893dabdfbbae742be38648fa5408448c94 | Jupyter | 501 | 30 | # %%
from reconstructor_2d.n2self import EllipsesDataset
from model.dncnn import DnCNN
import torch
from torch import nn
# %%
net = DnCNN(1, 1, 3)
opt = torch.optim.SGD(net.parameters(), lr=0.1)
meta_opt = torch.optim.SGD(net.parameters(), lr=0.1)
loss_f = torch.nn.MSELoss()
out = None
inp = torch.rand(7,1,64,64)
# ... |
9b643ef1201ab9a8f07f8d3c24379889b50fb4e61fb4f4f9d042d434caee060f | Jupyter | 524 | 24 | # %%
import yaml
import numpy as np
corners = [(30,1.), ( 37., -9.), (20., 10.), (20, -10)]
spacing = 0.4
electrodes = 10
x, y = [], []
for cx, cy in corners:
for x_ in [*np.linspace(cx,cx+electrodes*spacing,electrodes, endpoint=False)]:
for y_ in [*np.linspace(cy,cy+electrodes*spacing,electrodes, end... |
82caf721d58f6753c68efceb15d7635281be0becefeed8cfce9cdd84b26b416a | Jupyter | 553 | 21 | # %%
import numpy as np
import jPCA
from jPCA.util import load_churchland_data, plot_projections
# %%
# Load publicly available data from Mark Churchland's group
path = "/Users/Bantin/Documents/Stanford/Linderman-Shenoy/jPCA_ForDistribution/exampleData.mat"
datas, times = load_churchland_data(path)
# Create a jPCA ob... |
a6aa30057383fd9e3fd2a77c3f85338b055cff0cfd80f44e99ddbb33c66fbcd6 | Jupyter | 601 | 27 | # %% [markdown]
# Prior to running the below make sure that you have an HF server running:
#
# You can run:
#
# ```bash
# docker compose -f examples/server_side_embeddings/huggingface/docker-compose.yml up -d
# ```
# %%
%cd ../../../
# %%
import chromadb
from chromadb.utils.embedding_functions import HuggingFaceEm... |
5dbf35c4ebb0e323b05409160f2af911f46f984c52e57ab289cbe8bfcd510fee | Jupyter | 672 | 34 | # %%
import json
SAMPLES_META = json.load(open('../data/ref/test_samples.json'))
# %%
bam_files = []
for value in data:
if value["format"] == "BAM":
bam_files.append(value["files"][0]["file_name"])
bam_files
# %%
FQ_FILES = {}
for value in SAMPLES_META:
if value["format"] == "FASTQ":
FQ_FILES... |
3304f4e594be1f0943c3ad609a37a47d6d76d84d4c0ff2a899fc6e8e8dcfca83 | Jupyter | 692 | 35 | # %% [markdown]
# ### install regNet and covTest packages after having downloaded them
# %%
myPath = "/data/bcu_projects/MelBrainSys_PostdocProject_Gruetzmann/publications/2022-my-MelBrainSys-paper/scripts-etc-for-publication/"
# %%
setwd(myPath)
# %% [markdown]
# #### install covTest
# %%
install.packages("bin/cov... |
2f570c89b9ca83baed2c405e5710c5469fc3c3292c728b530104db8c8c3c8590 | Jupyter | 733 | 25 | # %%
%matplotlib inline
import os
from visualize import DatasetVisualizer, get_dataset, display_image, simple_visualizer
from metroem.aligner import Aligner
# %%
data_dir = "~/seunglab/fafbv15_alignment/data/metroem_test/m6"
dataset_mip = 6
stage = 1
checkpoint_name = 'test'
crop_mode = None
device = 'cpu'
dataset = ... |
e2a2413b9cd06c43775f2a8a36575849a49bb61f8d28cd103ab54d51c89dcde1 | Jupyter | 768 | 46 | # %%
import live2p
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import json
import scipy.stats as stats
import sklearn
import h5py
# %%
f0 = h5py.File('d:/hayley/hb119_1/220131/live2p_003/out/realtime_results_plane_0.hdf5')
f1 = h5py.File('d:/hayley/hb119_1/220131/live2p_004/out/realtime... |
8719671d10b13487daa5472882b01af36728eb5c5ea53258dd86013cfc0c1d12 | Jupyter | 777 | 23 | # %%
import os
os.chdir('../')
from DeepPurpose import utils
from DeepPurpose import DTI as models
import gradio
model = models.model_pretrained(model = 'MPNN_CNN_BindingDB')
def DTI_pred(drug, target):
X_pred = utils.data_process(X_drug = [drug], X_target = [target], y = [0],
drug... |
f690d1c2aa5bedb9c808e382ff00609d4c7c9035eda21bad1fe4aff612b2db2a | Jupyter | 788 | 28 | # %%
import torch
from torch_sparse import SparseTensor
# %%
edge_index = torch.tensor([[1, 0, 2, 1, 3, 2],[0, 1, 1, 2, 2, 3]])
pos = torch.tensor([[0,0,0],[1,1,0],[2,0,0],[3,1,0]])
num_nodes = 4
# %%
j, i = edge_index # j->i
# Calculate distances. # number of edges
dist = (pos[i] - pos[j]).pow(2).sum(dim=-1).sqrt(... |
73dae500b0507504e7d42bd4b9bde4cf196dd9b5f472cae91103c985a713bad3 | Jupyter | 835 | 33 | # %%
# Bunch of imports
# System path should be changed to where the git repo is.
import sys
sys.path.append('..')
import tensorflow as tf
import src.models as models
import lattice_filter_op_loader
custom_module = lattice_filter_op_loader.module
# %%
# Set GPU and batch size
# Can set a different batch size, or skip... |
8b1660b3b670ef16b37857b8e9c31876ec27b2e86f821c9434bcec816f4d0060 | Jupyter | 892 | 35 | # %%
# Bunch of imports
# System path should be changed to where the git repo is.
import sys
import tensorflow as tf
import models as models
import lattice_filter_op_loader
custom_module = lattice_filter_op_loader.module
# %%
# Set GPU and batch size
# Can set a different batch size, or skip if CPU
strategy = models.... |
a78bba5ffa15c0988732046066c1d2460971c17a93ee720cdf48731cd941d32a | Jupyter | 951 | 22 | # %%
from dig.oodgraph import GOODCBAS, GOODCMNIST, GOODCora, GOODHIV, GOODMotif, GOODPCBA, GOODZINC, GOODArxiv
# %%
good_hiv, meta_hiv = GOODHIV.load('datasets', 'scaffold', shift='covariate')
good_pcba, meta_pcba = GOODPCBA.load('datasets', 'size', shift='covariate')
good_zinc, meta_zinc = GOODZINC.load('datasets', ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.