changeset 53:bdfa6a7c4543 draft

planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4-dirty
author fubar
date Thu, 07 Mar 2024 09:23:06 +0000
parents ae12977c0e5e
children d6b0feb22584
files autogenJB2.py jbrowse2.py jbrowse2.xml
diffstat 3 files changed, 17 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/autogenJB2.py	Thu Mar 07 06:41:01 2024 +0000
+++ b/autogenJB2.py	Thu Mar 07 09:23:06 2024 +0000
@@ -129,10 +129,8 @@
                 elif trext == "cram":
                     ipath  = track[3]
                     if not os.path.exists(ipath):
-                        jc.logging.info('calling %s' % ' '.join(cmd))
                         ipath = os.path.realpath(os.path.join('./', trackname + '.crai'))
                         cmd = ["samtools", "index", "-c", "-o", ipath, os.path.realpath(track[0])]
-                        sys.stdout.write('#### calling %s' % ' '.join(cmd))
                         jc.subprocess_check_call(cmd)
                     track_conf.update({"conf": {"options": {"cram": {"cram_index": ipath}}}})
                 track_conf["path"] = tpath
--- a/jbrowse2.py	Thu Mar 07 06:41:01 2024 +0000
+++ b/jbrowse2.py	Thu Mar 07 09:23:06 2024 +0000
@@ -10,6 +10,7 @@
 import shutil
 import struct
 import subprocess
+import sys
 import tempfile
 import urllib.request
 import xml.etree.ElementTree as ET
@@ -467,6 +468,7 @@
                     self.genome_name = (
                         genome_name  # first one for all tracks - other than paf
                     )
+                    self.genome_sequence_adapter = assem["sequence"]["adapter"]
                     self.genome_firstcontig = None
                     if not useuri:
                         # https://lazarus.name/jbrowse/fish/bigwig_0_coverage_bedgraph_cov_count_count_bw.bigwig
@@ -529,7 +531,7 @@
                     "uri": faname + ".gzi",
                 },
             }
-        self.genome_sequence_adapter = adapter
+
         trackDict = {
             "name": gname,
             "sequence": {
@@ -874,27 +876,20 @@
         else:
             fname = "%s.cram" % trackData["label"]
             dest = "%s/%s" % (self.outdir, fname)
-            bindex = fname + '.bai'
+            bindex = fname + '.crai'
             url = fname
             self.subprocess_check_call(["cp", data, dest])
-
             if bindex is not None and os.path.exists(bindex):
                 if not os.path.exists(dest+'.crai'):
                     # most probably made by galaxy and stored in galaxy dirs, need to copy it to dest
                     self.subprocess_check_call(
                         ["cp", os.path.realpath(cram_index), dest + ".crai"]
                     )
-                else:
-                    # Can happen in exotic condition
-                    # e.g. if bam imported as symlink with datatype=unsorted.bam, then datatype changed to bam
-                    #      => no index generated by galaxy, but there might be one next to the symlink target
-                    #      this trick allows to skip the bam sorting made by galaxy if already done outside
-                    if os.path.exists(os.path.realpath(data) + ".crai"):
-                        self.symlink_or_copy(
-                            os.path.realpath(data) + ".crai", dest + ".crai"
-                        )
-                    else:
-                        log.warn("Could not find a cram index (.crai file) for %s", data)
+            else:
+                cpath = os.path.realpath(dest) + '.crai'
+                cmd = ["samtools", "index", "-c", "-o", cpath, os.path.realpath(dest)]
+                logging.debug('executing cmd %s' % ' '.join(cmd))
+                self.subprocess_check_call(cmd)
         trackDict = {
             "type": "AlignmentsTrack",
             "trackId": tId,
@@ -1280,8 +1275,8 @@
         drdict = {
             "reversed": False,
             "assemblyName": self.genome_name,
-            "start": 0,
-            "end": 100000,
+            "start": 2000,
+            "end": 0,
             "refName": "x",
         }
 
--- a/jbrowse2.xml	Thu Mar 07 06:41:01 2024 +0000
+++ b/jbrowse2.xml	Thu Mar 07 09:23:06 2024 +0000
@@ -275,7 +275,8 @@
                     help="If your genome of interest is not listed, contact the Galaxy team"
                     label="Select a reference genome"
                     name="genome"
-                    type="select">
+                    type="select"
+                    optional="true">
                     <options from_data_table="all_fasta">
                         <filter column="2" type="sort_by"/>
                         <validator message="No genomes are available for the selected input dataset" type="no_options">
@@ -288,7 +289,8 @@
                     format="fasta"
                     label="Select the reference genome"
                     name="genome"
-                    type="data">
+                    type="data"
+                    optional="true">
                 </param>
             </when>
             <when value="uri">
@@ -318,9 +320,9 @@
                         <option value="bed">BED track</option>
                         <option value="bigwig">BigWig track</option>
                         <option value="blastxml">Blast XML track - converted to GFF</option>
+                        <option value="cram">CRAM</option>
                         <option value="cool">HiC as cool/mcool/scool format files</option>
-                        <option value="cram">CRAM</option>
-                        <option value="gff" selected="true">GFF/GFF3 feature track</option>
+                        <option value="gff">GFF/GFF3 feature track</option>
                         <option value="hic">HiC as juicebox_hic format file. Tabular hic_matrix will NOT work.</option>
                         <option value="maf">Multiple alignment format. Reference name must match the MAF name exactly to work correctly</option>
                         <option value="paf">PAF - approximate mapping positions between two set of sequences</option>