Mercurial > repos > fubar > jbrowse2
changeset 99:990291e918c7 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit a1537aea75fc902d0e38c0b7c698830a939648b1-dirty
author | fubar |
---|---|
date | Fri, 21 Jun 2024 23:34:31 +0000 |
parents | b1260bca5fdc |
children | 666c07b60cd2 |
files | __pycache__/jbrowse2.cpython-312.pyc jbrowse2.py jbrowse2.xml macros.xml |
diffstat | 4 files changed, 81 insertions(+), 61 deletions(-) [+] |
line wrap: on
line diff
--- a/jbrowse2.py Wed Jun 05 10:00:07 2024 +0000 +++ b/jbrowse2.py Fri Jun 21 23:34:31 2024 +0000 @@ -20,8 +20,8 @@ logging.basicConfig(level=logging.DEBUG) log = logging.getLogger("jbrowse") -JB2VER = "v2.11.0" -# version pinned if cloning - but not used until now +JB2VER = "v2.11.1" +# version pinned if cloning - but not cloning now logCommands = True # useful for seeing what's being written but not for production setups TODAY = datetime.datetime.now().strftime("%Y-%m-%d") @@ -455,7 +455,7 @@ log.error(command) log.error(output) log.error(err) - raise RuntimeError(f"Command ( {command} ) failed with exit code {retcode}") + raise RuntimeError("Command failed with exit code %s" % (retcode)) def subprocess_check_output(self, command): if logCommands: @@ -698,8 +698,8 @@ ] } categ = trackData["category"] - fname = f"{tId}" - dest = os.path.join(self.outdir, fname) + fname = tId + dest = "%s/%s" % (self.outdir, fname) gname = trackData["assemblyNames"] cmd = [ @@ -1198,6 +1198,9 @@ def process_annotations(self, track): category = track["category"].replace("__pd__date__pd__", TODAY) + tt1 = ",/ :;\\" + tt2 = "______" + labttab = str.maketrans(tt1,tt2) for trackIndex, ( dataset_path, dataset_ext, @@ -1209,20 +1212,12 @@ # Unsanitize labels (element_identifiers are always sanitized by Galaxy) for key, value in mapped_chars.items(): track_human_label = track_human_label.replace(value, key) - track_human_label = track_human_label.replace(" ", "_") + track_human_label = track_human_label.translate(labttab) outputTrackConfig = { "category": category, "style": {}, } - # hashData = [ - # str(dataset_path), - # track_human_label, - # track["category"], - # ] - # hashData = "|".join(hashData).encode("utf-8") - # hash_string = hashlib.md5(hashData).hexdigest() - outputTrackConfig["assemblyNames"] = track["assemblyNames"] outputTrackConfig["key"] = track_human_label outputTrackConfig["useuri"] = useuri @@ -1230,13 +1225,6 @@ outputTrackConfig["ext"] = dataset_ext outputTrackConfig["trackset"] = track.get("trackset", {}) outputTrackConfig["label"] = track["label"] - # outputTrackConfig["label"] = "%s_%i_%s_%s" % ( - # dataset_ext, - # trackIndex, - # track_human_label, - # hash_string, - # ) - outputTrackConfig["metadata"] = extra_metadata outputTrackConfig["name"] = track_human_label if track["label"] in self.trackIdlist: @@ -1331,6 +1319,7 @@ https://github.com/abretaud/tools-iuc/blob/jbrowse2/tools/jbrowse2/jbrowse2.py """ # TODO using the default session for now, but check out session specs in the future https://github.com/GMOD/jbrowse-components/issues/2708 + bpPerPx = 50 # this is tricky since browser window width is unknown - this seems a compromise that sort of works.... track_types = {} with open(self.config_json_file, "r") as config_file: config_json = json.load(config_file) @@ -1369,24 +1358,17 @@ "displays": [style_data], } ) - view_json = { - "type": "LinearGenomeView", - "offsetPx": 0, - "minimized": False, - "tracks": tracks_data, - } first = [x for x in self.ass_first_contigs if x[0] == gnome] - if len(first) > 0: - [gnome, refName, end] = first[0] - start = 0 - end = int(end) - drdict = { - "refName": refName, - "start": start, - "end": end, + drdict = { "reversed": False, "assemblyName": gnome, } + if len(first) > 0: + [gnome, refName, end] = first[0] + drdict["refName"] = refName + drdict["start"] = 0 + end = int(end) + drdict["end"] = end else: ddl = default_data.get("defaultLocation", None) if ddl: @@ -1404,6 +1386,13 @@ "@@@ regexp could not match contig:start..end in the supplied location %s - please fix" % ddl ) + view_json = { + "type": "LinearGenomeView", + "offsetPx": 0, + "bpPerPx" : bpPerPx, + "minimized": False, + "tracks": tracks_data + } if drdict.get("refName", None): # TODO displayedRegions is not just zooming to the region, it hides the rest of the chromosome view_json["displayedRegions"] = [ @@ -1628,7 +1617,7 @@ if trackfiles: for x in trackfiles: track_conf["label"] = "%s_%d" % ( - x.attrib["label"].replace(" ", "_").replace(",", ""), + x.attrib["label"].replace(" ", "_").replace(",", "_").replace("/","_"), trackI, ) trackI += 1
--- a/jbrowse2.xml Wed Jun 05 10:00:07 2024 +0000 +++ b/jbrowse2.xml Fri Jun 21 23:34:31 2024 +0000 @@ -8,6 +8,7 @@ <xref type="bio.tools">jbrowse2</xref> </xrefs> <expand macro="requirements"/> + <expand macro="creators"/> <required_files> <include path="autogenJB2.py"/> <include path="blastxml_to_gapped_gff3.py"/> @@ -28,9 +29,9 @@ #if $autoCollection[$key].is_collection: #set subCol=$autoCollection[$key] #set pafs=[($subCol[x],$subcol[x].ext,x) for x in $subCol.keys() if $subCol[x].ext == 'paf'] + #set refs=[($subCol[x],$subcol[x].ext,x) for x in $subCol.keys() if $subCol[x].ext in ['fasta.gz','fasta']] #if len($pafs) > 0: --pafmeta '$pafs[0]' - #set refs = [($pafs[0][2],$subCol[x],x) for x in $subCol.keys() if $subCol[x].ext == 'fasta'] #for $ref in $refs: --pafreferencemeta '$ref' #end for @@ -314,7 +315,7 @@ ]]></configfile> </configfiles> <inputs> - <repeat name="assemblies" min="1" title="Genome reference to provide display coordinates for this set of tracks" help="JBrowse2 can show a set of tracks for each of multiple genome reference fasta files"> + <repeat name="assemblies" min="1" title="Genome for a set of tracks" help="Tracks will display on this genome coordinates so must all match. Multiple genomes with their own sets of tracks can be added"> <conditional name="reference_genome"> <param name="genome_type_select" type="select" label="Reference genome source" help="Select a built in, history or remote tabix URI for the reference track"> <option selected="True" value="indexed">Use a Galaxy server built-in genome</option> @@ -334,8 +335,11 @@ <param name="genome" type="data" format="fasta" optional="true" label="Select the reference genome"/> </when> <when value="uri"> - <param name="uri" type="text" label="URI pointing to tabix compressed fasta"/> - <param name="refname" type="text" label="Reference dbkey for tracks with this genome, such as hg38 or SacCer4"/> + <param name="uri" type="text" label="URI pointing to tabix compressed fasta - must always be on-line" + help="Warning: Requires an internet connection to view. If this URI is not available for any reason, the track will show an error. Saves disk storage"> + </param> + <param name="refname" type="text" label="Reference dbkey for tracks with this genome, such as hg38 or SacCer4"> + </param> </when> </conditional> <repeat name="track_groups" title="Track Group"> @@ -343,16 +347,16 @@ <repeat name="data_tracks" title="Annotation Track"> <conditional name="data_format" label="Track Data Selection Options"> <param name="data_format_select" type="select" label="Track Type"> - <option value="bam">BAM track. Recommend convert to faster BED unless mapping annotation needed</option> + <option value="bam">BAM track. Recommend converting to BED/bigWig unless mapping annotation needed</option> <option value="bed">BED track</option> <option value="bigwig">BigWig track</option> <option value="blastxml">Blast XML track (as GFF3)</option> - <option value="cram">CRAM track, we recomment to convert to BED like for BAM</option> + <option value="cram">CRAM track. Recommend converting to BED/bigWig unless mapping annotation needed</option> <option value="gff">GFF/GFF3 track</option> <option value="cool">HiC as cool/mcool/scool format files</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> + <option value="paf">PAF - Pairwise approximate mapping positions between two set of sequences</option> <option value="vcf">VCF SNP track</option> </param> <when value="blastxml"> @@ -404,6 +408,7 @@ <when value="bigwig"> <expand macro="input_conditional" label="BigWig Track Data" format="bigwig"/> <expand macro="track_visibility"/> + <expand macro="track_styling_bigwig"/> </when> <when value="paf"> <expand macro="input_conditional" label="PAF format synteny mapping data" format="paf" help="PAF made with mashmap or minimap2 mapping the real reference as a query on the comparison genomes as references"/> @@ -1129,29 +1134,31 @@ JBrowse2-in-Galaxy offers a highly configurable, workflow-compatible Genome viewer. -Compared to JBrowse1-in-Galaxy, there is no support for alternative codons for unusual genomes, -and detailed track styling is not yet implemented. Please contact us if you are missing features. Use and local viewing ===================== +All tracks have a coordinate system, based on the reference genome, so that must be chosen before adding groups of tracks. +There are 10 Galaxy datatypes that can be turned into a track for display - in all cases, the selected reference genome must have been +used to generate the data: + + bam + bed + bigwig + blastxml + cram + gff3 + hic + maf + paf + vcf + +cram and bam will be large, so very slow amd are only recommended if you need the cigar annotation. +Otherwise conversion to bed is recommended to slim them down. +Unfortunately if you have millions of rows in a bed, it will also be very slow - in which case a bigwig is recommended. A JBrowse2 history item can be opened by viewing it (the "eye" icon). -The same browser data and setup can also be downloaded as a compressed zip archive by clicking the download ("floppy disk") icon in the history. -This can be shared and viewed without Galaxy. - -A replacement application to serve the browser is required without Galaxy. A local python web server can be started using a script included in each archive, -assuming that Python3 is already working on your desktop - if not you will have to install it first. Unzip the archive (*unzip [filename].zip*) and change -directory to the first level in that zip archive. It contains a file named *jb2_webserver.py* - -With python3 installed, - -*python3 jb2_webserver.py* - -will serve the unarchived JBrowse2 configuration from the same directory as the python script automatically. If a new browser window does not open, -but the script appears to be running, try pointing your web browser to the default of *localhost:8080* - Overview -------- @@ -1175,6 +1182,7 @@ **Track Groups** represent a set of tracks in a single category. + Annotation Tracks ----------------- @@ -1232,6 +1240,22 @@ **Protein blast search** option merely informs underlying tools that they should adjust feature locations by 3x. +Local viewing +============= + +The same browser data and setup can also be downloaded as a compressed zip archive by clicking the download ("floppy disk") icon in the history. +This can be shared and viewed without Galaxy. + +A replacement application to serve the browser is required without Galaxy. A local python web server can be started using a script included in each archive, +assuming that Python3 is already working on your desktop - if not you will have to install it first. Unzip the archive (*unzip [filename].zip*) and change +directory to the first level in that zip archive. It contains a file named *jb2_webserver.py* + +With python3 installed, + +*python3 jb2_webserver.py* + +will serve the unarchived JBrowse2 configuration from the same directory as the python script automatically. If a new browser window does not open, +but the script appears to be running, try pointing your web browser to the default of *localhost:8080* ]]></help> <expand macro="citations"/>
--- a/macros.xml Wed Jun 05 10:00:07 2024 +0000 +++ b/macros.xml Fri Jun 21 23:34:31 2024 +0000 @@ -333,6 +333,13 @@ <option value="LinearWiggleDisplay" selected="true">LinearWiggleDisplay</option> </param> <when value="LinearWiggleDisplay"> + <param name="color" type="color" value="#135560" label="Wiggle colour"> + <sanitizer> + <valid initial="string.ascii_letters,string.digits"> + <add value="#"/> + </valid> + </sanitizer> + </param> <param name="autoscale" type="select" label="Autoscale type"> <option value="local" selected="true">Local</option> <option value="global">Global</option> @@ -432,13 +439,13 @@ <conditional name="useuri"> <param name="insource" type="select" label="Define track data as a history file or an internet URI" help="A public URI implies that all the associated tabix files are also in place. They are created for history files"> <option value="history" selected="true">Track data from a history file</option> - <option value="uri">Tabix data URI - index files must be available at corresponding URI</option> + <option value="uri">Tabix data URI: Internet connection required to view. Tabix index files must be available</option> </param> <when value="history"> <param name="annotation" type="data" format="@FORMAT@" optional="true" label="@LABEL@" multiple="True"/> </when> <when value="uri"> - <param name="annouri" type="text" label="@LABEL@"/> + <param name="annouri" type="text" label="@LABEL@" help="Requires internet. Will show an error if not online. Saves all the tabix file disk storage"/> <param name="annoname" type="text" label="Short name for track display"> <sanitizer invalid_char="_"> <valid initial="string.printable">