-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
17,453 additions
and
278 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
function [file_smfit, file_smfit_std] = load_smf(smfitnessfile, sgadata, lfid) | ||
% function [file_smfit, file_smfit_std] = load_smf(smfitnessfile, sgadata, lfid) | ||
|
||
smf_fid = fopen(smfitnessfile, 'r'); | ||
fitness_data = struct(); | ||
fitness_data.raw = textscan(smf_fid, '%s%f%f', 'Delimiter', '\t', 'ReturnOnError', false); | ||
fclose(smf_fid); | ||
fitness_data.ORF = fitness_data.raw{1}; | ||
fitness_data.SMF = fitness_data.raw{2}; | ||
fitness_data.STD = fitness_data.raw{3}; | ||
fitness_report_header = {'Exact match', 'Partial Match', 'Not Found', 'NaN in file'}; | ||
fitness_report_counts = zeros(1,4); | ||
fitness_hash = hash_strings(fitness_data.ORF); | ||
|
||
file_smfit = zeros(length(sgadata.orfnames),1) + NaN; | ||
file_smfit_std = zeros(length(sgadata.orfnames),1) + NaN; | ||
for i=1:length(sgadata.orfnames) | ||
if fitness_hash.containsKey(sgadata.orfnames{i}) | ||
file_smfit(i) = fitness_data.SMF(fitness_hash.get(sgadata.orfnames{i})); | ||
file_smfit_std(i) = fitness_data.STD(fitness_hash.get(sgadata.orfnames{i})); | ||
fitness_report_counts(1) = fitness_report_counts(1)+1; | ||
elseif fitness_hash.containsKey(strip_annotation(sgadata.orfnames{i}, 'last')) | ||
file_smfit(i) = fitness_data.SMF(fitness_hash.get(strip_annotation(sgadata.orfnames{i}, 'last'))); | ||
file_smfit_std(i) = fitness_data.STD(fitness_hash.get(strip_annotation(sgadata.orfnames{i}, 'last'))); | ||
fitness_report_counts(2) = fitness_report_counts(2)+1; | ||
else | ||
fitness_report_counts(3) = fitness_report_counts(3)+1; | ||
end | ||
end | ||
fitness_report_counts(4) = sum(isnan(file_smfit)) - fitness_report_counts(3); | ||
|
||
log_printf(lfid, 'Fitness file report:\n'); | ||
for i=1:length(fitness_report_header) | ||
log_printf(lfid, '\t%s\t: %d\n', fitness_report_header{i}, fitness_report_counts(i)); | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
%% | ||
% OUTPUT_INTERACTION_DATA - prints out the calculated genetic interactions into a tab delimited text file. | ||
% OUTPUT_INTERACTION_DATA - prints out the calculated genetic interactions | ||
% into a tab delimited text file. | ||
% | ||
% | ||
% Inputs: | ||
% Authors: Chad Myers ([email protected]), | ||
% Anastasia Baryshnikova ([email protected]) | ||
% Benjamin VanderSluis ([email protected]) | ||
% | ||
% Authors: Chad Myers ([email protected]), Anastasia Baryshnikova ([email protected]) | ||
% | ||
% Last revision: 2010-07-19 | ||
% Last revision: 2017-12-12 | ||
% | ||
%% | ||
|
||
function output_interaction_data(outputfile,orfnames,escores,escores_std,background_mean,background_std,smfit,smfit_std,dm_expected,dm_actual,dm_actual_std,lfid) | ||
|
||
pvals = sqrt(normcdf(-abs(escores./escores_std)) .* normcdf(-abs(log((background_mean + escores)./background_mean) ./ log(background_std) ))); | ||
function output_interaction_data(outputfile, orfnames, escores, escores_std, ... | ||
pvals, smfit, smfit_std, dm_expected, dm_actual, dm_actual_std, lfid) | ||
|
||
log_printf(lfid, ['Printing output file...\n|' blanks(50) '|\n|']); | ||
|
||
|
@@ -21,26 +21,26 @@ function output_interaction_data(outputfile,orfnames,escores,escores_std,backgro | |
for j = 1:length(escores) | ||
if ~isnan(escores(i,j)) | ||
fprintf(fid,'%s\t%s\t%f\t%f\t%e\t%f\t%f\t%f\t%f\t%f\t%f\t%f\n', ... | ||
orfnames{i}, orfnames{j}, escores(i,j), escores_std(i,j), pvals(i,j), ... | ||
orfnames{i}, orfnames{j}, escores(i,j), escores_std(i,j), ... | ||
pvals(i,j), ... | ||
smfit(i), smfit_std(i), smfit(j), smfit_std(j), ... | ||
dm_expected(i,j), dm_actual(i,j), dm_actual_std(i,j)); | ||
end | ||
end | ||
|
||
% Print progress | ||
print_progress(lfid, length(escores), i); | ||
|
||
end | ||
fclose(fid); | ||
|
||
% only output an orf if it has scores | ||
% bad arrays are appearing otherwise | ||
% output the list of strains, but only if they have scores | ||
% otherwise bad arrays appear | ||
valid_queries = orfnames(sum(~isnan(escores),2)>0); | ||
valid_arrays = orfnames(sum(~isnan(escores),1)>0); | ||
valid_orfs = union(valid_queries, valid_arrays); | ||
fid = fopen([outputfile '.orf'], 'w'); | ||
for i=1:length(valid_orfs) | ||
fprintf(fid, '%s\n', valid_orfs{i}); | ||
fprintf(fid, '%s\n', valid_orfs{i}); | ||
end | ||
fclose(fid); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.