Mercurial > repos > jackcurragh > trips_viz_bam_to_sqlite
changeset 2:c8d8675697c6 draft
Uploaded
author | jackcurragh |
---|---|
date | Wed, 20 Apr 2022 15:18:00 +0000 |
parents | 3ac12b611d7f |
children | 932cdd84d51a |
files | trips_bam_to_sqlite/bam_to_sqlite.py trips_bam_to_sqlite/test-data/test_n_sorted.bamv2.sqlite trips_bam_to_sqlite/trips_bam_to_sqlite.xml |
diffstat | 3 files changed, 12 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/trips_bam_to_sqlite/bam_to_sqlite.py Sun Apr 17 08:44:20 2022 +0000 +++ b/trips_bam_to_sqlite/bam_to_sqlite.py Wed Apr 20 15:18:00 2022 +0000 @@ -228,8 +228,8 @@ return (pos_modifier, readlen_modifier, mismatches) -def process_bam(bam_filepath, transcriptome_info_dict_path, outputfile): - desc = "NULL" +def process_bam(bam_filepath, transcriptome_info_dict_path, outputfile, desc): + desc = desc start_time = time.time() study_dict = {} nuc_count_dict = {"mapped": {}, "unmapped": {}} @@ -289,6 +289,7 @@ master_metagene_stop_dict = {"fiveprime": {}, "threeprime": {}} os.system(f'samtools sort -n {bam_filepath} -o {bam_filepath}_n_sorted.bam') + pysam.set_verbosity(0) infile = pysam.Samfile(f"{bam_filepath}_n_sorted.bam", "rb") header = infile.header["HD"] unsorted = False @@ -721,9 +722,10 @@ sys.exit() bam_filepath = sys.argv[1] annotation_sqlite_filepath = sys.argv[2] - # try: - # desc = sys.argv[3] - # except: - # desc = bam_filepath.split("/")[-1] - outputfile = bam_filepath + "v2.sqlite" - process_bam(bam_filepath, annotation_sqlite_filepath, outputfile) + try: + desc = sys.argv[3] + except: + desc = bam_filepath.split("/")[-1] + + outputfile = sys.argv[4] + process_bam(bam_filepath, annotation_sqlite_filepath, outputfile, desc)
--- a/trips_bam_to_sqlite/trips_bam_to_sqlite.xml Sun Apr 17 08:44:20 2022 +0000 +++ b/trips_bam_to_sqlite/trips_bam_to_sqlite.xml Wed Apr 20 15:18:00 2022 +0000 @@ -2,11 +2,11 @@ <description>Convert BAM file to SQLITE for TRIPS-Viz</description> <requirements> <requirement type="package" version="0.19.0">pysam</requirement> - <requirement type="package" version="2.0.0">sqlitedict</requirement> + <requirement type="package" version="1.7.0">sqlitedict</requirement> <requirement type="package" version="3.37.1">sqlite</requirement> </requirements> <command><![CDATA[ - python $__tool_directory__/bam_to_sqlite.py $input1 $input2 $input3 + python $__tool_directory__/bam_to_sqlite.py $input1 $input2 $input3 $output1 ]]></command> <inputs> <param name="input1" type="data" format="bam" label="Sorted (samtools -n) BAM file" />