Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
hanjunlee21 authored Aug 22, 2022
1 parent e7d66da commit 3a9b034
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Binary file modified bedGraph2Cluster
Binary file not shown.
24 changes: 12 additions & 12 deletions bedGraph2Cluster.m
Original file line number Diff line number Diff line change
Expand Up @@ -242,24 +242,24 @@ function bedGraph2Cluster(bedGraphs_Peak, bedGraphs_Cluster, bedGraphs_Noncluste
chrs = ["chr1";"chr2";"chr3";"chr4";"chr5";"chr6";"chr7";"chr8";"chr9";"chr10";"chr11";"chr12";"chr13";"chr14";"chr15";"chr16";"chr17";"chr18";"chr19";"chr20";"chr21";"chr22";"chrX";"chrY"];
fileID = fopen(convertStringsToChars(strcat(outputdir,"/peaks.bed")), 'w');
for i = 1:size(X.peak.chr,1)
fprintf('%s\t',chrs(X.peak.chr(i,1),1));
fprintf('%s\t',convertCharsToStrings(num2str(X.peak.st(i,1)+1)));
fprintf('%s\t',convertCharsToStrings(num2str(X.peak.en(i,1))));
fprintf('%s\t',convertCharsToStrings(num2str(i)));
fprintf('%s\t',"1000");
fprintf('%s\n',".");
fprintf(fileID, '%s\t',chrs(X.peak.chr(i,1),1));
fprintf(fileID, '%s\t',convertCharsToStrings(num2str(X.peak.st(i,1)+1)));
fprintf(fileID, '%s\t',convertCharsToStrings(num2str(X.peak.en(i,1))));
fprintf(fileID, '%s\t',convertCharsToStrings(num2str(i)));
fprintf(fileID, '%s\t',"1000");
fprintf(fileID, '%s\n',".");
end
fclose(fileID);
for clusterID = 1:k
fileID = fopen(convertStringsToChars(strcat(outputdir,"/peaks.clust",convertCharsToStrings(num2str(k)),".",convertCharsToStrings(num2str(clusterID)),".bed")), 'w');
for i = 1:size(X.peak.chr,1)
if X.peak.(['clust',num2str(k)])(i,1) == clusterID
fprintf('%s\t',chrs(X.peak.chr(i,1),1));
fprintf('%s\t',convertCharsToStrings(num2str(X.peak.st(i,1)+1)));
fprintf('%s\t',convertCharsToStrings(num2str(X.peak.en(i,1))));
fprintf('%s\t',convertCharsToStrings(num2str(i)));
fprintf('%s\t',"1000");
fprintf('%s\n',".");
fprintf(fileID, '%s\t',chrs(X.peak.chr(i,1),1));
fprintf(fileID, '%s\t',convertCharsToStrings(num2str(X.peak.st(i,1)+1)));
fprintf(fileID, '%s\t',convertCharsToStrings(num2str(X.peak.en(i,1))));
fprintf(fileID, '%s\t',convertCharsToStrings(num2str(i)));
fprintf(fileID, '%s\t',"1000");
fprintf(fileID, '%s\n',".");
end
end
fclose(fileID);
Expand Down

0 comments on commit 3a9b034

Please sign in to comment.