Previous changeset 20:40469b265ddb (2017-01-20) Next changeset 22:7ddf651457df (2017-04-12) |
Commit message:
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 6ac76e7da539ca1773fb809054679f0bf8a06972-dirty |
modified:
Bam.py Bam.pyc Bed.pyc BedSimpleRepeats.pyc BedSpliceJunctions.pyc BigWig.pyc Datatype.py Datatype.pyc bigPsl.py hubArchiveCreator.py hubArchiveCreator.xml util/subtools.py util/subtools.pyc |
added:
BedBlastAlignments.py BedBlastAlignments.pyc bigPsl.pyc |
b |
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 |
b |
@@ -12,7 +12,7 @@ from Datatype import Datatype from Track import Track from TrackDb import TrackDb -from util import subtools + class Bam( Datatype ): |
b |
diff -r 40469b265ddb -r 884ee2a71680 Bam.pyc |
b |
Binary file Bam.pyc has changed |
b |
diff -r 40469b265ddb -r 884ee2a71680 Bed.pyc |
b |
Binary file Bed.pyc has changed |
b |
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)) |
b |
diff -r 40469b265ddb -r 884ee2a71680 BedBlastAlignments.pyc |
b |
Binary file BedBlastAlignments.pyc has changed |
b |
diff -r 40469b265ddb -r 884ee2a71680 BedSimpleRepeats.pyc |
b |
Binary file BedSimpleRepeats.pyc has changed |
b |
diff -r 40469b265ddb -r 884ee2a71680 BedSpliceJunctions.pyc |
b |
Binary file BedSpliceJunctions.pyc has changed |
b |
diff -r 40469b265ddb -r 884ee2a71680 BigWig.pyc |
b |
Binary file BigWig.pyc has changed |
b |
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, |
b |
diff -r 40469b265ddb -r 884ee2a71680 Datatype.pyc |
b |
Binary file Datatype.pyc has changed |
b |
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 |
b |
@@ -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( |
b |
diff -r 40469b265ddb -r 884ee2a71680 bigPsl.pyc |
b |
Binary file bigPsl.pyc has changed |
b |
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)) |
b |
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 |
b |
@@ -1,4 +1,4 @@ -<tool id="hubArchiveCreator" name="Hub Archive Creator" version="2.3.0"> +<tool id="hubArchiveCreator" name="Hub Archive Creator" version="2.3.1"> <description> 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 @@ <option value="bigwig">BIGWIG</option> <option value="gff3">GFF3</option> <option value="gtf">GTF</option> + <option value="bigpsl">BigPsl</option> </param> <when value="bam"> @@ -193,14 +199,14 @@ </valid> </sanitizer> </param> - </when> + </when> <when value="bed"> <conditional name="bedChoice"> <param name="bed_select" type="select" label="Bed Choice"> <option value="bed_generic" selected="true">BED Generic (bed3+)</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="bigpsl_option">bigPsl (bed12+12 / bigPsl.as)</option> + <option value="bed_blast_alignment_option">BED Blast alignments (bed12+12 / bigPsl.as)</option> </param> <when value="bed_generic"> <param @@ -227,12 +233,12 @@ label="Bed Splice Junctions (Bed12+1) File" /> </when> - <when value="bigpsl_option"> + <when value="bed_blast_alignment_option"> <param format="bed" - name="bigPsl" + name="BED_blast_alignment" type="data" - label="bigPsl (Bed12+12) File" + label="Bed Blast Alignments (Bed12+12) File" /> </when> </conditional> @@ -304,6 +310,21 @@ </sanitizer> </param> </when> + <when value="bigpsl"> + <param + format="bigpsl" + name="BIGPSL" + type="data" + label="bigPsl File" + /> + <param name="track_color" type="color" label="Track color" value="#000000"> + <sanitizer> + <valid initial="string.letters,string.digits"> + <add value="#"/> + </valid> + </sanitizer> + </param> + </when> </conditional> </repeat> </repeat> |
b |
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 |
b |
diff -r 40469b265ddb -r 884ee2a71680 util/subtools.pyc |
b |
Binary file util/subtools.pyc has changed |