Mercurial > repos > iuc > nanocompore_sampcomp
changeset 1:c43f4b80f5a9 draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/nanocompore commit 652a872061324ba1073bfa286777ffeefa352671"
author | iuc |
---|---|
date | Mon, 08 Jun 2020 14:36:18 -0400 |
parents | 557cf45ff2c8 |
children | 25abc2c72ff9 |
files | NanocomporeDB_process.py macros.xml sampcomp.xml test-data/DB.tar test-data/GMM_logit_pvalue.bedgraph test-data/KS_dwell_pvalue.bedgraph test-data/KS_intensity_pvalue.bedgraph test-data/annot.bed |
diffstat | 8 files changed, 71 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- /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)
--- 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 @@ <xml name="requirements"> <requirements> <requirement type="package" version="@TOOL_VERSION@">nanocompore</requirement> + <requirement type="package" version="1.32">tar</requirement> </requirements> </xml> <xml name="citations">
--- 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 @@ <param name="file" type="data" format="tabular" label="Select NanopolishComp file" help="(--file_list2)"/> <param name="index" type="data" format="tabular" label="Select index file"/> </repeat> - <param argument="--fasta" type="data" format="fasta" label="Select mapping file"/> + <param argument="--fasta" type="data" format="fasta" label="Select reference mapping fasta"/> <section name="ap" title="Advanced parameters"> <param argument="--bed" type="data" format="bed" optional="true" label="Select mapping file with annotation of transcriptome"/> @@ -131,7 +131,7 @@ </output> <output name="out_db"> <assert_contents> - <has_size value="5408256"/> + <has_size value="5416960" delta="10000"/> </assert_contents> </output> </test> @@ -176,7 +176,7 @@ </output> <output name="out_db"> <assert_contents> - <has_size value="5410304"/> + <has_size value="5416960" delta="10000"/> </assert_contents> </output> <output name="out_log">
--- /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 +
--- /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 +