Commit 53a9f01b authored by Carine Rey's avatar Carine Rey
Browse files

end results merging

parent ebe17df1
......@@ -86,6 +86,7 @@ let diffsel ~(phy_n:nucleotide_phylip workflow) ~(tree: _ workflow) ~(w_every:in
let merge_results ~res_by_tools : text_file workflow =
let env = docker_image ~account:"carinerey" ~name:"ete3" ~tag:"3.0.0b35" () in
let command = List.map res_by_tools ~f:(fun res ->
let def_meth = res.det_meth in
let w = match def_meth with
......@@ -102,7 +103,7 @@ let merge_results ~res_by_tools : text_file workflow =
)
in
workflow ~descr:"convergence_detection.merge_results" [
cmd "python" [
cmd "python" ~env [
file_dump (string Scripts.merge_det_results) ;
opt "-o" ident dest ;
seq ~sep:" " command ;
......
......@@ -48,11 +48,11 @@ requiredOptions.add_argument('-o', '--output', type=str,
help="Output name", required=True)
availableOptions = parser.add_argument_group('AVAILABLE OPTIONS')
availableOptions.add_argument('--pcoc', type=str,
help="Pcoc output name", required=True)
help="Pcoc output name", default = None)
availableOptions.add_argument('--pcoc_gamma', type=str,
help="Pcoc_gamma output name", required=True)
help="Pcoc_gamma output name", default = None)
availableOptions.add_argument('--diffsel', type=str,
help="Diffsel output name", required=True)
help="Diffsel output name", default = None)
##############
......@@ -60,8 +60,29 @@ availableOptions.add_argument('--diffsel', type=str,
### Option parsing
args = parser.parse_args()
df_pcoc = pd.DataFrame()
df_pcoc_gamma = pd.DataFrame()
df_diffsel = pd.DataFrame()
OutName = args.output
if args.pcoc :
df_pcoc = pd.read_csv(args.pcoc, sep="\t")
if args.pcoc_gamma :
df_pcoc_gamma = pd.read_csv(args.pcoc_gamma, sep="\t")
df_pcoc_gamma = df_pcoc_gamma[['Sites','PCOC','PC','OC']]
df_pcoc_gamma.rename(columns={'PCOC': 'PCOC_gamma',
'PC': 'PC_gamma',
'OC': 'OC_gamma'}, inplace=True)
if args.pcoc_gamma :
df_diffsel = pd.read_csv(args.diffsel, sep="\t")
df_diffsel["Sites"] = df_diffsel["Sites"]+1
df_list = [df for df in [df_pcoc, df_pcoc_gamma, df_diffsel] if not df.empty ]
df_final = reduce(lambda x, y: pd.merge(x, y, on = 'Sites', how='outer'), df_list)
with open(OutName, "w") as OUTPUT:
OUTPUT.write("Results")
df_final.to_csv(OutName, sep='\t', index=False)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment