# HG changeset patch # User yating-l # Date 1492023933 14400 # Node ID 884ee2a7168028198d8e96e5ddf054ce285f983c # Parent 40469b265ddb04c1e17fbca5a4a85e6591620453 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 6ac76e7da539ca1773fb809054679f0bf8a06972-dirty diff -r 40469b265ddb -r 884ee2a71680 Bam.py --- a/Bam.py Fri Jan 20 17:12:03 2017 -0500 +++ b/Bam.py Wed Apr 12 15:05:33 2017 -0400 @@ -12,7 +12,7 @@ from Datatype import Datatype from Track import Track from TrackDb import TrackDb -from util import subtools + class Bam( Datatype ): diff -r 40469b265ddb -r 884ee2a71680 Bam.pyc Binary file Bam.pyc has changed diff -r 40469b265ddb -r 884ee2a71680 Bed.pyc Binary file Bed.pyc has changed diff -r 40469b265ddb -r 884ee2a71680 BedBlastAlignments.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BedBlastAlignments.py Wed Apr 12 15:05:33 2017 -0400 @@ -0,0 +1,73 @@ +#!/usr/bin/python + +import os +import tempfile +import string + +from Datatype import Datatype +from Track import Track +from TrackDb import TrackDb +from util import subtools + + +class BedBlastAlignments( Datatype ): + def __init__(self, input_bed_blast_alignments_false_path, data_bed_blast_alignments): + + super(BedBlastAlignments, self).__init__() + + self.input_bed_blast_alignments_false_path = input_bed_blast_alignments_false_path + self.name_bed_blast_alignments = data_bed_blast_alignments["name"] + self.priority = data_bed_blast_alignments["order_index"] + self.track_color = data_bed_blast_alignments["track_color"] + # TODO: Think about how to avoid repetition of the group_name everywhere + self.group_name = data_bed_blast_alignments["group_name"] + + #sortedBedFile = tempfile.NamedTemporaryFile(suffix=".sortedBed") + + # Sort processing + #subtools.sort(self.input_bigpsl_false_path, sortedBedFile.name) + + # bedToBigBed processing + # TODO: Change the name of the bb, to tool + genome + .bb + trackName = "".join( ( self.name_bed_blast_alignments, '.bb' ) ) + + myBigBedFilePath = os.path.join(self.myTrackFolderPath, trackName) + + auto_sql_option = os.path.join(self.tool_directory, 'bigPsl.as') + + with open(myBigBedFilePath, 'w') as bigBedFile: + subtools.bedToBigBed(self.input_bed_blast_alignments_false_path, + self.chromSizesFile.name, + bigBedFile.name, + typeOption='bed12+12', + tab='True', + autoSql=auto_sql_option) + + self.createTrack(file_path=trackName, + track_name=trackName, + long_label=self.name_bed_blast_alignments, track_type='bigBed 12 +', visibility='dense', + priority=self.priority, + track_file=myBigBedFilePath, + track_color=self.track_color, + group_name=self.group_name) + + + # dataURL = "tracks/%s" % trackName + # + # trackDb = TrackDb( + # trackName=trackName, + # longLabel=self.name_bed_simple_repeats, + # shortLabel=self.getShortName( self.name_bed_simple_repeats ), + # trackDataURL=dataURL, + # trackType='bigBed 4 +', + # visibility='dense', + # priority=self.priority, + # ) + # + # self.track = Track( + # trackFile=myBigBedFilePath, + # trackDb=trackDb, + # ) + + print("- Bed Blast alignments %s created" % self.name_bed_blast_alignments) + #print("- %s created in %s" % (trackName, myBigBedFilePath)) diff -r 40469b265ddb -r 884ee2a71680 BedBlastAlignments.pyc Binary file BedBlastAlignments.pyc has changed diff -r 40469b265ddb -r 884ee2a71680 BedSimpleRepeats.pyc Binary file BedSimpleRepeats.pyc has changed diff -r 40469b265ddb -r 884ee2a71680 BedSpliceJunctions.pyc Binary file BedSpliceJunctions.pyc has changed diff -r 40469b265ddb -r 884ee2a71680 BigWig.pyc Binary file BigWig.pyc has changed diff -r 40469b265ddb -r 884ee2a71680 Datatype.py --- a/Datatype.py Fri Jan 20 17:12:03 2017 -0500 +++ b/Datatype.py Wed Apr 12 15:05:33 2017 -0400 @@ -95,8 +95,11 @@ rgb_array = [int(hexa_without_sharp[i:i+2], 16) for i in (0, 2, 4)] rgb_ucsc = ','.join(map(str, rgb_array)) + #sanitize the track_name + sanitized_name = subtools.fixName(track_name) + track_db = TrackDb( - trackName=track_name, + trackName=sanitized_name, longLabel=long_label, shortLabel=short_label, trackDataURL=data_url, diff -r 40469b265ddb -r 884ee2a71680 Datatype.pyc Binary file Datatype.pyc has changed diff -r 40469b265ddb -r 884ee2a71680 bigPsl.py --- a/bigPsl.py Fri Jan 20 17:12:03 2017 -0500 +++ b/bigPsl.py Wed Apr 12 15:05:33 2017 -0400 @@ -2,6 +2,7 @@ import os import tempfile +import string from Datatype import Datatype from Track import Track @@ -29,6 +30,7 @@ # bedToBigBed processing # TODO: Change the name of the bb, to tool + genome + .bb trackName = "".join( ( self.name_bigpsl, '.bb' ) ) + myBigBedFilePath = os.path.join(self.myTrackFolderPath, trackName) auto_sql_option = os.path.join(self.tool_directory, 'bigPsl.as') @@ -41,15 +43,15 @@ tab='True', autoSql=auto_sql_option) - # Create the Track Object self.createTrack(file_path=trackName, track_name=trackName, - long_label=self.name_bigpsl, track_type='bigBed 12 +', visibility='dense', + long_label=self.name_bigpsl, track_type='bigPsl', visibility='dense', priority=self.priority, track_file=myBigBedFilePath, track_color=self.track_color, group_name=self.group_name) + # dataURL = "tracks/%s" % trackName # # trackDb = TrackDb( diff -r 40469b265ddb -r 884ee2a71680 bigPsl.pyc Binary file bigPsl.pyc has changed diff -r 40469b265ddb -r 884ee2a71680 hubArchiveCreator.py --- a/hubArchiveCreator.py Fri Jan 20 17:12:03 2017 -0500 +++ b/hubArchiveCreator.py Wed Apr 12 15:05:33 2017 -0400 @@ -28,6 +28,7 @@ from Psl import Psl from TrackHub import TrackHub from bigPsl import bigPsl +from BedBlastAlignments import BedBlastAlignments # TODO: Verify each subprocessed dependency is accessible [gff3ToGenePred, genePredToBed, twoBitInfo, faToTwoBit, bedToBigBed, sort @@ -54,8 +55,11 @@ # Generic Bed (Blastx transformed to bed) parser.add_argument('--bed', action='append', help='Bed generic format') - # Bed12+12 (tblastn) - parser.add_argument('--bigpsl', action='append', help='bigPsl format') + # BigPsl (blat alignment) + parser.add_argument('--bigpsl', action='append', help='bigPsl format, using bigPsl.as') + + # Bed12+12 (tblastn alignment) + parser.add_argument('--bedBlastAlignments', action='append', help='Bed12+12 format, using bigPsl.as') # BigWig Management parser.add_argument('--bigwig', action='append', help='BigWig format') @@ -127,6 +131,7 @@ array_inputs_gtf = args.gtf array_inputs_psl = args.psl array_inputs_bigpsl = args.bigpsl + array_inputs_bed_blast_alignments = args.bedBlastAlignments outputFile = args.output @@ -153,7 +158,8 @@ (array_inputs_gff3, Gff3), (array_inputs_gtf, Gtf), (array_inputs_psl, Psl), - (array_inputs_bigpsl, bigPsl)]: + (array_inputs_bigpsl, bigPsl), + (array_inputs_bed_blast_alignments, BedBlastAlignments)]: if inputs: all_datatype_dictionary.update(create_ordered_datatype_objects(datatype_class, inputs, inputs_data)) diff -r 40469b265ddb -r 884ee2a71680 hubArchiveCreator.xml --- a/hubArchiveCreator.xml Fri Jan 20 17:12:03 2017 -0500 +++ b/hubArchiveCreator.xml Wed Apr 12 15:05:33 2017 -0400 @@ -1,4 +1,4 @@ - + This Galaxy tool permits to prepare your files to be ready for Assembly Hub visualization. @@ -99,10 +99,10 @@ #silent $prepare_json($f.formatChoice.bedChoice.BED_splice_junctions, $index_track_final, extra_data_dict) #end if - #if $f.formatChoice.bedChoice.bed_select == "bigpsl_option" - --bigpsl $f.formatChoice.bedChoice.bigPsl - #silent $prepare_json($f.formatChoice.bedChoice.bigPsl, $index_track_final, - extra_data_dict) + #if $f.formatChoice.bedChoice.bed_select == "bed_blast_alignment_option" + --bedBlastAlignments $f.formatChoice.bedChoice.BED_blast_alignment + #silent $prepare_json($f.formatChoice.bedChoice.BED_blast_alignment, $index_track_final, + extra_data_dict) #end if #end if #if $f.formatChoice.format_select == "psl" @@ -126,6 +126,11 @@ #silent $prepare_json($f.formatChoice.GTF, $index_track_final, extra_data_dict) #end if + #if $f.formatChoice.format_select == "bigpsl" + --bigpsl $f.formatChoice.BIGPSL + #silent $prepare_json($f.formatChoice.BIGPSL, $index_track_final, + extra_data_dict) + #end if #end for #end for @@ -176,6 +181,7 @@ + @@ -193,14 +199,14 @@ - + - + - + @@ -304,6 +310,21 @@ + + + + + + + + + + diff -r 40469b265ddb -r 884ee2a71680 util/subtools.py --- a/util/subtools.py Fri Jan 20 17:12:03 2017 -0500 +++ b/util/subtools.py Wed Apr 12 15:05:33 2017 -0400 @@ -10,6 +10,7 @@ import os import subprocess import sys +import string class PopenError(Exception): def __init__(self, cmd, error, return_code): @@ -243,3 +244,13 @@ p = _handleExceptionAndCheckCall(array_call) return p + +#santitize trackName. Because track name must begin with a letter and +# contain only the following chars: [a-zA-Z0-9_]. +# See the "track" Common settings at: +#https://genome.ucsc.edu/goldenpath/help/trackDb/trackDbHub.html#bigPsl_-_Pairwise_Alignments +def fixName(filename): + valid_chars = "_%s%s" % (string.ascii_letters, string.digits) + sanitize_name = ''.join([c if c in valid_chars else '_' for c in filename]) + sanitize_name = "gonramp_" + sanitize_name + return sanitize_name diff -r 40469b265ddb -r 884ee2a71680 util/subtools.pyc Binary file util/subtools.pyc has changed