# HG changeset patch # User iuc # Date 1591641378 14400 # Node ID c43f4b80f5a930cb62433df7a21ec5bb4dc76d56 # Parent 557cf45ff2c8437715c4597f403cff1e6710f6f3 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/nanocompore commit 652a872061324ba1073bfa286777ffeefa352671" diff -r 557cf45ff2c8 -r c43f4b80f5a9 NanocomporeDB_process.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/NanocomporeDB_process.py Mon Jun 08 14:36:18 2020 -0400 @@ -0,0 +1,60 @@ +#!/usr/bin/env python + +import argparse +import os + +from nanocompore.SampCompDB import SampCompDB + + +def is_valid_file(file_name): + if os.path.isfile(file_name): + return os.path.abspath(file_name) + else: + raise FileNotFoundError(os.path.abspath(file_name)) + + +def is_valid_directory(dir_name): + if os.path.isdir(dir_name): + return os.path.abspath(dir_name) + else: + raise NotADirectoryError(os.path.abspath(dir_name)) + + +if __name__ == '__main__': + + parser = argparse.ArgumentParser( + description='save nanocompre sampcomp \ + results as interval outputs \ + \nSample call: \"python Nannocompore-plot.py --db-path \ + ./out_SampComp.db --ref-fasta ref.fa --annotation-bed annot.bed \ + --out-dir ./plots/') + + parser.add_argument('--ref-fasta', required=True, type=is_valid_file, + help='The reference genome used for read alignment.') + parser.add_argument('--db-path', default="./out_SampComp.db", type=str, + help='Path to the SampCompDB database path prefix.') + parser.add_argument('--annotation-bed', required=False, type=is_valid_file, + help='BED file containing the annotation of the transcriptome used as reference when mapping') + parser.add_argument('--pvalue-types', type=str, + default='GMM_logit_pvalue,KS_dwell_pvalue,KS_intensity_pvalue', + help='path to the annotations') + parser.add_argument('--bedgraph', default=False, + help='write output in BEDGRAPH format instead of BED') + parser.add_argument('--pvalue-threshold', default=1.0, + help='Maximum reported p-value.') + parser.add_argument('--out-dir', default="./", type=is_valid_directory, + help='path the plotting output directory.') + + args = parser.parse_args() + + db = SampCompDB(args.db_path, fasta_fn=args.ref_fasta, + bed_fn=args.annotation_bed) + print(db) + print("DB read ids:", db.ref_id_list) + + if args.annotation_bed: + for pt in args.pvalue_types.split(','): + print("bedgraph output for p-value type:", pt) + db.save_to_bed(output_fn='{}/{}.bedgraph'.format(args.out_dir, pt), + pvalue_field=pt, pvalue_thr=args.pvalue_threshold, + bedgraph=args.bedgraph) diff -r 557cf45ff2c8 -r c43f4b80f5a9 macros.xml --- a/macros.xml Tue May 05 06:57:10 2020 -0400 +++ b/macros.xml Mon Jun 08 14:36:18 2020 -0400 @@ -6,6 +6,7 @@ nanocompore + tar diff -r 557cf45ff2c8 -r c43f4b80f5a9 sampcomp.xml --- a/sampcomp.xml Tue May 05 06:57:10 2020 -0400 +++ b/sampcomp.xml Mon Jun 08 14:36:18 2020 -0400 @@ -60,7 +60,7 @@ - +
@@ -131,7 +131,7 @@ - + @@ -176,7 +176,7 @@ - + diff -r 557cf45ff2c8 -r c43f4b80f5a9 test-data/DB.tar Binary file test-data/DB.tar has changed diff -r 557cf45ff2c8 -r c43f4b80f5a9 test-data/GMM_logit_pvalue.bedgraph --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/GMM_logit_pvalue.bedgraph Mon Jun 08 14:36:18 2020 -0400 @@ -0,0 +1,2 @@ +chr 22102 22107 chr_AGGAA 0 + +chr 22103 22108 chr_GGAAA 1.0472150418546853 + diff -r 557cf45ff2c8 -r c43f4b80f5a9 test-data/KS_dwell_pvalue.bedgraph --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/KS_dwell_pvalue.bedgraph Mon Jun 08 14:36:18 2020 -0400 @@ -0,0 +1,2 @@ +chr 22102 22107 chr_AGGAA 0.037294307603991536 + +chr 22103 22108 chr_GGAAA 0.037294307603991536 + diff -r 557cf45ff2c8 -r c43f4b80f5a9 test-data/KS_intensity_pvalue.bedgraph --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/KS_intensity_pvalue.bedgraph Mon Jun 08 14:36:18 2020 -0400 @@ -0,0 +1,2 @@ +chr 22102 22107 chr_AGGAA 0.5940708247528699 + +chr 22103 22108 chr_GGAAA 0.5940708247528699 + diff -r 557cf45ff2c8 -r c43f4b80f5a9 test-data/annot.bed --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/annot.bed Mon Jun 08 14:36:18 2020 -0400 @@ -0,0 +1,1 @@ +chr 1 30000 chr 0 +