changeset 1:3ac12b611d7f draft

Uploaded
author jackcurragh
date Sun, 17 Apr 2022 08:44:20 +0000
parents fef356fa1802
children c8d8675697c6
files trips_bam_to_sqlite/bam_to_sqlite.py trips_bam_to_sqlite/test-data/test.bam trips_bam_to_sqlite/test-data/test.bamv2.sqlite trips_bam_to_sqlite/test-data/test_n_sorted.bam trips_bam_to_sqlite/test-data/test_n_sorted.bam_n_sorted.bam trips_bam_to_sqlite/test-data/test_n_sorted.bamv2.sqlite trips_bam_to_sqlite/test-data/test_org.sqlite trips_bam_to_sqlite/test-data/test_organism.sqlite trips_bam_to_sqlite/test-data/test_sorted.bam trips_bam_to_sqlite/test-data/test_sorted.bamv2.sqlite trips_bam_to_sqlite/trips_bam_to_sqlite.xml
diffstat 10 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/trips_bam_to_sqlite/bam_to_sqlite.py	Mon Apr 04 09:48:32 2022 +0000
+++ b/trips_bam_to_sqlite/bam_to_sqlite.py	Sun Apr 17 08:44:20 2022 +0000
@@ -288,7 +288,8 @@
     master_offset_dict = {"fiveprime": {}, "threeprime": {}}
     master_metagene_stop_dict = {"fiveprime": {}, "threeprime": {}}
 
-    infile = pysam.Samfile(bam_filepath, "rb")
+    os.system(f'samtools sort -n {bam_filepath} -o {bam_filepath}_n_sorted.bam')
+    infile = pysam.Samfile(f"{bam_filepath}_n_sorted.bam", "rb")
     header = infile.header["HD"]
     unsorted = False
     if "SO" in header:
Binary file trips_bam_to_sqlite/test-data/test.bam has changed
Binary file trips_bam_to_sqlite/test-data/test.bamv2.sqlite has changed
Binary file trips_bam_to_sqlite/test-data/test_n_sorted.bam has changed
Binary file trips_bam_to_sqlite/test-data/test_n_sorted.bam_n_sorted.bam has changed
Binary file trips_bam_to_sqlite/test-data/test_n_sorted.bamv2.sqlite has changed
Binary file trips_bam_to_sqlite/test-data/test_org.sqlite has changed
Binary file trips_bam_to_sqlite/test-data/test_sorted.bam has changed
Binary file trips_bam_to_sqlite/test-data/test_sorted.bamv2.sqlite has changed
--- a/trips_bam_to_sqlite/trips_bam_to_sqlite.xml	Mon Apr 04 09:48:32 2022 +0000
+++ b/trips_bam_to_sqlite/trips_bam_to_sqlite.xml	Sun Apr 17 08:44:20 2022 +0000
@@ -6,22 +6,22 @@
         <requirement type="package" version="3.37.1">sqlite</requirement>
     </requirements>
     <command><![CDATA[
-        python $__tool_directory__/bam_to_sqlite.py <path_to_bam_file> <path_to_organism.sqlite> <file_description (optional)> 
+        python $__tool_directory__/bam_to_sqlite.py $input1 $input2 $input3
     ]]></command>
     <inputs>
-        <param name="input1" type="data" format="bam" label="BAM file" />
+        <param name="input1" type="data" format="bam" label="Sorted (samtools -n) BAM file" />
         <param name="input2" type="data" format="sqlite" label="Path to organism SQLITE annotation file" />
-        <param name="input3" type="data" format="text" label="Description of this sample" />
+        <param name="input3" type="text" label="Description of this sample" />
     </inputs>
     <outputs>
        <data name="output1" format="sqlite"/>
     </outputs>
     <tests>
         <test>
-            <param name="input1" value="test.bam" ftype="bam"/>
-            <param name="input2" value="test.sqlite" ftype="sqlite"/>
-            <param name="input3" value="TEST DESCRIPTION" ftype="text"/>
-            <output name="output1" file="test.bam.sqlite" ftype="sqlite" lines_diff="4" />
+            <param name="input1" value="test_n_sorted.bam" ftype="bam"/>
+            <param name="input2" value="test_org.sqlite" ftype="sqlite"/>
+            <param name="input3" value="TEST DESCRIPTION"/>
+            <output name="output1" file="test_n_sorted.bamv2.sqlite" ftype="sqlite" lines_diff="4" />
         </test>
     </tests>
     <help>