# HG changeset patch
# User yating-l
# Date 1495041417 14400
# Node ID ba9997c847dcdeebde3857d7673aca273b4536c5
# Parent 4a58094b051e20b1cf2a55d9cc234dbaaea89726
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b2894a39921adaa6a93b12523820b61a78e11f20-dirty
diff -r 4a58094b051e -r ba9997c847dc BigBed.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/BigBed.py Wed May 17 13:16:57 2017 -0400
@@ -0,0 +1,79 @@
+#!/usr/bin/python
+
+import os
+import shutil
+from subprocess import Popen, PIPE
+import re
+
+# Internal dependencies
+from Datatype import Datatype
+
+class BigBed(Datatype):
+ """ Configurations for creating the bigBed evidence track """
+
+ def __init__(self, input_bigbed_path, data_bigbed):
+ super(BigBed, self).__init__()
+
+ self.track = None
+
+ self.input_bigbed_path = input_bigbed_path
+ self.name_bigbed = data_bigbed["name"]
+ self.priority = data_bigbed["order_index"]
+ self.track_color = data_bigbed["track_color"]
+ self.group_name = data_bigbed["group_name"]
+
+ track_name = "".join((self.name_bigbed, ".bigbed"))
+ if data_bigbed["long_label"]:
+ self.long_label = data_bigbed["long_label"]
+ else:
+ self.long_label = self.name_bigbed
+
+ bigbed_file_path = os.path.join(self.myTrackFolderPath, track_name)
+
+ track_type = self.determine_track_type(input_bigbed_path)
+
+ shutil.copy(self.input_bigbed_path, bigbed_file_path)
+
+ # Create the Track Object
+ self.createTrack(file_path=track_name,
+ track_name=track_name,
+ long_label=self.long_label,
+ track_type=track_type,
+ visibility='hide',
+ priority=self.priority,
+ track_file=bigbed_file_path,
+ track_color=self.track_color,
+ group_name=self.group_name)
+
+ print "- BigBed %s created" % self.name_bigbed
+
+
+ def determine_track_type(self, bb_file):
+ """
+ Determine the number of standard and extra fields using bigBedSummary
+
+ Implementation of reading from stdout is based on a Stackoverflow post:
+ http://stackoverflow.com/questions/2715847/python-read-streaming-input-from-subprocess-communicate
+
+ :param bb_file: path to a bigBed file
+
+ :returns: the bigBed track type
+ """
+
+ cmd_ph = Popen(["bigBedSummary", "-fields", bb_file, "stdout"],
+ stdout=PIPE, bufsize=1)
+
+ pattern = r"(\d+) bed definition fields, (\d+) total fields"
+
+ with cmd_ph.stdout:
+ for line in iter(cmd_ph.stdout.readline, b''):
+ match = re.match(pattern, line)
+
+ if match:
+ extra_mark = "." if match.group(1) == match.group(2) else "+"
+ bed_type = "bigBed %s %s" % (match.group(1), extra_mark)
+ break
+
+ cmd_ph.wait()
+
+ return bed_type
diff -r 4a58094b051e -r ba9997c847dc cytoBand.py
--- a/cytoBand.py Tue May 16 18:09:00 2017 -0400
+++ b/cytoBand.py Wed May 17 13:16:57 2017 -0400
@@ -48,6 +48,7 @@
track_name='cytoBandIdeo',
long_label=self.long_label,
track_type='bigBed',
+ visibility='dense',
priority=self.priority,
track_file=myBigBedFilePath,
track_color=self.track_color,
diff -r 4a58094b051e -r ba9997c847dc hubArchiveCreator.py
--- a/hubArchiveCreator.py Tue May 16 18:09:00 2017 -0400
+++ b/hubArchiveCreator.py Wed May 17 13:16:57 2017 -0400
@@ -30,6 +30,7 @@
from TrackHub import TrackHub
from bigPsl import bigPsl
from BedBlastAlignments import BedBlastAlignments
+from BigBed import BigBed
# TODO: Verify each subprocessed dependency is accessible [gff3ToGenePred, genePredToBed, twoBitInfo, faToTwoBit, bedToBigBed, sort
@@ -74,6 +75,9 @@
# Psl Management
parser.add_argument('--psl', action='append', help='Psl format')
+ # BigBed Management
+ parser.add_argument('--bigbed', action='append', help='BigBed format')
+
# TODO: Check if the running directory can have issues if we run the tool outside
parser.add_argument('-d', '--directory',
help='Running tool directory, where to find the templates. Default is running directory')
@@ -137,6 +141,7 @@
array_inputs_psl = args.psl
array_inputs_bigpsl = args.bigpsl
array_inputs_bed_blast_alignments = args.bedBlastAlignments
+ array_inputs_bigbed = args.bigbed
outputFile = args.output
@@ -165,7 +170,8 @@
(array_inputs_gtf, Gtf),
(array_inputs_psl, Psl),
(array_inputs_bigpsl, bigPsl),
- (array_inputs_bed_blast_alignments, BedBlastAlignments)]:
+ (array_inputs_bed_blast_alignments, BedBlastAlignments),
+ (array_inputs_bigbed, BigBed)]:
if inputs:
all_datatype_dictionary.update(create_ordered_datatype_objects(datatype_class, inputs, inputs_data))
diff -r 4a58094b051e -r ba9997c847dc hubArchiveCreator.xml
--- a/hubArchiveCreator.xml Tue May 16 18:09:00 2017 -0400
+++ b/hubArchiveCreator.xml Wed May 17 13:16:57 2017 -0400
@@ -5,9 +5,10 @@
- ucsc_tools_340
+ ucsc_hac
samtools
ucsc_bigwig
+ ucsc_bigbed
@@ -127,6 +128,11 @@
#silent $prepare_json($f.formatChoice.BIGWIG, $index_track_final,
extra_data_dict)
#end if
+ #if $f.formatChoice.format_select == "bigbed"
+ --bigbed $f.formatChoice.BIGBED
+ #silent $prepare_json($f.formatChoice.BIGBED, $index_track_final,
+ extra_data_dict)
+ #end if
#if $f.formatChoice.format_select == "gff3"
--gff3 $f.formatChoice.GFF3
#silent $prepare_json($f.formatChoice.GFF3, $index_track_final,
@@ -186,6 +192,7 @@
+
@@ -308,6 +315,22 @@
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
- http://old-gep.wustl.edu/~wilson/packages/ucsc_bigwig/ucsc_bigwig_340_macOS_x86_64.tar.gz
-
-
- bin
- $INSTALL_DIR/bin
-
-
-
-
-
- http://old-gep.wustl.edu/~wilson/packages/ucsc_bigwig/ucsc_bigwig_340_linux_x86_64.tar.gz
-
-
- bin
- $INSTALL_DIR/bin
-
-
+
+
+
-
-
-
- echo "ERROR: This package only supports 64-bit systems running macOS or Linux"
-
- false
-
-
-
-
- $INSTALL_DIR/bin
-
-
-
-
-
- This package contains the utilities for constructing
- `bigWig files <https://genome.ucsc.edu/goldenpath/help/bigWig.html>`_.
- The utilities were created by the
- `Genome Bioinformatics Group <https://genome.ucsc.edu/staff.html>`_
- at the UCSC Genomics Institute.
-
- The bigWig file format is designed to store dense continuous datasets
- and it is compatible with many genome browsers (e.g., UCSC Genome Browser,
- JBrowse, IGV).
-
-
-
diff -r 4a58094b051e -r ba9997c847dc util/subtools.py
--- a/util/subtools.py Tue May 16 18:09:00 2017 -0400
+++ b/util/subtools.py Wed May 17 13:16:57 2017 -0400
@@ -250,6 +250,8 @@
# See the "track" Common settings at:
#https://genome.ucsc.edu/goldenpath/help/trackDb/trackDbHub.html#bigPsl_-_Pairwise_Alignments
def fixName(filename):
+ if filename == 'cytoBandIdeo':
+ return 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