Previous changeset 16:3233451a3bd6 (2016-09-25) Next changeset 18:d786bca6a75d (2016-09-30) |
Commit message:
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1adbf397de1fc7af4d91e026093d7fff983e21cf |
modified:
Bam.py Bed.py Bed.pyc BedSimpleRepeats.py BedSimpleRepeats.pyc BigWig.py BigWig.pyc Datatype.py Datatype.pyc Gff3.py Gff3.pyc Gtf.py Gtf.pyc Psl.py Psl.pyc Track.py Track.pyc TrackDb.py TrackDb.pyc TrackHub.py TrackHub.pyc hubArchiveCreator.py hubArchiveCreator.xml templates/groupsTxt/layout.txt templates/trackDb/layout.txt tool_dependencies.xml |
removed:
Bam.pyc |
b |
diff -r 3233451a3bd6 -r c02720d1afee Bam.py --- a/Bam.py Sun Sep 25 11:25:38 2016 -0400 +++ b/Bam.py Fri Sep 30 15:14:24 2016 -0400 |
[ |
@@ -32,12 +32,11 @@ self.priority = self.data_bam["order_index"] self.index_bam = self.data_bam["index"] - # TODO: Think about how to avoir repetition of the color treatment + # TODO: Think about how to avoid repetition of the color treatment self.track_color = self.data_bam["track_color"] - logging.debug("Color of bam: {0}".format(self.track_color)) - - #print "Creating TrackHub BAM from (falsePath: %s; name: %s)" % ( self.input_bam_false_path, self.name_bam) + # TODO: Think about how to avoid repetition of the group_name everywhere + self.group_name = self.data_bam["group_name"] # First: Add the bam file # Second: Add the bam index file, in the same folder (https://genome.ucsc.edu/goldenpath/help/bam.html) @@ -55,7 +54,9 @@ track_name=self.name_bam, long_label=self.name_bam, track_type='bam', visibility='pack', priority=self.priority, track_file=bam_index_file_path, - track_color=self.track_color) + track_color=self.track_color, + group_name=self.group_name + ) # # dataURL = "tracks/%s" % self.name_bam # |
b |
diff -r 3233451a3bd6 -r c02720d1afee Bam.pyc |
b |
Binary file Bam.pyc has changed |
b |
diff -r 3233451a3bd6 -r c02720d1afee Bed.py --- a/Bed.py Sun Sep 25 11:25:38 2016 -0400 +++ b/Bed.py Fri Sep 30 15:14:24 2016 -0400 |
[ |
@@ -24,6 +24,9 @@ self.name_bed_generic = self.data_bed_generic["name"] self.priority = self.data_bed_generic["order_index"] self.track_color = self.data_bed_generic["track_color"] + # TODO: Think about how to avoid repetition of the group_name everywhere + self.group_name = self.data_bed_generic["group_name"] + # Sort processing subtools.sort(self.inputBedGeneric, self.sortedBedFile.name) @@ -44,7 +47,8 @@ long_label=self.name_bed_generic, track_type='bigBed', visibility='dense', priority=self.priority, track_file=myBigBedFilePath, - track_color=self.track_color) + track_color=self.track_color, + group_name=self.group_name) # dataURL = "tracks/%s" % trackName # |
b |
diff -r 3233451a3bd6 -r c02720d1afee Bed.pyc |
b |
Binary file Bed.pyc has changed |
b |
diff -r 3233451a3bd6 -r c02720d1afee BedSimpleRepeats.py --- a/BedSimpleRepeats.py Sun Sep 25 11:25:38 2016 -0400 +++ b/BedSimpleRepeats.py Fri Sep 30 15:14:24 2016 -0400 |
[ |
@@ -18,6 +18,8 @@ self.name_bed_simple_repeats = data_bed_simple_repeats["name"] self.priority = data_bed_simple_repeats["order_index"] self.track_color = data_bed_simple_repeats["track_color"] + # TODO: Think about how to avoid repetition of the group_name everywhere + self.group_name = data_bed_simple_repeats["group_name"] sortedBedFile = tempfile.NamedTemporaryFile(suffix=".sortedBed") @@ -44,7 +46,8 @@ long_label=self.name_bed_simple_repeats, track_type='bigBed 4 +', visibility='dense', priority=self.priority, track_file=myBigBedFilePath, - track_color=self.track_color) + track_color=self.track_color, + group_name=self.group_name) # dataURL = "tracks/%s" % trackName # |
b |
diff -r 3233451a3bd6 -r c02720d1afee BedSimpleRepeats.pyc |
b |
Binary file BedSimpleRepeats.pyc has changed |
b |
diff -r 3233451a3bd6 -r c02720d1afee BigWig.py --- a/BigWig.py Sun Sep 25 11:25:38 2016 -0400 +++ b/BigWig.py Fri Sep 30 15:14:24 2016 -0400 |
[ |
@@ -19,6 +19,8 @@ self.name_bigwig = data_bigwig["name"] self.priority = data_bigwig["order_index"] self.track_color = data_bigwig["track_color"] + # TODO: Think about how to avoid repetition of the group_name everywhere + self.group_name = data_bigwig["group_name"] #print "Creating TrackHub BigWig from (falsePath: %s; name: %s)" % ( self.input_bigwig_path, self.name_bigwig ) @@ -34,7 +36,8 @@ track_type='bigWig', visibility='full', priority=self.priority, track_file=myBigWigFilePath, - track_color=self.track_color) + track_color=self.track_color, + group_name=self.group_name) # dataURL = "tracks/%s" % trackName # |
b |
diff -r 3233451a3bd6 -r c02720d1afee BigWig.pyc |
b |
Binary file BigWig.pyc has changed |
b |
diff -r 3233451a3bd6 -r c02720d1afee Datatype.py --- a/Datatype.py Sun Sep 25 11:25:38 2016 -0400 +++ b/Datatype.py Fri Sep 30 15:14:24 2016 -0400 |
b |
@@ -76,7 +76,7 @@ file_path=None, track_name=None, long_label=None, thick_draw_item='off', short_label=None, track_type=None, visibility=None, priority=None, - track_file=None, track_color='#000000'): + track_file=None, track_color='#000000', group_name="Default"): # TODO: Remove the hardcoded "tracks" by the value used as variable from myTrackFolderPath data_url = "tracks/%s" % file_path @@ -104,7 +104,8 @@ visibility=visibility, thickDrawItem=thick_draw_item, priority=priority, - track_color=rgb_ucsc + track_color=rgb_ucsc, + group_name=group_name ) # Return the Bam Track Object |
b |
diff -r 3233451a3bd6 -r c02720d1afee Datatype.pyc |
b |
Binary file Datatype.pyc has changed |
b |
diff -r 3233451a3bd6 -r c02720d1afee Gff3.py --- a/Gff3.py Sun Sep 25 11:25:38 2016 -0400 +++ b/Gff3.py Fri Sep 30 15:14:24 2016 -0400 |
[ |
@@ -20,6 +20,8 @@ self.name_gff3 = data_gff3["name"] self.priority = data_gff3["order_index"] self.track_color = data_gff3["track_color"] + # TODO: Think about how to avoid repetition of the group_name everywhere + self.group_name = data_gff3["group_name"] # TODO: See if we need these temporary files as part of the generated files unsorted_genePred_file = tempfile.NamedTemporaryFile(bufsize=0, suffix=".genePred") @@ -59,6 +61,7 @@ track_type='bigGenePred', visibility='dense', priority=self.priority, track_file=myBigBedFilePath, - track_color=self.track_color) + track_color=self.track_color, + group_name=self.group_name) print("- Gff3 %s created" % self.name_gff3) |
b |
diff -r 3233451a3bd6 -r c02720d1afee Gff3.pyc |
b |
Binary file Gff3.pyc has changed |
b |
diff -r 3233451a3bd6 -r c02720d1afee Gtf.py --- a/Gtf.py Sun Sep 25 11:25:38 2016 -0400 +++ b/Gtf.py Fri Sep 30 15:14:24 2016 -0400 |
[ |
@@ -21,6 +21,8 @@ self.name_gtf = data_gtf["name"] self.priority = data_gtf["order_index"] self.track_color = data_gtf["track_color"] + # TODO: Think about how to avoid repetition of the group_name everywhere + self.group_name = data_gtf["group_name"] #print "Creating TrackHub GTF from (falsePath: %s; name: %s)" % ( self.input_gtf_false_path, self.name_gtf) @@ -61,6 +63,7 @@ long_label=self.name_gtf, track_type='bigGenePred', visibility='dense', priority=self.priority, track_file=myBigBedFilePath, - track_color=self.track_color) + track_color=self.track_color, + group_name=self.group_name) print("- Gtf %s created" % self.name_gtf) |
b |
diff -r 3233451a3bd6 -r c02720d1afee Gtf.pyc |
b |
Binary file Gtf.pyc has changed |
b |
diff -r 3233451a3bd6 -r c02720d1afee Psl.py --- a/Psl.py Sun Sep 25 11:25:38 2016 -0400 +++ b/Psl.py Fri Sep 30 15:14:24 2016 -0400 |
[ |
@@ -17,6 +17,8 @@ self.name_psl = data_psl["name"] self.priority = data_psl["order_index"] self.track_color = data_psl["track_color"] + # TODO: Think about how to avoid repetition of the group_name everywhere + self.group_name = data_psl["group_name"] # Temporary files unsorted_bed_formatted_psl_file = tempfile.NamedTemporaryFile(suffix='.psl') @@ -52,6 +54,7 @@ track_type='bigPsl', visibility='dense', priority=self.priority, track_file=my_big_psl_file_path, - track_color=self.track_color) + track_color=self.track_color, + group_name=self.group_name) print("- BigPsl %s created" % self.name_psl) \ No newline at end of file |
b |
diff -r 3233451a3bd6 -r c02720d1afee Psl.pyc |
b |
Binary file Psl.pyc has changed |
b |
diff -r 3233451a3bd6 -r c02720d1afee Track.py --- a/Track.py Sun Sep 25 11:25:38 2016 -0400 +++ b/Track.py Fri Sep 30 15:14:24 2016 -0400 |
b |
@@ -1,6 +1,6 @@ #!/usr/bin/python - +# TODO: Is this still useful? class Track(object): """Class to manage the track informations needed for Track Hub, in the TrackDb text file""" |
b |
diff -r 3233451a3bd6 -r c02720d1afee Track.pyc |
b |
Binary file Track.pyc has changed |
b |
diff -r 3233451a3bd6 -r c02720d1afee TrackDb.py --- a/TrackDb.py Sun Sep 25 11:25:38 2016 -0400 +++ b/TrackDb.py Fri Sep 30 15:14:24 2016 -0400 |
b |
@@ -4,7 +4,7 @@ """docstring for TrackDb""" def __init__(self, trackName="", longLabel="", shortLabel="", trackDataURL="", trackType="", visibility="", - thickDrawItem='off', priority="0", track_color="#000000"): + thickDrawItem='off', priority="0", track_color="#000000", group_name="Default"): super(TrackDb, self).__init__() self.trackName = trackName @@ -16,3 +16,4 @@ self.thickDrawItem = thickDrawItem self.priority = priority self.track_color = track_color + self.group_name = group_name |
b |
diff -r 3233451a3bd6 -r c02720d1afee TrackDb.pyc |
b |
Binary file TrackDb.pyc has changed |
b |
diff -r 3233451a3bd6 -r c02720d1afee TrackHub.py --- a/TrackHub.py Sun Sep 25 11:25:38 2016 -0400 +++ b/TrackHub.py Fri Sep 30 15:14:24 2016 -0400 |
[ |
@@ -33,11 +33,23 @@ self.default_pos = None self.user_email = user_email + # Set containing the groups already added. Updated by addGroup() + self.groups = set() + # TODO: Modify according to the files passed in parameter + # ---- Templates ---- + # Template trackDb mylookup = TemplateLookup(directories=[os.path.join(tool_directory, 'templates/trackDb')], output_encoding='utf-8', encoding_errors='replace') self.trackDbTemplate = mylookup.get_template("layout.txt") + # Template groups + mylookup = TemplateLookup(directories=[os.path.join(self.tool_directory, 'templates/groupsTxt')], + output_encoding='utf-8', encoding_errors='replace') + self.groupsTemplate = mylookup.get_template("layout.txt") + + # ---- End Templates ---- + self.extra_files_path = extra_files_path self.outputFile = outputFile @@ -68,16 +80,43 @@ def addTrack(self, trackDbObject=None): # Create the trackDb.txt file in the specie folder, if not exists # Else append the new track + # TODO: Get this out of the function trackDbTxtFilePath = os.path.join(self.mySpecieFolderPath, 'trackDb.txt') # Append to trackDbTxtFilePath the trackDbTemplate populate with the newTrack object with open(trackDbTxtFilePath, 'a+') as trackDbFile: trackDbs = [trackDbObject] + + # TODO: The addGroup does not belong here. Move it when the group becomes more than just a label + # Add the group as well, if exists in trackDbObject + self.addGroup(trackDbObject.group_name) + htmlMakoRendered = self.trackDbTemplate.render( trackDbs=trackDbs ) trackDbFile.write(htmlMakoRendered) + def addGroup(self, group_name="Default"): + # If not already present in self.groups, add to groups.txt + # Create the trackDb.txt file in the specie folder, if not exists + # Else append the new track + # TODO: Get this out of the function + groupsTxtFilePath = os.path.join(self.mySpecieFolderPath, 'groups.txt') + + # If the group is already present, we don't need to add it + if group_name in self.groups: + return + + # Append to trackDbTxtFilePath the trackDbTemplate populate with the newTrack object + with open(groupsTxtFilePath, 'a+') as groupFile: + # Add the group as well, if exists in trackDbObject + + htmlMakoRendered = self.groupsTemplate.render( + label=group_name + ) + groupFile.write(htmlMakoRendered) + self.groups.add(group_name) + def terminate(self): # Just a test to output a simple HTML # TODO: Create a class to handle the file object @@ -182,8 +221,8 @@ # Create the file groups.txt # TODO: If not inputs for this, do no create the file - groupsTxtFilePath = os.path.join(mySpecieFolderPath, 'groups.txt') - self.__fillGroupsTxtFile__(groupsTxtFilePath) + # groupsTxtFilePath = os.path.join(mySpecieFolderPath, 'groups.txt') + # self.__fillGroupsTxtFile__(groupsTxtFilePath) # Create the folder tracks into the specie folder tracksFolderPath = os.path.join(mySpecieFolderPath, "tracks") |
b |
diff -r 3233451a3bd6 -r c02720d1afee TrackHub.pyc |
b |
Binary file TrackHub.pyc has changed |
b |
diff -r 3233451a3bd6 -r c02720d1afee hubArchiveCreator.py --- a/hubArchiveCreator.py Sun Sep 25 11:25:38 2016 -0400 +++ b/hubArchiveCreator.py Fri Sep 30 15:14:24 2016 -0400 |
[ |
@@ -126,7 +126,6 @@ # We remove the spaces in ["name"] of inputs_data sanitize_name_inputs(inputs_data) - # TODO: Check here all the binaries / tools we need. Exception if missing # Create the Track Hub folder |
b |
diff -r 3233451a3bd6 -r c02720d1afee hubArchiveCreator.xml --- a/hubArchiveCreator.xml Sun Sep 25 11:25:38 2016 -0400 +++ b/hubArchiveCreator.xml Fri Sep 30 15:14:24 2016 -0400 |
b |
b'@@ -12,7 +12,8 @@\n <requirement type="package" version="332">ucsc-genepredtobiggenepred</requirement>\n <requirement type="package" version="332">ucsc-gff3togenepred</requirement>\n <requirement type="package" version="332">ucsc-gtftogenepred</requirement>\n- <requirement type="package" version="332">ucsc-psltobigpsl</requirement>\n+ <!-- TODO: Change the conda ucsc-psltobigpsl and take one > v337 because of bugs before -->\n+ <!-- <requirement type="package" version="332">ucsc-psltobigpsl</requirement> -->\n <requirement type="package" version="332">ucsc-twobitinfo</requirement>\n <requirement type="package" version="1.3">samtools</requirement>\n <!-- ToolShed dependencies -->\n@@ -21,6 +22,7 @@\n <requirement type="package" version="0.0.1">gtfToGenePred</requirement>\n <requirement type="package" version="0.0.1">genePredToBed</requirement>\n <requirement type="package" version="0.0.1">genePredToBigGenePred</requirement>\n+ <requirement type="package" version="0.0.1">pslToBigPsl</requirement>\n <requirement type="package" version="1.2">samtools</requirement>\n </requirements>\n \n@@ -60,48 +62,59 @@\n \n #end def\n \n- #for $i, $f in enumerate( $format )\n- #set track_color = str($f.formatChoice.track_color)\n+ #for $i_g, $g in enumerate( $group )\n+ #for $i, $f in enumerate( $g.format )\n+\n+ ## For each format, we have a few mandatory fields we store in a dict\n+ #set track_color = str($f.formatChoice.track_color)\n+ #set group_name = str($g.group_name)\n \n- #if $f.formatChoice.format_select == "bam"\n- --bam $f.formatChoice.BAM\n- #set bam_index = $f.formatChoice.BAM.metadata.bam_index\n- #silent $prepare_json($f.formatChoice.BAM, $i, {"index": $bam_index,\n- "track_color": $track_color})\n- #end if\n- #if $f.formatChoice.format_select == "bed"\n- #if $f.formatChoice.bedChoice.bed_select == "bed"\n- --bed $f.formatChoice.bedChoice.BED\n- #silent $prepare_json($f.formatChoice.bedChoice.BED, $i,\n- {"track_color": $track_color})\n- #end if\n- #if $f.formatChoice.bedChoice.bed_select == "bed_simple_repeats_option"\n- --bedSimpleRepeats $f.formatChoice.bedChoice.BED_simple_repeats\n- #silent $prepare_json($f.formatChoice.bedChoice.BED_simple_repeats, $i,\n- {"track_color": $track_color})\n+ #set extra_data_dict = {"track_color": $track_color,\n+ "group_name": $group_name}\n+\n+ #if $f.formatChoice.format_select == "bam"\n+ --bam $f.formatChoice.BAM\n+ #set bam_index = $f.formatChoice.BAM.metadata.bam_index\n+\n+ ## Add Bam format specific fields\n+ #silent extra_data_dict.update({"index": $bam_index})\n+\n+ #silent $prepare_json($f.formatChoice.BAM, $i, extra_data_dict)\n #end if\n- #end if\n- #if $f.formatChoice.format_select == "psl"\n- --psl $f.formatChoice.PSL\n- #silent $prepare_json($f.formatChoice.PSL, $i,\n- {"track_color": $track_color})\n- #end if\n- #if $f.formatChoice.format_select == "bigwig"\n- --bigwig $f.formatChoice.BIGWIG\n- #silent $prepare_json($f.formatChoice.BIGWIG, $i,\n- {"track_color": $track_color})\n- #end if\n- #if $f.formatChoice.format_select == "gff3"\n- --gff3 $f.formatChoice.GFF3\n- #silent $prepare_json($f.formatChoi'..b' </when>\n+ <when value="bed_simple_repeats_option">\n+ <param\n+ format="bed"\n+ name="BED_simple_repeats"\n+ type="data"\n+ label="Bed Simple Repeats (Bed4+12) File"\n+ />\n+ </when>\n+ </conditional>\n+ <param name="track_color" type="color" label="Track color" value="#000000">\n+ <sanitizer>\n+ <valid initial="string.letters,string.digits">\n+ <add value="#"/>\n+ </valid>\n+ </sanitizer>\n+ </param>\n+ </when>\n+ <when value="psl">\n+ <param\n+ format="psl"\n+ name="PSL"\n+ type="data"\n+ label="PSL File"\n+ />\n+ <param name="track_color" type="color" label="Track color" value="#000000">\n+ <sanitizer>\n+ <valid initial="string.letters,string.digits">\n+ <add value="#"/>\n+ </valid>\n+ </sanitizer>\n+ </param>\n+ </when>\n+ <when value="bigwig">\n+ <param\n+ format="bigwig"\n+ name="BIGWIG"\n+ type="data"\n+ label="BIGWIG File"\n+ />\n+ <param name="track_color" type="color" label="Track color" value="#000000">\n+ <sanitizer>\n+ <valid initial="string.letters,string.digits">\n+ <add value="#"/>\n+ </valid>\n+ </sanitizer>\n+ </param>\n+ </when>\n+ <when value="gff3">\n+ <param\n+ format="gff3"\n+ name="GFF3"\n+ type="data"\n+ label="GFF3 File"\n+ />\n+ <param name="track_color" type="color" label="Track color" value="#000000">\n+ <sanitizer>\n+ <valid initial="string.letters,string.digits">\n+ <add value="#"/>\n+ </valid>\n+ </sanitizer>\n+ </param>\n+ </when>\n+ <when value="gtf">\n+ <param\n+ format="gtf"\n+ name="GTF"\n+ type="data"\n+ label="GTF File"\n+ />\n+ <param name="track_color" type="color" label="Track color" value="#000000">\n+ <sanitizer>\n+ <valid initial="string.letters,string.digits">\n+ <add value="#"/>\n+ </valid>\n+ </sanitizer>\n+ </param>\n+ </when>\n+ </conditional>\n+ </repeat>\n </repeat>\n <conditional name="advanced_options">\n <param name="advanced_options_selector" type="select" label="Advanced options">\n' |
b |
diff -r 3233451a3bd6 -r c02720d1afee templates/groupsTxt/layout.txt --- a/templates/groupsTxt/layout.txt Sun Sep 25 11:25:38 2016 -0400 +++ b/templates/groupsTxt/layout.txt Fri Sep 30 15:14:24 2016 -0400 |
b |
@@ -1,4 +1,5 @@ -name ${mapName} -label ${labelMapping} -priority ${prioriy} -defaultIsClosed ${isClosed} +name ${label.lower().replace(' ', '_')} +label ${label} +priority 2 +defaultIsClosed 0 + |
b |
diff -r 3233451a3bd6 -r c02720d1afee templates/trackDb/layout.txt --- a/templates/trackDb/layout.txt Sun Sep 25 11:25:38 2016 -0400 +++ b/templates/trackDb/layout.txt Fri Sep 30 15:14:24 2016 -0400 |
b |
@@ -9,5 +9,6 @@ thickDrawItem ${trackDb.thickDrawItem} priority ${trackDb.priority} color ${trackDb.track_color} + group ${trackDb.group_name.lower().replace(' ', '_')} % endfor |
b |
diff -r 3233451a3bd6 -r c02720d1afee tool_dependencies.xml --- a/tool_dependencies.xml Sun Sep 25 11:25:38 2016 -0400 +++ b/tool_dependencies.xml Fri Sep 30 15:14:24 2016 -0400 |
b |
@@ -105,4 +105,27 @@ </install> <readme>The tools downloaded by this dependency definition are free for academic use.</readme> </package> + + <!-- Package pslToBigPsl --> + <package name="pslToBigPsl" version="0.0.1"> + <install version="1.0"> + <actions> + <action target_directory="bin" type="download_binary"> + <url_template os="darwin"> + http://hgdownload.cse.ucsc.edu/admin/exe/macOSX.${architecture}/pslToBigPsl + </url_template> + <url_template os="linux"> + http://hgdownload.cse.ucsc.edu/admin/exe/linux.${architecture}/pslToBigPsl + </url_template> + </action> + <action type="chmod"> + <file mode="750">$INSTALL_DIR/bin/pslToBigPsl</file> + </action> + <action type="set_environment"> + <environment_variable action="prepend_to" name="PATH">$INSTALL_DIR/bin</environment_variable> + </action> + </actions> + </install> + <readme>The tools downloaded by this dependency definition are free for academic use.</readme> + </package> </tool_dependency> |