Mercurial > repos > yating-l > jbrowsearchivecreator
changeset 13:43a700afd457 draft
planemo upload for repository https://github.com/goeckslab/jbrowse-archive-creator.git commit bcb239c4045d2c47a8acad5fbd29eea03663e187
author | yating-l |
---|---|
date | Tue, 19 Jun 2018 17:59:51 -0400 |
parents | 9161beae834f |
children | 3f9971a91096 |
files | README.md TrackHub.py datatypes/Datatype.py datatypes/Datatype.pyc datatypes/converters/DataConversion.pyc datatypes/converters/bedToGff3.pyc datatypes/converters/blastxmlToGff3.pyc datatypes/interval/Bed.pyc datatypes/interval/Interval.pyc datatypes/interval/__init__.pyc jbrowse-archive-creator.iml jbrowseArchiveCreator.xml tracks/BamFeatures.pyc tracks/BigwigFeatures.pyc tracks/CanvasFeatures.pyc tracks/HTMLFeatures.pyc tracks/TrackDb.py tracks/TrackDb.pyc tracks/__init__.pyc util/Reader.py util/santitizer.pyc util/subtools.py util/subtools.pyc |
diffstat | 23 files changed, 72 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/README.md Sat Jun 02 13:08:46 2018 -0400 +++ b/README.md Tue Jun 19 17:59:51 2018 -0400 @@ -1,5 +1,5 @@ # JBrowse Hub Creator -This Galaxy tool permits to prepare your files to be ready for JBrowse visualization. +This Galaxy tool is used to prepare your files to be ready for JBrowse visualization. ## Features 1. Similar interface to Hub Archive Creator. @@ -7,33 +7,36 @@ 3. Group the tracks 4. Set the color for each track 5. Set the label for each track -6. Create workflows within Galaxy to automatize pipeline analysis and get them ready to visualization inside JBrowse...in a few clicks! +6. Support generating Tabix Indexed CanVasFeatures tracks +7. Create workflows within Galaxy to automatize pipeline analysis and get them ready to visualization inside JBrowse...in a few clicks! At the moment, Supported datatypes are: -- Bam -- Bed +- BAM +- BED + - Generic BED - Splice Junctions (BED 12+1) - Simple Repeats (BED 4+12) + - BLAT alignment (BigPsl) + - BLAST alignment (BED 12+12) - BigWig -- Gff3 -- Gtf -- Blastxml -- BigPsl +- GFF3 +- GTF +- Blast XML output ## Installation: -1. You would need to add this tool into your Galaxy. - 1. (strongly preferred) **ToolShed Installation**: Tool is in [testtoolshed](https://testtoolshed.g2.bx.psu.edu/view/yating-l/jbrowse_hub/b7bf45272ab7) - 2. OR **Local Installation**: See https://wiki.galaxyproject.org/Admin/Tools/AddToolTutorial -2. The tool can be used with or without Conda (activate it in your galaxy.ini) -3. If installed without TS (by downloading on GitHub), you need to have all the binaries accessible within Galaxy. - You can use the script [install_linux_binaries](util/install_linux_binaries) with a linux x86-64 (64bits) + +**ToolShed Installation**: +- The JBrowse Archive Creator tool is published at [ToolShed Repository](https://toolshed.g2.bx.psu.edu/view/yating-l/jbrowsearchivecreator) + +- Refer to [Installing Tools into Galaxy](https://galaxyproject.org/admin/tools/add-tool-from-toolshed-tutorial) tutorial if you want to learn how to install a tool from ToolShed. + ## Future See [TODO.md](todo.md) for more information ## Contribute -- Source Code: https://github.com/Yating-L/jbrowse_hub +- Source Code: https://github.com/goeckslab/jbrowse-archive-creator.git ## Support @@ -41,7 +44,7 @@ - For more information about how to use G-OnRamp: - [Wilson Leung](wleung@wustl.edu) - Product owner and developer - - [Yating Liu](yliu41@wustl.edu) - Community manager and Developer + - [Yating Liu](yliu41@wustl.edu) - Community manager and developer - For more information about the project vision, or for partneship: - [Elgin, Sarah](selgin@wustl.edu) - PI
--- a/TrackHub.py Sat Jun 02 13:08:46 2018 -0400 +++ b/TrackHub.py Tue Jun 19 17:59:51 2018 -0400 @@ -51,10 +51,12 @@ if Datatype.trackType == 'HTMLFeatures': self.myTrackStyle = TrackStyles(self.tool_directory, self.mySpecieFolderPath, self.trackList) self.logger = logging.getLogger(__name__) + self.nameIndexTrackList = [] - def addTrack(self, trackDbObject): + if trackDbObject['nameIndex'] == "true": + self.nameIndexTrackList.append(trackDbObject['trackLabel']) if trackDbObject['dataType'].lower() == 'bam': subtools.add_track_json(self.trackList, trackDbObject['options']) elif trackDbObject['dataType'].lower() == 'bigwig': @@ -104,8 +106,9 @@ subtools.prepare_refseqs(self.reference_genome.false_path, self.mySpecieFolderPath) def _indexName(self): - subtools.generate_names(self.mySpecieFolderPath) - print "finished name index \n" + if self.nameIndexTrackList: + subtools.generate_names(self.mySpecieFolderPath, self.nameIndexTrackList) + print "finished name index \n" def _outHtml(self): mylookup = TemplateLookup(directories=[os.path.join(self.tool_directory, 'templates')],
--- a/datatypes/Datatype.py Sat Jun 02 13:08:46 2018 -0400 +++ b/datatypes/Datatype.py Tue Jun 19 17:59:51 2018 -0400 @@ -98,6 +98,8 @@ self.extraSettings["category"] = self.trackSettings["group_name"] if "track_color" in self.trackSettings and self.trackSettings["track_color"]: self.extraSettings["color"] = self.trackSettings["track_color"] + #store information of whether to generate name index for the track + self.extraSettings["nameIndex"] = self.trackSettings["nameIndex"] @abc.abstractmethod
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jbrowse-archive-creator.iml Tue Jun 19 17:59:51 2018 -0400 @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module type="PYTHON_MODULE" version="4"> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <exclude-output /> + <content url="file://$MODULE_DIR$" /> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + </component> +</module> \ No newline at end of file
--- a/jbrowseArchiveCreator.xml Sat Jun 02 13:08:46 2018 -0400 +++ b/jbrowseArchiveCreator.xml Tue Jun 19 17:59:51 2018 -0400 @@ -1,4 +1,4 @@ -<tool id="jbrowse_hub" name="JBrowse Archive Creator" version="2.1.5"> +<tool id="jbrowse_hub" name="JBrowse Archive Creator" version="2.2.1"> <description> This Galaxy tool is used to prepare your files to be ready for displaying on JBrowse with Apollo plugin </description> @@ -81,6 +81,7 @@ #set track_color = str($f.formatChoice.track_color) #set group_name = str($g.group_name) #set longLabel = str($f.formatChoice.longLabel) + #set extra_data_dict = {"track_color": $track_color, "group_name": $group_name, "long_label": $longLabel} @@ -88,11 +89,12 @@ #set bam_index = $f.formatChoice.BAM.metadata.bam_index ## Add Bam format specific fields - #silent $extra_data_dict.update({"index": $bam_index}) + #silent $extra_data_dict.update({"index": $bam_index, "nameIndex": str($f.formatChoice.nameIndex)}) #silent $prepare_json("Bam", $f.formatChoice.BAM, $index_track_final, $extra_data_dict) #end if #if $f.formatChoice.format_select == "bed" + #silent $extra_data_dict.update({"nameIndex": str($f.formatChoice.bedChoice.nameIndex)}) #if $f.formatChoice.bedChoice.bed_select == "bed_generic" #silent $prepare_json("Bed", $f.formatChoice.bedChoice.BED_generic, $index_track_final, $extra_data_dict) @@ -119,18 +121,22 @@ #end if #end if #if $f.formatChoice.format_select == "blastxml" - #silent $prepare_json("BlastXml", $f.formatChoice.BlastXML, $index_track_final, + #silent $extra_data_dict.update({"nameIndex": str($f.formatChoice.nameIndex)}) + #silent $prepare_json("BlastXml", $f.formatChoice.BlastXML, $index_track_final, extra_data_dict) #end if #if $f.formatChoice.format_select == "bigwig" + #silent $extra_data_dict.update({"nameIndex": str($f.formatChoice.nameIndex)}) #silent $prepare_json("BigWig", $f.formatChoice.BIGWIG, $index_track_final, $extra_data_dict) #end if #if $f.formatChoice.format_select == 'gff3' + #silent $extra_data_dict.update({"nameIndex": str($f.formatChoice.nameIndex)}) #silent $prepare_json("Gff3", $f.formatChoice.GFF3, $index_track_final, $extra_data_dict) #end if #if $f.formatChoice.format_select == "gtf" + #silent $extra_data_dict.update({"nameIndex": str($f.formatChoice.nameIndex)}) ## Add also GTF from Agustus? See https://github.com/ENCODE-DCC/kentUtils/issues/8 #silent $prepare_json("Gtf", $f.formatChoice.GTF, $index_track_final, $extra_data_dict) @@ -200,11 +206,12 @@ </valid> </sanitizer> </param> + <param name="nameIndex" type="boolean" label="Do you want to builds name indexes for this track to enable search for a feature by name" /> </when> <when value="bed"> <conditional name="bedChoice"> <param name="bed_select" type="select" label="Bed Choice"> - <option value="bed_generic">BED format</option> + <option value="bed_generic">BED Generic</option> <option value="bed_simple_repeats_option">BED Simple repeat (bed4+12 / simpleRepeat.as)</option> <option value="bed_splice_junctions_option">BED Splice junctions (bed12+1 / spliceJunctions.as)</option> <option value="bed_blast_alignment_option">Blast alignments (bed12+12 / bigPsl.as)</option> @@ -217,6 +224,7 @@ type="data" label="Bed File" /> + <param name="nameIndex" type="boolean" label="Do you want to builds name indexes for this track to enable search for a feature by name" /> </when> <when value="bed_simple_repeats_option"> <param @@ -225,6 +233,7 @@ type="data" label="Bed Simple Repeats (Bed4+12) File" /> + <param name="nameIndex" type="boolean" label="Do you want to builds name indexes for this track to enable search for a feature by name" /> </when> <when value="bed_splice_junctions_option"> <param @@ -233,6 +242,7 @@ type="data" label="Bed Splice Junctions (Bed12+1) File" /> + <param name="nameIndex" type="boolean" label="Do you want to builds name indexes for this track to enable search for a feature by name" /> </when> <when value="bed_blast_alignment_option"> <param @@ -241,6 +251,7 @@ type="data" label="Bed Blast Alignments (Bed12+12) File" /> + <param name="nameIndex" type="boolean" checked="true" label="Do you want to builds name indexes for this track to enable search for a feature by name" /> </when> <when value="bed_blat_alignment_option"> <param @@ -249,6 +260,7 @@ type="data" label="Bed BLAT Alignments (bigPsl) File" /> + <param name="nameIndex" type="boolean" checked="true" label="Do you want to builds name indexes for this track to enable search for a feature by name" /> </when> </conditional> <param name="longLabel" type="text" size="30" label="Track label" /> @@ -275,6 +287,7 @@ </valid> </sanitizer> </param> + <param name="nameIndex" type="boolean" checked="true" label="Do you want to builds name indexes for this track to enable search for a feature by name" /> </when> <when value="bigwig"> <param @@ -291,6 +304,7 @@ </valid> </sanitizer> </param> + <param name="nameIndex" type="boolean" label="Do you want to builds name indexes for this track to enable search for a feature by name" /> </when> <when value="gff3"> <param @@ -307,6 +321,7 @@ </valid> </sanitizer> </param> + <param name="nameIndex" type="boolean" label="Do you want to builds name indexes for this track to enable search for a feature by name" /> </when> <when value="gtf"> <param @@ -323,7 +338,8 @@ </valid> </sanitizer> </param> - </when> + <param name="nameIndex" type="boolean" label="Do you want to builds name indexes for this track to enable search for a feature by name" /> + </when> </conditional> </repeat> </repeat>
--- a/tracks/TrackDb.py Sat Jun 02 13:08:46 2018 -0400 +++ b/tracks/TrackDb.py Tue Jun 19 17:59:51 2018 -0400 @@ -40,7 +40,8 @@ ("dataType", self.dataType), ("trackType", self.trackType)] ) - + + self.track_db["nameIndex"] = self.extraSettings['nameIndex'] extraConfigs = self.prepareExtraSetting() self.logger.debug("Generate extraConfigs = %s", json.dumps(extraConfigs))
--- a/util/Reader.py Sat Jun 02 13:08:46 2018 -0400 +++ b/util/Reader.py Tue Jun 19 17:59:51 2018 -0400 @@ -120,11 +120,15 @@ # TODO: Optimize this double loop for input_data in array_inputs: input_false_path = input_data["false_path"] - input_data["name"] = santitizer.sanitize_name_input(input_data["name"]) - extensionObject = ExtensionClass(input_false_path, input_data) - extensionObject.generateCustomTrack() - datatype_dictionary.update({input_data["order_index"]: extensionObject}) - self.logger.debug("%s object: %s has been created", ExtensionClass, input_data["name"]) + # if the file is empty, skip the rest + if os.path.isfile(input_false_path) and os.path.getsize(input_false_path) > 0: + input_data["name"] = santitizer.sanitize_name_input(input_data["name"]) + extensionObject = ExtensionClass(input_false_path, input_data) + extensionObject.generateCustomTrack() + datatype_dictionary.update({input_data["order_index"]: extensionObject}) + self.logger.debug("%s object: %s has been created", ExtensionClass, input_data["name"]) + else: + self.logger.info("The input file: %s is empty, skip creating the track for this data", input_data["name"]) return datatype_dictionary
--- a/util/subtools.py Sat Jun 02 13:08:46 2018 -0400 +++ b/util/subtools.py Tue Jun 19 17:59:51 2018 -0400 @@ -382,8 +382,10 @@ p = _handleExceptionAndCheckCall(array_call) return p -def generate_names(outputFolder, hashBits=4): - array_call = ['generate-names.pl', '--hashBits', '4', '-v', '--out', outputFolder] +def generate_names(outputFolder, nameIndexTrackList, hashBits=4): + array_call = ['generate-names.pl', '--hashBits', str(hashBits), '-v', '--completionLimit', '0', '--out', outputFolder] + array_call.append('--tracks') + array_call.append(','.join(nameIndexTrackList)) p = _handleExceptionAndCheckCall(array_call) return p