sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
17k
content
stringlengths
1
200k
2455742f1fd60a9a7e7cf5f87e083070fc4ea8c7e696725898ddd57c8b8288d4
MATLAB
493
15
classdef FreedmanLane < nla.net.mcc.Base properties (Constant) name = "Freedman-Lane" end methods function [is_sig_vector, p_max] = correct(obj, net_atlas, input_struct, prob) p_max = input_struct.prob_max; is_sig_vector = prob.v < p_max; end ...
8d39f4585dbc5af5f39abe50d4abe8e03a5af76951c42c7f94abe19c69bf69c8
MATLAB
493
15
function data_down_sampled = loc_list_down_sample(data,scatter_num) if length(data.x_data)>scatter_num vec = 1:length(data.x_data); vec = vec(randperm(length(vec))); I = vec(1:scatter_num); data_down_sampled.x_data = data.x_data(I); data_down_sampled.y_data = data.y_data(I); data_down...
ddd93a9f00cc6ab7fcf07294dc40ace1baef11e74547fa04079186c68ec2a998
MATLAB
493
20
function m_out = resQ_unitSwap(m_in, mode) % function m_out = resQ_unitSwap(m_in, mode) b_nrm = 1e-9; m_nrm = 1e-13; % S0 D R Vi Vir Va Var Xi Xa f = [1 b_nrm m_nrm b_nrm^2 m_nrm^2 b_nrm^2 m_nrm^2 (b_nrm*m_nrm) (b_nrm*m_nrm)]; switch mode case...
e9031c981d9f247ea72da1119d9bc3bd0b0cfb4ea7b26b57fe434e330ce07af7
MATLAB
494
15
classdef WestfallYoung < nla.net.mcc.Base properties (Constant) name = "Westfall-Young" end methods function [is_sig_vector, p_max] = correct(obj, net_atlas, input_struct, prob) p_max = input_struct.prob_max; is_sig_vector = prob.v < p_max; end ...
fe2c06a956711b0e8e3f685d953047882a964d5e1698b43d0f9bd902ea36e2a3
MATLAB
495
14
function spm_batch = tc_make_spm_contrast_batch %% spm_batch = tc_make_spm_contrast_batch spm_batch = {[]}; spm_batch{1}.spm = []; spm_batch{1}.spm.stats = []; spm_batch{1}.spm.stats.con = []; spm_batch{1}.spm.stats.con.spmmat = {[]}; spm_batch{1}.spm.stats.con.consess = {[]}; spm_batch{1}.spm.stats.con.consess{1}.tc...
120fe253e80a0c1b989f8478146d17e8460f1d8168da1dd90f724e916386c648
MATLAB
496
16
function data_scaled = loc_list_multiply_by_number(data) answer = inputdlg({'Number:'},'Input',[1 50],{'116'}); if isempty(answer)~=1 number = str2double(answer{1}); data_scaled = cell(1,length(data)); for i = 1:length(data) data_scaled{i} = loc_list_scale_data_inside(data{i},number); end...
431878c7e5f34cbf0693d97ce4ff2a5fcc80982b8771bbbbf671dfed5d89a8a8
MATLAB
497
16
function [sndx,ssize,nslices] = pl_sliceblocks(n,slicesize) % % Slices a dimension of size n into slices of size 'slicesize' % This function is part of the permutationlab software: % Author: Dimitrios Pantazis % The code is currently under development, please do not share nslices = ceil(n/slicesize); for s...
ad2c3284c7f9694b2f274313498e854a119e50180636e57b155eb5fa1bc6762d
MATLAB
497
17
function txt=SurfStatDataCursor(empt,event_obj) pos=get(event_obj,'Position'); h=get(event_obj,'Target'); v=get(h,'Vertices'); x=get(h,'FaceVertexCData'); id1=min(find(v(:,1)==pos(1)&v(:,2)==pos(2)&v(:,3)==pos(3))); tag=get(get(h,'Parent'),'Tag'); [s,a,id0]=strread(tag,'%s %d %d'); id=id1+id0 txt = {['x: ',num...
310fff674d179e0859f7a548d801b18200dbdf35821648c58ae6fb69dadd4f02
MATLAB
501
18
function channel_data = loc_list_show_in_channels(data) areas = logspace(0,1,length(data)); for i = 1:length(data) x{i} = data{i}.x_data; y{i} = data{i}.y_data; area{i} = areas(i)*ones(length(data{i}.x_data),1); end x = vertcat(x{:}); y = vertcat(y{:}); area = vertcat(area{:}); channel_data{...
15cefa73c3776ce6b12e085cd799beb42cbf9f2aae0de6c27ced73604b579562
MATLAB
503
13
function inputs = genBaseInputs() %GENBASEINPUTS Generate struct of required network-level inputs with % default values inputs = struct(... 'no_permutations', true,... 'full_connectome', true,... 'within_network_pair', true,... 'prob_plot_method',nla.gfx.ProbPlotMethod.DEFA...
ec35ae95fd7d80fb1f22d5b663cc49451c7b6476cbffdc3fcabeb11505a23226
MATLAB
504
17
function astroGpe = gp_display_out_2p(Gpe,labeled,scaleBar) % Displays the groupe of astrocytes specified in 'Gpe' % 25/03/2019 astroGpe = zeros(size(labeled)); for Ag = 1:length(Gpe) Agrp = Gpe(Ag); % x = find(labeled == Ag); astroGpe(labeled == Agrp)=1; end % Add scale bar 100µm % insertShape(ast...
f582d2f0d82a1ffdfc5248d6e5a0d505c23a5e3421c523fec6d852ba113cb5c3
MATLAB
506
15
function [id, r_, G_] = set_all_part_traj_v2(pnts, G, dist_thr, num_sources, N, m0, P0) M=length(pnts); dist_sources=zeros(1,N); r_=zeros(3*num_sources,N); G_=zeros(size(G,1),num_sources,N); min_dist = 0; r_1 = repmat(m0, [1 N]) + chol(P0)*randn(3*num_sources, N); for j=1:N pos = reshape(r_1(:,j), [3 num_sources])'...
93641de5dea153c29bcdcce57392e043608f8ad763f41c7d14e3bf5070989c00
MATLAB
508
21
function bst_create_test_protocol(use_default_anatomy) if nargin < 1 use_default_anatomy = 0; end %% Ensure that nst_utest protocol exists ProtocolName = 'nst_utest'; % Delete existing protocol db_dir = bst_get('BrainstormDbDir'); gui_brainstorm('DeleteProtocol', ProtocolName); nst_protocol_dir = fullfile(db_dir...
3c929ebcd9d89fe37d5c5f07d557dd0ca785b38d54e37080f452e5507e0bdfe7
MATLAB
512
19
function DynamicBC_write_NIFTI(dat,vm,outname) datdims = size(dat); if length(datdims)==3 v1 = vm(1); v1.dt = [16,0]; v1.n=[1,1]; v1.fname = outname; spm_write_vol(v1,dat); elseif length(datdims)==4 for i = 1:datdims(4) v1(i) = vm(1); v1(i).dt = [16,0]; v1(i)....
99355f3c0d5a5036a94597b465ac6508637648149f3cc60a01a07f2a9487ee78
MATLAB
514
11
function [startend epidur]=SleepEpisodes(sleep,maxep,mindur,ba) sleep=find(sleep>0); sleep=[sleep maxep]; dif=diff(sleep); dif1=find(dif>ba+1); endvs=sleep(dif1); startvs=dif1+1; startvs=[1 startvs maxep]; nepivs=diff(startvs); nepi1vs=find(nepivs>mindur); % episodes longer than interruption epidurvs=n...
f1711a3e29acae0855fbb3677de04abcef536328c820b7485094a26635d984d5
MATLAB
515
14
function distances = euclidianDistanceROIs(network_atlas) pos_vec = [network_atlas.ROIs(1:network_atlas.numROIs()).pos]'; dist_comp_sum = zeros(network_atlas.numROIs(), network_atlas.numROIs()); compute_dist_component = @(a, b) (a - b) .^ 2; for dim = 1:3 pos_comp = pos_vec(:, dim); dis...
6540b3daebb084f8d44e2bd5a4922860803c34074b8da3ad9e8858146f299028
MATLAB
517
6
function now_print_requested_and_real_times(o) fprintf(1, '------------ Requested timing parameters: ------------ \n'); fprintf(1, 'DurPre = %5.3f DurPost = %5.3f DurPi = %5.3f [ms]\n\n', o.durationFirstPartRequested, o.durationSecondPartRequested, o.durationZeroGradientRequested); fprintf(1, '------------ Actual...
ecfad66e664ed9f79412c4d0e826a020778024115882088121fa5003c844e836
MATLAB
518
27
function shape = resQ_1x6_to_shape(a, b) % function shape = resQ_1x6_to_shape(a, b) % By Filip Sz % Funciton returns the shape of the outer product of a * b % It is (A'*B):shear / (A'*B):bulk / 2 if nargin < 2 b = a; end E_iso = eye(3)/3; E_bulk = E_iso(:) * E_iso(:)'; E_shear = eye(9)/3 - E_bulk; n = s...
83569f13198c05ac92ecda40bab0a7055a74900a833a3400ee324099ab66f944
MATLAB
520
24
function link = Which_Link_ThisMCIndex(index, MC) % FUNCTION link = Which_Link_ThisMCIndex(index, MC) returns the directed % link i=link(1) to j=link(2) corresponding to index in the meta-connectivity % (MC) representation. M = size(MC,1); nregions = (1 + sqrt(1+4*M))/2; if index > M disp('please provide valide ...
2773595f789d2698b55f331637c91552a1556ec90f7ce22022c6f3a81d98e78c
MATLAB
521
19
function to_group = find_groups(classes,parameters,link,coefficient_of_variation) if length(link)>1 i = 1; while true i = i+1; if i <= length(link) to_check = classes(link(1:i),2); to_check = vertcat(to_check{:}); variation = abs(std(to_check,0,1)./mea...
2ef5f707aa3a436c824916860bc04c6c85f1ff885bbc1500b89eb532f632404a
MATLAB
521
20
function spt_tracks_change_tracks_time(data) input_values = inputdlg({'Tracks Time Step:'},'',1,{'0.05'}); if isempty(input_values)==1 return else time_step = str2double(input_values{1}); for i = 1:length(data) for j=1:length(data{i}.tracks) data{i}.tracks{j} = chnage_tracks_time...
c79699dcb1ba0d7ff2975d87f02a40ad45d031e12d92647ca3f3c0d23dd655f0
MATLAB
521
14
classdef BenjaminiHochberg < nla.net.mcc.Base properties (Constant) name = "Benjamini-Hochberg" end methods function [is_sig_vector, p_max] = correct(obj, net_atlas, input_struct, prob) [is_sig_vector, p_max] = nla.lib.fdr_bh(prob.v, input_struct.prob_max, 'pdep'); e...
0c30d9c82235b93a86d917a8ff9cfa499734b9ce342565fd3496d297ac11691c
MATLAB
523
12
function x = findOriginXFromTwoTangents(a, b, rad_a, rad_b) %FINDORIGINXFROMTWOTANGENTS Find circle origin X position from two % tangent lines on the circle % a: x-y coordinate, tangent point a % b: x-y coordinate, tangent point b % rad_a: angle from circle origin to tangent point a % ra...
384e02ef84e563e2a2233e43136ffb21bad768baf2357b1ed3bbaa38ea3113fc
MATLAB
523
14
classdef BenjaminiYekutieli < nla.net.mcc.Base properties (Constant) name = "Benjamini-Yekutieli" end methods function [is_sig_vector, p_max] = correct(obj, net_atlas, input_struct, prob) [is_sig_vector, p_max] = nla.lib.fdr_bh(prob.v, input_struct.prob_max, 'dep'); ...
7b9cb471acedda6cc940f319a3a1ea0f212098541bf3cfe6e5b4a67c405d61c9
MATLAB
523
11
function write_surface(surface,file) % WRITE_SURFACE Reads surface from disk. % % surf_out = WRITE_SURFACE(surface,path) writes the surface to a file. % Accepted file formats are .gii, .mat, .obj. Any file that does not end % in one of those extensions will be encoded as a Freesurfer file. % % For complete d...
51146ba999a6c850a78951371061bdae1063f8e321278a749f5e94f4298c5ec7
MATLAB
528
15
function [ams ass pns] = assemble_paths(assembly_paths, contig_direct, Assemblies, deltafiles,deltafiles_ref, Ref_chrom, overlap) if isa(assembly_paths,'double') assembly_paths = {assembly_paths}; end ams = cell(size(assembly_paths)); ass = cell(size(assembly_paths)); pns = cell(size(assembly_paths)); for li = ...
04a7fdc6433a671581e71a4be4e8399349af1ce5a5e6d6a91a22ac971b7ae800
MATLAB
535
13
prot = tblread('L:\Davi\Christina\Elite\allPeptides.txt','\t') prot = tblread('L:\Results\Ishita\Copy of Log2abs0.5 GO.txt','\t'); prot = tblread('L:\Results\Ishita\Copy of Log2abs0.5 GO Col Znorm.txt','\t'); protcl=prot(:,1:12); [x, fval, exitflag, output] = fminunc(fun,x0,'Algorithm','quasi-newton') cubic = @(x)...
9ce63c338153f13980f31c78508e9c3c8abe65bfe916975165afba2861cdb2a0
MATLAB
538
29
function [data, A] = five_source_model(T) M = 5; %number of sources; P=2; %order of the model T0=1000; %length of ignored start %Generate stable AR matrix lambdamax=10; while lambdamax > 1 || lambdamax < 0.9 A=[]; for k=1:P aloc = zeros(M); aloc([1 7 13 19 25]) = -0.9; %diagonal elements a...
6a634a954cadabcb148b66f222ee7ec1bbcfc62195b1cf4a9184d8adfd6039d2
MATLAB
540
27
function [bastend badur]=BriefAwakenings(wake,maxep) mindur=1; maxdur=4; wake=find(wake>0); wakep=[wake maxep]; dif=diff(wake); dif1=find(dif>1); endvs=wake(dif1); startvs=dif1+1; startvs=[1 startvs maxep]; nepivs=diff(startvs); nepi1vs=find(nepivs>=mindur); epidurvs=nepivs(nepi1vs); startep=wake(startvs(nepi...
672edf74f623e7de59a4901120f8fd7086d38f0704b604fefadc3d2dd48992ff
MATLAB
541
11
function coefficient_of_variation = shape_classification_iterative_clustering_input_coeff_var(classes) input_values = inputdlg({'Lengh Coeff. of Variation Threshold:','Width Coeff. of Variation Threshold:'},'',1,{'0.15','0.15'}); if isempty(input_values)~=1 size_c_o_v = size(classes{1,3},2); coefficient_of_...
385f8a2afdb3413bdc6cdfce1b46ddfec3393e72fb0cbc1420ccbd332e89e30c
MATLAB
544
20
function [C_tri]=transitivity_bu(A) %TRANSITIVITY_BU Transitivity % % T = transitivity_bu(A); % % Transitivity is the ratio of 'triangles to triplets' in the network. % (A classical version of the clustering coefficient). % % Input: A binary undirected connection matrix % % Output: ...
5b243ea9e46f1de9ef0eb981403ef8d6b3360fa307faae2244b6083588698981
MATLAB
546
24
function [CIJ] = makerandCIJ_dir(N,K) %MAKERANDCIJ_DIR Synthetic directed random network % % CIJ = makerandCIJ_dir(N,K); % % This function generates a directed random network % % Inputs: N, number of vertices % K, number of edges % % Output: CIJ, directed random connect...
712e3bd72c6d15b52c657bb9c4fb679281a766e36f4a2f6efd051912ebb2513f
MATLAB
549
17
function Y = nst_misc_convert_to_mumol(Y,DisplayUnits) %NST_MISC_CONVERT_TO_MUMOL Convert Y from DisplayUnits to mumol.l-1 if strcmp(DisplayUnits, 'mol.l-1') Y = Y * 1e6; elseif strcmp(DisplayUnits, 'mmol.l-1') Y = Y * 1e3; elseif strcmp(DisplayUnits, 'mumol.l-1') || strcmp(DisplayUnits, '\m...
7cab679ab850fe849c49a73c4f72cd933d41f78df4d6e823f18f54e4a27b4a69
MATLAB
550
19
function utest_clean_bst() % Clean brainstorm from anything done during unit test global GlobalData; GlobalData.Program.isServer = 0; GlobalData.Program.HandleExceptionWithBst = 1; % Delete unit test protocol ProtocolName = 'nst_utest'; gui_brainstorm('DeleteProtocol', ProtocolName); db_dir = bst_get('BrainstormDbDir'...
ae3c76e10203dc505aa8eda4525ca217a704d3e366aa1b03a739d9b7c326b67a
MATLAB
550
15
function settings_struct = getDefaultPlotSettings() settings_struct = struct(); settings_struct.color_map = flip(parula(1000)); settings_struct.color_map(end+1,:) = [1 1 1]; settings_struct.p_value_plot_max = 0.0500; settings_struct.name_label = 'plot title'; settings_struct.callba...
b5b1e0227f48dd4e7692163f91e2eb78deab4706cafd025fa4f6b0833cf32c50
MATLAB
551
25
%% read file and info all=sffread('Ecoli.sff') info = sffinfo('Ecoli.sff') %% plot len = cellfun(@length, {all(:).Sequence}); meanLength = mean(len) medianLength = median(len) stdLength = std(len) figure(); hist(len); xlabel('Sequence length'); ylabel('Number of reads'); title('Length distribution'); %=== metrics on...
a4e3a87b5d47cb7b5fd4b6e5a1890c3dddc8baf536df22461bbaf06d96528aed
MATLAB
554
24
function O = coregfunc(input) % apparently function need a 0 and no end to run in the cluster (!?), set the name of the function and the input variable O = []; addpath('/projects/MINDLAB2017_MEG-LearningBach/scripts/osl/osl-core'); %this add the path (not necessary being in the osl-core directory if you have this ...
04ef189381d70e1ecaa911499066cd3379444b5900ad1bb51fef22fc2ec8cb6f
MATLAB
557
17
function classes_new = cluster_classes(idx,classes) for i=1:length(unique(idx)) classes_new{i,1} = classes(idx==i,1); classes_new{i,1} = vertcat(classes_new{i,1}{:}); classes_new{i,2} = classes(idx==i,2); classes_new{i,2} = vertcat(classes_new{i,2}{:}); if size(classes_new{i,2},1)>1 ...
b743332f9bc56e926675bcfbf85684a9bd8953e87493417062d00abe84d4e72b
MATLAB
559
14
function obj = drawSphere(ax, pos, color, radius) %DRAWSPHERE Draw sphere % ax: axes to draw on (currently unused) % pos: x-y-z position, center of sphere % color: r-g-b or r-g-b-a color % radius: radius of sphere [x, y, z] = sphere(10); obj = patch(surf2patch(radius * x + pos(1...
83f3422e4e7dca3dbbf1ad91cc24801f0185eb02406070ac1d8582054b90aa72
MATLAB
563
26
function convert_csv_to_gifti(in_tri,in_points, out_gii,io_value) addpath('gifti') tri = importdata(in_tri) vertices = importdata(in_points) mystruct = struct mystruct.faces = tri+1 mystruct.vertices = zeros(size(vertices,1),3) mystruct.vertices(:,1:2) = vertices(:,:); %set t...
3465ede4158f25365f436f89367372eed13005fb3946e6c0d64c1bbb5b846b9b
MATLAB
567
29
function SurfStatColormap( map ); %Colormap function for SurfStatView. % % Usage: SurfStatColormap( map ); % % Same as for matlab's colormap function - see help colormap. colormap(map); a=get(gcf,'Children'); k=0; for i=1:length(a) tag=get(a(i),'Tag'); if strcmp(tag,'Colorbar') cb=a(i); ...
512018549025e83780d4eb4dd72f99dd5c7203fa44a4c0a422b3458723efeafb
MATLAB
567
27
function [minval maxval]=imrange(inpict) % [min max]=IMRANGE(INPICT) % returns the global min and max pixel values in INPICT % % INPICT can be a vector or array of any dimension or class dims=length(size(inpict)); for n=1:1:dims if n==1 minval=min(inpict); maxval=max(inpict); e...
09754d1813676256d58e4f414f6a47adb7b77b54c9f85c76bcc286afacde6fb9
MATLAB
568
19
function nst_save_figure(fig_fn, options, hfig) if nargin < 3 hfig = gcf; end switch options.save_fig_method case 'export_fig' if ~isfield(options, 'export_fig_dpi') options.export_fig_dpi = 90; end export_fig(fig_fn, '-transparent', sprintf('-r%d', options.export_fig_dpi),...
c843908cb20e887cfb0c7a1fc0fb1d18dffbd777e3a01b29db25df9b7010f219
MATLAB
571
13
function surf_out = read_surface(file) % READ_SURFACE Reads surface from disk. % % surf_out = READ_SURFACE(file) reads the surface file and outputs it in % MATLAB format. The file can be (.gii, .mat, .obj, Freesurfer), a loaded % variable (in SurfStat or MATLAB format), or a cell array containing % multiple ...
9b7dddfdcff8cbc06eb8f6e7a1cb18166c6bf8aa3c46dae6aae087cdc5e525c7
MATLAB
572
23
function success = nst_download(source_fn, dest_fn, download_msg, bst_interactive) if nargin < 3 download_msg = sprintf('Downloading "%s" to "%s"...\n', source_fn, dest_fn); end fprintf('%s -- ', download_msg) success = 1; tstart = tic(); errMsg = bst_websave(dest_fn, sou...
b32833848dbc86c0d23468f5b6c1e3e374b43f5bdf37785d1d5cfbb37a325556
MATLAB
572
30
function O = cluster_Dlabel(S2) O = []; addpath('/projects/MINDLAB2017_MEG-LearningBach/scripts/osl/osl-core'); %this add the path (not necessary being in the osl-core directory if you have this one) osl_startup D = S2.D; %file to be updated D2 = S2.D2; %file with original labels D=D.montage('switch',0); for ii = ...
83cedc809d73d08084badafc9bd38fcd9c2b4ebf12edcfe85e415db6c4d95f20
MATLAB
573
23
function index = Which_MCIndex_ThisLink(i,j, MC) % FUNCTION index = Which_MCIndex_ThisLink(i,j) returns the ordinal index of a % link in the meta-connectivity (MC) representation of a directed link from i to j. M = size(MC,1); nregions = (1 + sqrt(1+4*M))/2; if (i == j) disp('Careful! Slef-loops are excluded fro...
0b3667e62f20723d9b98865e3312458f4d48471e89ae43fc5c8da175438466d2
MATLAB
574
26
function image(t) sx=char(t); x=double(t); if isempty(x) return end [n,p]=size(x); minx=min(x); maxx=max(x); x=(x-ones(n,1)*minx)./(ones(n,1)*(maxx-minx+(maxx==minx))) ... + ones(n,1)*(maxx==minx); d1=0.66; clf; axes('position',[0.06 0.06 0.2 d1]); imagesc(x); colorbar; colormap(spectral(256)); ...
bc9e041c7a28bd0917e7f3338b07df34704abe6f8a200d19bbd96869fc30fa94
MATLAB
575
27
function [Y, sigma, est_snr] = add_meas_noise(Y, snr) %UNTITLED2 Summary of this function goes here %author : Narayan Subramaniyam %Aalto/NBE % resonable to use this if you have just one type of sensors num_chan = size(Y,1); sig_var = zeros(num_chan,1); for i = 1:1:num_chan sig_var(i,1) = var(Y(i,:)); end avg_v...
537524f971239139f1e89a8aeb97fc3b81d591865cd3cd86e69f7eb616eaa2e7
MATLAB
577
18
classdef KendallB < nla.edge.BaseTest %KENDALL Edge-level Kendall's tau properties (Constant) name = "Kendall's tau-b" coeff_name = "Kendall's tau-b" end methods function obj = KendallB() obj@nla.edge.BaseTest(); end function result = run...
ed583865faf2bef950e57b81eef133bd155503f1bc1bb9c4c461f91ae3688310
MATLAB
581
21
function str = commitString(full) %COMMITSTRING Output current git commit as a string if ~exist('full', 'var'), full = false; end cmd_str = sprintf('cd %s\ngit rev-parse --abbrev-ref HEAD', nla.findRootPath()); [cmd_status, branch_name] = system(sprintf(cmd_str)); if cmd_status ~= 0 st...
98746a7e5e2d680d56bcdabaf2f41f1b9d81329bf8fbc611650351d1d800c070
MATLAB
588
28
function eFC = TS2eFC(TS) % FUNCTION eFC = TS2eFC(TS) % takes time-series (TS) as input and calculates edge functional connectivity % (eFC) as output. % % inputs: TS(t,n) --> rows are t different time-points; % columns are n different regions; % % Example: efc = TS2eFC(ts) t = size...
c1ce770775e66b7963204672cfb376f6f65ac5a877349ccb2f7429daeae460dd
MATLAB
590
18
function tc_data2nii(data, ref_nii, filename) %% ref_nii = tc_data2nii(data, ref_nii, filename) if ischar(ref_nii) ref_nii = load_untouch_nii(ref_nii); end % set data ref_nii.img = data; % define pixel dimensions in standard nifti 8D ref_nii.hdr.dime.dim = [ndims(data), size(data), ones(1, 8 - ndims(data) - 1)]; ...
d9edb108354cd3aeda7b76fd5b59bb5827a484c3b77ee885a14dc28db133eead
MATLAB
591
11
function shape_classification_iterative_linkage_clustering(data) coefficient_of_variation = shape_classification_iterative_clustering_input_coeff_var(data.classes); if isempty(coefficient_of_variation)~=1 [classes,size_classes] = shape_classification_iterative_clustering(data.classes,coefficient_of_variation,'li...
dbacc6908a689b400e83f6b29d46504adb6729a25979401fcd7617e86687ac61
MATLAB
594
25
function [CIJ] = makerandCIJ_und(N,K) %MAKERANDCIJ_UND Synthetic directed random network % % CIJ = makerandCIJ_und(N,K); % % This function generates an undirected random network % % Inputs: N, number of vertices % K, number of edges % % Output: CIJ, undirected random co...
f9af83e82336241bf64a8a65b641505531cdd97c66f025e21a7dbf8ffa249abf
MATLAB
595
14
function [log_weights] = gpu_logpdf(Y,ypred,sigma, logDetSigma,N,ny) gputimes = @(A, B) pagefun(@mtimes, A, B); % A*B on GPU gpurdivide = @(A, B) pagefun(@mrdivide, A, B); % A/B on GPU gputranspose = @(A) pagefun(@transpose, A); % A' y1(:,1,:) = ypred - repmat(Y, [1 N]); a1=gpuArray(y1); b = gpuArray(sigma); ...
141e35557c27f47b85cfca7f263af7ff9a11efa2ba973f9540bb0855d14f93ba
MATLAB
596
31
function pno = mipp_pnam_to_unit(pni, mode) if nargin < 2 mode = 1; end switch mode case 1 switch pni case {'s0' 'rare'} pno = '[a.u.]'; case {'D' 'D_delta' 'Dg'} pno = '[µm^2/ms]'; case {'Vi' 'Va' 'Vi_delta' 'Va_...
019339db29d5aafa62260b0aa30fb1357223d9792293f9cb77a190bdc930b58e
MATLAB
598
11
function shape_classification_iterative_distance_clustering(data) coefficient_of_variation = shape_classification_iterative_clustering_input_coeff_var(data.classes); if isempty(coefficient_of_variation)~=1 [classes,size_classes] = shape_classification_iterative_clustering(data.classes,coefficient_of_variatio...
2af05d76944235db0dd28f649185b44ef58e335c83c524399ca0873d333841d0
MATLAB
599
27
%% read list fo='X:\Elite\Alexey\HCD\protlist.txt'; pl=fopen(fo); pla=textscan(pl,'%s'); fclose(pl); %hprot=fastaread('X:\FastaDB\uniprot-human-may-13.fasta') %% compare lists %hprot.Header==pla{size(pla{1},2)}{1} %pla{size(pla{1},2)}{1} %% write retrieved protein sequences fw=[fo,'.sequence','.fa...
701bb7d601e51ceee59af64b78090bd8fb1de8ee59a08fca86c3ce43f5fa9522
MATLAB
604
25
% function for map showing signal levels across tissue function [map]=fluo_map_raw(imagestack) [rows cols] = size(imagestack(:,:,1)) premap = zeros(rows,cols); for row = 1:rows for col = 1:cols signal=imcomplement(squeeze(imagestack(row,col,:))); signal = (double(signal)); ...
7dfaf8e4079ddb8f70fde4fadd256370685d8dea111b7e845605f48ce23cfe4f
MATLAB
609
22
function inputs = reduce(inputs_unreduced) %REDUCE Reduce duplicate inputs i = 2; while i <= numel(inputs_unreduced) duplicate = false; for j = 1:i-1 % if it's equal, it's a duplicate if strcmp(class(inputs_unreduced{i}), class(inputs_unreduced{j})) && strcmp(inputs_u...
c75380b51dd5c3c4bb22a287435ef49e32dcb0b36e8ee92641cc8e1e5671a2fd
MATLAB
610
24
function [n_on_start_new, n_on_end_new]=on_minimum_spikenum(on_start_new, on_end_new,left_spikes) n_on_start_new=on_start_new; n_on_end_new=on_end_new; %% for u=1:length(on_start_new) interval=[ on_start_new(u) on_end_new(u) ]; ai = myFind(left_spikes>=interval(1)&left_spikes<=interval(2)); % len...
ea778963c6e3e224c4d2ac0cfbacf5de984ff2dda28550431207b012bbc725a2
MATLAB
613
19
classdef Pearson < nla.edge.BaseTest %PEARSON Edge-level Pearson correlation properties (Constant) name = "Pearson's r" coeff_name = "Pearson's r (Fisher-Z Transformed)" end methods function obj = Pearson() obj@nla.edge.BaseTest(); end fu...
190ba58c3e62aca7d013d673b96f79bcdc86d159c99c0d0886a5be9df46dee57
MATLAB
614
24
%% FILTER A VECTOR NOISE WITH A SPECIFIED STRICTLY CAUSAL MVAR MODEL: Y(n)=A(1)Y(n-1)+...+A(p)Y(n-p)+U(n) %%% INPUT % A=[A(1)...A(p)]: M*pM matrix of the MVAR model coefficients (strictly causal model) % U: M*N matrix of innovations %%% OUTPUT % Y: M*N matrix of simulated time series function [Y]=MVARfilter...
a075a9cc9d535eeb11f00141e9249053000633f389628b67974d476206c2e0e8
MATLAB
614
29
%% simulate power law from uniform a=0; b=1000; alpha=-2/3; n=rand(1000000,1)'; r=(a.^(alpha+1)+n*(b^(alpha+1)-a.^(alpha+1))).^(1/(alpha+1)); plot(n,r,'.'); hist(n); hist(r); %% create samples and species count sampN=4; specN=10; ssc=zeros(sampN,specN); for i=1:sampN % sample m=i*1000; sample = r(:,ran...
61296c4cb014d8912a8b6e7d97bd3396b79bb6e1210a8299ede24bb87996b52b
MATLAB
615
20
function clusters = extract_clusters(data) % Extract the reference data and its individual clusters try DataArray = horzcat(data.x_data,data.y_data,data.area,data.channel); % Set up the reference data catch DataArray = horzcat(data.x_data,data.y_data,data.area); % Set up the reference data end [~,Idx...
9ba1f96e6e49517740fa64ff06fea4e3c4b817918affcd445366dd13992ddf37
MATLAB
619
24
function [kden,N,K] = density_dir(CIJ) % DENSITY_DIR Density % % kden = density_dir(CIJ); % [kden,N,K] = density_dir(CIJ); % % Density is the fraction of present connections to possible connections. % % Input: CIJ, directed (weighted/binary) connection matrix % % Output: kden, density % ...
409f3b4ad5fc0ea51e76b2c49809dc0b623b935c5e26f602b6633e97a7e9063b
MATLAB
621
19
classdef Spearman < nla.edge.BaseTest %SPEARMAN Edge-level Spearman correlation properties (Constant) name = "Spearman's rho" coeff_name = "Spearman's rho (Fisher-Z Transformed)" end methods function obj = Spearman() obj@nla.edge.BaseTest(); end ...
274faa248dd176bd95c49a29ec68d453bfd412cfb8e2d3cd72bdeb8b70f4dde7
MATLAB
623
13
function parcel_data = full2parcel(data,parcellation) % FULL2PARCEL Downsamples vertex data to parcel data. % % parcel_Data = full2parcel(data,parcellation) takes the mean of columns % in n-by-m matrix data that have the same value in corresponding 1-by-m % vector parcellation. If some numbers are missing in th...
3f2b9ae552269e06a286e5b4b15b43fa2bab9d08afd83debab7d936bf97c4aa0
MATLAB
626
19
function M_t = compute_Bt_gpu(P_ks, P_ks1, M, nq, ny, N,T) gputimes = @(A, B) pagefun(@mtimes, A, B); M_t = zeros(3*nq+ny, 3*nq+ny, N); M_t=gpuArray(M_t); M=gpuArray(M); P_ks=gpuArray(P_ks); P_ks1=gpuArray(P_ks1); M_t(1:nq,1:2*nq,:) = gputimes(1, gpuArray([P_ks, M])); M_t(1:nq,2*nq+ny+1:...
a029dfe8a3d8833aa2236aa4f33d639ac470724deff46dad570379017e8e328b
MATLAB
626
25
function file_path_out = copyfile_path(file_path,output_folder) [~,file,extension] = fileparts(file_path); file_path_out = [output_folder file extension]; if ~isfile(file_path) error('file to copy does not exist'); end if exist(file_path_out,'file') warning('output file alrea...
2a111fa78078e51866a0b6e7dfc9a45befde3e46d38bac187e70cfffbf3aeb63
MATLAB
627
18
function data_simulated = loc_list_random_point_pattern_simulation() input_values = inputdlg({'x_i,x_f','number of localizations:'},'',1,{'-3 3','100'}); if isempty(input_values)==1 data_simulated = []; else x = str2num(input_values{1}); N = str2num(input_values{2}); if N<1 N=1; end...
553304d2bc0d2a45faabdb9a5798d43e7f02a241290097dbda624d259f618403
MATLAB
629
19
%%%% EXTERNAL FUNCTION % function taken from the fastICA package % complete software may be downloaded from http://research.ics.tkk.fi/ica/fastica/ function [newVectors, meanValue] = remmean(vectors); %REMMEAN - remove the mean from vectors % % [newVectors, meanValue] = remmean(vectors); % % Removes the mean ...
f8f9b30318e06c30d06a8453238f30166d22e48f99ad46180a2c86e92aa43353
MATLAB
632
22
function [source_inds] = select_source_inds(pnts, num_sources, dist_thr) %UNTITLED4 Summary of this function goes here % Detailed explanation goes here msize = length(pnts); distMat = inf*eye(num_sources,num_sources); dmin = 0; while dmin < dist_thr % just to ensure the dipoles drawn are not too close (in mm ) i...
47e6e078b05bcf83be91225ba7f7d2894f08a30b06ebb8037b5598488821fffa
MATLAB
634
24
function y=convert_back_to_time(fyo, Nsamples, freq_indtest) % Nsamples=109;yo=demean(randn(Nsamples,1)); % NumUniquePts=ceil((Nsamples+1)/2); freq_indtest=2:25; fyo=fft(yo); fyo=fyo(freq_indtest); % y=convert_back_to_time(fyo,Nsamples, freq_indtest); % sfigure;plot(y);ho;plot(yo,'r--') NumUniquePts=ceil((Nsamples+1...
bec6beeb84cffc87c6ba312fcccfe5d772ec75a1bd4c2d40495b87917d8b3c51
MATLAB
634
10
function plot_size_clusters_iteraion(size_classes) figure(); set(gcf,'color','w','name','Iterative_clustering','NumberTitle','off','color','w','units','normalized','position',[0.1 0.3 0.3 0.5]) scatter(1:length(size_classes),size_classes,10,'b','filled') hold on plot(1:length(size_classes),size...
f434c32d30e19a991286b6ca7d5fbe9f2fe162769d1995ddf7ee282a8ca96cd7
MATLAB
635
31
function x=bandpasshopf(y,freqrange,fres,do_plot) % function x=bandpass(y,lp,hp) % % does bandpass filtering via FFT % 0<lp<1 proportion of high freq to cut out % 0<hp<1 proportion of low freq to cut out if(nargin<4) do_plot=0; end; Nsamples=length(y); Nunique_points=ceil((Nsamples+1)/2); fHz = (0:Nunique_point...
d7ca798cab67088e770033c1c3e75a1bd9180298d78ee7682eb33de0312bd77c
MATLAB
636
26
function txt=SurfStatDataCursorQ(empt,event_obj) pos=get(event_obj,'Position'); h=get(event_obj,'Target'); v=get(h,'Vertices'); x=get(h,'FaceVertexCData'); id1=min(find(v(:,1)==pos(1)&v(:,2)==pos(2)&v(:,3)==pos(3))); tag=get(get(h,'Parent'),'Tag'); [s,a,id0]=strread(tag,'%s %d %d'); id=id1+id0 c=get(get(h,'par...
64b466299b823d8d802a58e0bbf225a5e3c5f3c2bcc3435768ff9ec4c77c6474
MATLAB
639
18
function sResults = nst_misc_FOV_to_cortex(sResults, nVertex, valid_vertex, isSaveFactor) mapping = sparse(valid_vertex, 1:length(valid_vertex), 1, nVertex, length(valid_vertex)); for iMap = 1:length(sResults) if iscell(sResults(iMap).ImageGridAmp) sResults(iMap).ImageGridAmp = [ {...
3ac588a4b0248ad3705d2dc719fabc2e92c9597b7247fb345296d012f453426e
MATLAB
640
23
function mask = SurfStatMaskCut( surf ); %Mask that excludes the inter-hemisphere cut. % % Usage: mask = SurfStatMaskCut( surf ); % % surf.coord = 3 x v matrix of surface coordinates, v=#vertices. % % mask = 1 x v vector, 1=inside, 0=outside, v=#vertices. % % It looks in -50<y<50 and -20<z<40, and ...
d839e42ae80fb6b373fdaaef9e02cc3bdfa625574c4eb0f09a53e455dc3f5d17
MATLAB
640
36
%% bi-phasic log-sigmoid function t=100; b=0; s=t-b; f=0.4; kd1=0.5; kd2=0.5; m1=1; m2=1; x=0.01:0.001:1; y=b+(s*f)./(1+10.^(log(kd1-x)*m1))+(s*(1-f))./(1+10.^(log(kd2-x)*m2)) plot(x,y,'r.') %% data from MST d=[3.9063 926.4901 7.8125 928.6018 15.6250 926.7656 31.2500 923.3865 62.5000 920.1771 12...
85cd79694efaae20e6619729cd56dee68eb256ef85170f6ed904ed4fd071fd0e
MATLAB
641
18
function signal_filt = TemporalFiltering(signal,flp,fhi,tr) % Temporal Filtering Settings fnq = 1/(2*tr); % Nyquist frequency Wn = [fhi/fnq flp/fnq]; % butterworth bandpass non-dimensional frequency k = 5; % 5th order butterworth filter [bfilt,afilt] = butter(k,Wn); %...
8d90430c84be294e77f0f158317faa850c278a958d6640463bb38a5fb4836506
MATLAB
643
26
function s = resQ_1d_fit2data(beta, xps) % function s = resQ_1d_fit2data(beta, xps) b = xps.b; b2 = b.^2; m = xps.m; m2 = m.^2; bm = b .* m; bs = xps.b_shape; ms = xps.m_shape; bms = xps.bm_shape; beta = resQ_unitSwap(beta, 0); s = beta(1) * exp( ... - ( b * beta(2) + ...
c81adfa1cd383f9c7f580b100ab9e64a77ec97f9afdec8dec4798b7876020e47
MATLAB
643
30
function m = fl_cell_mean2(Cell1,Cell2) % Computes the mean difference between two cell elements % % The cells must be 1-dimensional % (The function does not make an internal copy of the cell variable, which % is critical for large data sets) % This function is part of the permutationlab software: % Author: D...
93b52c31410c7e086ca8922f10c0a1afba5e61ff187e81d87235aed05c357476
MATLAB
644
12
function plot_voronoi_area(vor,number_of_bins) figure() set(gcf,'name','Voronoi Areas Histogram','NumberTitle','off','color','w','units','normalized','position',[0.3 0.2 0.4 0.65]) voronoi_areas = vor.voronoi_areas; [y_log,x_log] = hist(log10(voronoi_areas),number_of_bins,'facecolor','b','edgecolor','none'); hist_...
b816d3d25996d3f18ae9f7bef83e4b8cafdf13f9021f070d01bccea24eccb362
MATLAB
648
22
function mat = rotationMatrix(dir, theta) % Generate a rotation matrix for the direction given % an angle (in radians). import nla.Direction mat = zeros(3); switch dir case Direction.X mat = [1 0 0;... 0 cos(theta) -sin(theta);... 0 sin(t...
ba31caa711b106cf18ef9b47c2341e6421f77153146e6d463b357942abbb9bf2
MATLAB
661
21
function y=C_AbsorBoundAUTO(z, CurrTime, D, halfZ) %This is a corrected version of equation 16 in Kues and Kubitscheck, Single %Molecules, 2002 and a corrected version of equation Suppl 5.7 in Mazza et %al, Nucleic Acids Research, 2012. Both equations are wrong, but they are %wrong in different ways and the one below i...
d0d0b056868ff2404451c8ec15d6792a735df042964a3ee4271878f2ecec586c
MATLAB
661
15
function AS_WTA_SepRes indir = uigetdir(pwd,'OrigData'); outdir = uigetdir(pwd,'Outputdir'); [TargetROI,FilPa,Filext] = uigetfile({'*.nii';'*.img'},'TargetROI'); [vtar,dtar] = Dynamic_read_dir_NIFTI(fullfile(FilPa,TargetROI)); NIINAMELIST = dir([indir,filesep,'*.nii']); dtarind = unique(dtar); for i = 1:length(N...
96ea651139b5969464ac3ac6ec0f7a859c65686e61e52c4bb7c71632321d9784
MATLAB
662
25
classdef WelchT < nla.edge.result.Base %WELCHT The output result of a WelchTTest properties dof end methods function obj = WelchT(size, prob_max, group_names) if nargin == 0 size = 2; prob_max = -1; end ...
a4ec85f36ca977fd892921c5313fb5b478550bc9f7322054803c6e856ded43b5
MATLAB
664
29
function intpctrange = interpercentilerange(data,percentiles) %%% input %%% 'data' = vector of data %%% 'percentiles' = lower and upper percentile values to be determined if nargin < 2 percentiles = [0.25 0.75]; end if max(size(percentiles)) ~= 2 error('give upper/lower percentiles as input') en...
9dd1b0de758a8b6e350504a2d6e91667ca3aebc5f0cfb6f9816c167684a4d15f
MATLAB
665
34
%% Test script to evaluate effect of spike pairing protocol on synaptic %% strength of a STDP synapse. %% Synaptic dynamics for STDP synapses according to Abigail Morrison's %% STDP model (see stdp_rec.pdf). %% author: Moritz Helias, april 2006 %% clear; deltaT=-50:1:50; lambda=0.1; w_init=17.0; alpha=0.11; mu=0.4; ...
c7d283beb432e40c0b0563ededa2a69cd14e5fd3a7df170c14b7f91f6d2bef43
MATLAB
668
19
function W = threshold_absolute(W, thr) % THRESHOLD_ABSOLUTE Absolute thresholding % % W_thr = threshold_absolute(W, thr); % % This function thresholds the connectivity matrix by absolute weight % magnitude. All weights below the given threshold, and all weights % on the main diagonal (self-self conn...
28e549bed879db0620061231b4832dc3eef4cef8d751923f5286f04b0b879d26
MATLAB
670
25
function s=plus(m1,m2) if (~isa(m1,'term') && ~isa(m1,'random') && numel(m1)>1) || ... (~isa(m2,'term') && ~isa(m2,'random') && numel(m2)>1) warning('If you don''t convert vectors to terms you can get unexpected results :-(') end if ~isa(m1,'random') m1=random([],m1,[],inputname(1)); end if ~isa(m...
6200dadaa80cde61fbe90816af129884ccfef3ca0cc01b7dd2661b85a79fba64
MATLAB
670
18
function h = scree_plot(lambdas) % SCREE_PLOT Plot of the scaled eigenvalues. % % h = SCREE_PLOT(lambdas) plots the eigenvalues corresponding to a % gradient. Lambdas are scaled to a sum of 1. All graphics objects % created are stored in structure array h. % % For more information, please consult our <a % ...
482fbec021a59dc039660bb863caef38901040bc08e478885b0de527edaaefe9
MATLAB
671
25
function s=minus(m1,m2) if (~isa(m1,'term') && ~isa(m1,'random') && numel(m1)>1) || ... (~isa(m2,'term') && ~isa(m2,'random') && numel(m2)>1) warning('If you don''t convert vectors to terms you can get unexpected results :-(') end if ~isa(m1,'random') m1=random([],m1,[],inputname(1)); end if ~isa(...
da81bc43cee3ca881885611bdadea84c45b1a43f5cfc32d5d69861c2b37f8403
MATLAB
671
19
classdef Bonferroni < nla.net.mcc.Base properties (Constant) name = "Bonferroni" end methods function [is_sig_vector, p_max] = correct(obj, net_atlas, input_struct, prob) p_max = input_struct.prob_max / net_atlas.numNetPairs(); is_sig_vector = prob.v...
5303b63e9fee848cd0cc115fd76f2894c0043b5d76b10c42fa1876b197bff068
MATLAB
677
28
classdef InputField < handle %INPUTFIELD Base class of input fields properties satisfied = false % whether the given input field has been satisfied end properties (Access = protected) fig end methods (Abstract) draw(obj, x, y, parent, fig) undraw(obj) ...
d625fb1e5cbc6e3b20a650c0a64a410b2c8a934e6d4df5ea0772710e43a70de7
MATLAB
677
26
function h=plotVirtualChannel(allDataTFR,channelSelection,XLim,Zlim) %% tmpDataTFR=[]; tmpDataTFR.cfg=[]; tmpDataTFR.time = allDataTFR.time; tmpDataTFR.powspctrm = nanmean(squeeze(allDataTFR.powspctrm(:,channelSelection,:,:)),1); tmpDataTFR.dimord='chan_freq_time'; tmpDataTFR.label=arrayfun(@num2str, channelSelection, ...
d9dd73aaded0de35438d861cdeeadb6efc31c22ecfc7c084928113ca05efe1b2
MATLAB
685
27
function DI=dunns(clusters_number,distM,ind) %%%Dunn's index for clustering compactness and separation measurement % dunns(clusters_number,distM,ind) % clusters_number = Number of clusters % distM = Dissimilarity matrix % ind = Indexes for each data point aka cluster to which each data point % belongs i=clusters_...
693026dcda520bd189d3088d9ffeb433e315bbd3fecdd74f1002740d45b3868d
MATLAB
690
23
function loc_list_filter_no_of_locs(data) answer = inputdlg({'Enter minimum number of localizations:'},'Input',[1 50],{'1000'}); if isempty(answer)~=1 min_loc = str2double(answer{1}); for i = 1:length(data) if length(data{i}.x_data)>=min_loc data_above(i) = i; else ...