@@ -54,11 +54,14 @@ def main(c,nop):
54
54
val.append(functools.reduce(mergeo, d_rep.values()))
55
55
df=functools.reduce(merge, val)
56
56
df.pos=df.pos.astype(int)
57
+ df.chr=df.pos.astype(str)
57
58
df=ho.fill_na(df)
58
59
else:
59
60
val.append(functools.reduce(merge, d_rep.values()))
60
61
df=functools.reduce(merge, val)
61
-
62
+ preordered = ["chr", "pos", "strand", "type"]
63
+ new_cols = preordered + [co for co in df.columns if co not in preordered]
64
+ df=df.reindex(columns=new_cols)
62
65
df=df.sort_values(['pos'])
63
66
df.to_csv(o.outputpath+'/temp_HOME/'+sample_name1+"_format_{c}.txt".format(c=c),header=True, index=False,sep='\t')
64
67
df_path.append(o.outputpath+'/temp_HOME/'+sample_name1+"_format_{c}.txt".format(c=c))
@@ -147,8 +150,10 @@ def main(c,nop):
147
150
df3=ho.pval_format_withrep(df_path[0])
148
151
149
152
smooth_exp_val=ho.smoothing(*df3.exp_val)
153
+
150
154
df3['smooth_val']=(smooth_exp_val-min(smooth_exp_val))/(max(smooth_exp_val)-min(smooth_exp_val))
151
-
155
+ df3=df3.fillna(0)
156
+ df3.to_csv(o.outputpath+'/temp_HOME'+'/chunks/'+sample_name1+"VS"+sample_name2+"_df_{c}.txt".format(c=c),header=True, index=False,sep='\t')
152
157
else:
153
158
154
159
df3=ho.pval_cal_withoutrep(df1)
@@ -158,7 +163,7 @@ def main(c,nop):
158
163
input_file_path=os.getcwd()+'/training_data/training_data_CG.txt'
159
164
model_path=os.getcwd()+'/saved_model/CG/'
160
165
k=ho.norm_slidingwin_predict_CG(df3,input_file_path,model_path)
161
-
166
+
162
167
len_cutoff=10
163
168
tr=o.pruncutoff
164
169
dmrs=ho.clustandtrim_CG(k,df3,sc,tr,dis_thres,ncb,prn,len_cutoff)
@@ -437,7 +442,8 @@ if __name__ == "__main__":
437
442
#s=[ os.path.splitext(os.path.basename(x))[0] for x in glob.glob(input_files[0][0]+'/*.tsv')]
438
443
s=[f.split('.')[0] for dp, dn, filenames in os.walk(o.outputpath+'/temp_HOME') for f in filenames if os.path.splitext(f)[1] == '.tsv']
439
444
s = Counter(s)
440
- s=[kv for kv, v in s.iteritems() if v > 1]
445
+ coun_s=len(os.walk(o.outputpath+'/temp_HOME').next()[1])
446
+ s=[kv for kv, v in s.iteritems() if v == (coun_s)]
441
447
os.chdir(cwd)
442
448
443
449
0 commit comments