-
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
1 parent
298f691
commit 369920e
Showing
2 changed files
with
88 additions
and
0 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,63 @@ | ||
clear all; | ||
|
||
cases = ["EE"; "EP"; "PP"]; | ||
|
||
opts = delimitedTextImportOptions("NumVariables", 8); | ||
|
||
% Specify range and delimiter | ||
opts.DataLines = [1, Inf]; | ||
opts.Delimiter = " "; | ||
|
||
% Specify column names and types | ||
opts.VariableNames = ["VarName1", "VarName2", "Var3", "Var4", "Var5", "Var6", "Var7", "Var8"]; | ||
opts.SelectedVariableNames = ["VarName1", "VarName2"]; | ||
opts.VariableTypes = ["string", "string", "string", "string", "string", "string", "string", "string"]; | ||
|
||
% Specify file level properties | ||
opts.ExtraColumnsRule = "ignore"; | ||
opts.EmptyLineRule = "read"; | ||
opts.LeadingDelimitersRule = "ignore"; | ||
|
||
% Specify variable properties | ||
opts = setvaropts(opts, ["VarName1", "VarName2", "Var3", "Var4", "Var5", "Var6", "Var7", "Var8"], "WhitespaceRule", "preserve"); | ||
opts = setvaropts(opts, ["VarName1", "VarName2", "Var3", "Var4", "Var5", "Var6", "Var7", "Var8"], "EmptyFieldRule", "auto"); | ||
|
||
EE = readmatrix(strcat("Merged.loops.Q0.01.",cases(1,1),".count"),opts); | ||
EP = readmatrix(strcat("Merged.loops.Q0.01.",cases(2,1),".count"),opts); | ||
PP = readmatrix(strcat("Merged.loops.Q0.01.",cases(3,1),".count"),opts); | ||
|
||
loops = readmatrix(strcat("Merged.loops.Q0.01.list"),'Delimiter','\t','FileType','text','OutputType','string'); | ||
|
||
mat = strings(size(loops,1),5); | ||
mat(:,1) = loops; | ||
|
||
for i = 1:size(loops,1) | ||
for j = 1:size(cases,1) | ||
if j == 1 | ||
det = EE(strcmp(EE(:,2),loops(i,1)),:); | ||
elseif j == 2 | ||
det = EP(strcmp(EP(:,2),loops(i,1)),:); | ||
elseif j == 3 | ||
det = PP(strcmp(PP(:,2),loops(i,1)),:); | ||
end | ||
|
||
if size(det,1) > 0 | ||
mat(i,j+2) = det(1,1); | ||
else | ||
mat(i,j+2) = "0"; | ||
end | ||
end | ||
|
||
tuple = str2double(mat(i,3:5).'); | ||
if sum(tuple) == 0 | ||
mat(i,2) = "NA"; | ||
else | ||
[~,idx] = max(tuple); | ||
mat(i,2) = cases(idx,1); | ||
end | ||
end | ||
|
||
for j = 1:size(cases,1) | ||
submat = mat(strcmp(mat(:,2),cases(j,1)),1); | ||
writematrix(submat,strcat("Merged.loops.Q0.01.",cases(j,1),".bedpe"),'FileType','text','Delimiter','\t'); | ||
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
bed="../bed" | ||
pair="../pair" | ||
loop="../loop" | ||
|
||
thres="100000" | ||
|
||
mkdir -p ${pair}/H3K27ac | ||
|
||
task() { | ||
awk '{printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t.\t%s\t%s\n", $2,$3,$3+1,$5,$6,$6+1,$1,$4,$7}' ${pair}/${1}/${1}.allValidPairs > ${pair}/${1}.validPairs.bedpe | ||
pairToBed -type both -a ${pair}/${1}.validPairs.bedpe -b ${bed}/H3K27ac.bed > ${pair}/H3K27ac/${1}.H3K27ac.validPairs.bedpe | ||
pairToBed -type both -a ${pair}/H3K27ac/${1}.H3K27ac.validPairs.bedpe -b ${bed}/H3K27ac.Enhancer.bed > ${pair}/H3K27ac/${1}.H3K27ac.EE.validPairs.bedpe | ||
pairToBed -type xor -a ${pair}/H3K27ac/${1}.H3K27ac.validPairs.bedpe -b ${bed}/H3K27ac.Enhancer.bed > ${pair}/H3K27ac/${1}.H3K27ac.EP.validPairs.bedpe | ||
pairToBed -type both -a ${pair}/H3K27ac/${1}.H3K27ac.validPairs.bedpe -b ${bed}/H3K27ac.Promoter.bed > ${pair}/H3K27ac/${1}.H3K27ac.PP.validPairs.bedpe | ||
} | ||
|
||
for file in WTCI KOCI | ||
do | ||
task "${file}" & | ||
done | ||
printf "Running...\n" | ||
wait | ||
printf "Completed\n" |