comparison NanocomporeDB_process.py @ 2:ca9e70c0fef8 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/nanocompore commit c2985b5c91a932e175cbfaf9b54a76e23beff9e9"
author iuc
date Thu, 09 Jul 2020 02:39:10 -0400
parents 2af554112418
children
comparison
equal deleted inserted replaced
1:2af554112418 2:ca9e70c0fef8
38 parser.add_argument('--pvalue-types', type=str, 38 parser.add_argument('--pvalue-types', type=str,
39 default='GMM_logit_pvalue,KS_dwell_pvalue,KS_intensity_pvalue', 39 default='GMM_logit_pvalue,KS_dwell_pvalue,KS_intensity_pvalue',
40 help='path to the annotations') 40 help='path to the annotations')
41 parser.add_argument('--bedgraph', action="store_true", 41 parser.add_argument('--bedgraph', action="store_true",
42 help='write output in BEDGRAPH format instead of BED') 42 help='write output in BEDGRAPH format instead of BED')
43 parser.add_argument('--pvalue-threshold', default=1.0, 43 parser.add_argument('--pvalue-threshold', type=float, default=1.0,
44 help='Maximum reported p-value.') 44 help='Maximum reported p-value.')
45 parser.add_argument('--out-dir', default="./", type=is_valid_directory, 45 parser.add_argument('--out-dir', default="./", type=is_valid_directory,
46 help='path the plotting output directory.') 46 help='path the plotting output directory.')
47 47
48 args = parser.parse_args() 48 args = parser.parse_args()
50 db = SampCompDB(args.db_path, fasta_fn=args.ref_fasta, 50 db = SampCompDB(args.db_path, fasta_fn=args.ref_fasta,
51 bed_fn=args.annotation_bed) 51 bed_fn=args.annotation_bed)
52 print(db) 52 print(db)
53 print("DB read ids:", db.ref_id_list) 53 print("DB read ids:", db.ref_id_list)
54 54
55 if args.bedgraph:
56 file_ext = 'bedgraph'
57 else:
58 file_ext = 'bed'
59
55 if args.annotation_bed: 60 if args.annotation_bed:
56 for pt in args.pvalue_types.split(','): 61 for pt in args.pvalue_types.split(','):
57 print("bedgraph output for p-value type:", pt) 62 out_path = '{}/{}.{}'.format(args.out_dir, pt, file_ext)
58 db.save_to_bed(output_fn='{}/{}.bedgraph'.format(args.out_dir, pt), 63 print("%s output for p-value type:" % out_path, pt)
64 db.save_to_bed(output_fn=out_path,
59 pvalue_field=pt, pvalue_thr=args.pvalue_threshold, 65 pvalue_field=pt, pvalue_thr=args.pvalue_threshold,
60 bedgraph=args.bedgraph) 66 bedgraph=args.bedgraph)