Example #1
0
    def __init__(self,
                 genome,
                 twobit_file=None,
                 remote_fn=None,
                 groups=None,
                 trackdb=None,
                 genome_file_obj=None,
                 html_string=None,
                 **kwargs):
        """
        Represents a genome stanza within a "genomes.txt" file for a non-UCSC genome.

        The file itself is represented by a :class:`GenomesFile` object.
        """
        HubComponent.__init__(self)
        Genome.__init__(self, genome, trackdb=trackdb, genome_file_obj=genome_file_obj)
        self.local_fn = twobit_file
        self.remote_fn = remote_fn
        self.html_string = html_string

        if groups is not None:
            self.add_groups(groups)
        else:
            self.groups = None

        self._orig_kwargs = kwargs
        self.add_params(**kwargs)
Example #2
0
    def __init__(self,
                 genome,
                 twobit_file=None,
                 remote_fn=None,
                 groups=None,
                 trackdb=None,
                 genome_file_obj=None,
                 html_string=None,
                 **kwargs):
        """
        Represents a genome stanza within a "genomes.txt" file for a non-UCSC genome.

        The file itself is represented by a :class:`GenomesFile` object.
        """
        HubComponent.__init__(self)
        Genome.__init__(self,
                        genome,
                        trackdb=trackdb,
                        genome_file_obj=genome_file_obj)
        self.local_fn = twobit_file
        self.remote_fn = remote_fn
        self.html_string = html_string

        if groups is not None:
            self.add_groups(groups)
        else:
            self.groups = None

        self._orig_kwargs = kwargs
        self.add_params(**kwargs)
Example #3
0
    def __init__(self, name, tracktype=None, short_label=None,
                 long_label=None, subgroups=None, local_fn=None,
                 remote_fn=None, html_string=None, **kwargs):
        """
        Represents a single track stanza.

        :param name: String; name of the track

        :param tracktype: String; type of the track (e.g., "bam")

        :param url: String; full URL for the track (i.e., bigDataUrl)

        :param short_label: String; used for the left-hand side track label

        :param long_label:
            String; used for the longer middle labels; if None will copy
            short_label

        :param subgroups:

            A dictionary of `{name: tag}` where each `name` is the name of
            a SubGroupDefinition in a parent :class:`CompositeTrack` and each
            `tag` is a key in the SubGroupDefinition.mapping dictionary.  They
            end up looking like this in the string representation::

                subGroups view=aln celltype=ES

        :param local_fn:
            String; Local path to the file (used for uploading)

        :param remote_fn:
            String; path to upload the file to, over rsync and ssh.
        """
        HubComponent.__init__(self)
        _check_name(name)
        self.name = name
        self.tracktype = tracktype
        if short_label is None:
            short_label = name
        self.short_label = short_label
        if long_label is None:
            long_label = short_label
        self.long_label = long_label

        self._local_fn = local_fn
        self._remote_fn = remote_fn
        self.html_string = html_string
        self.subgroups = {}
        self.add_subgroups(subgroups)

        # Convert pythonic strings to UCSC versions
        kwargs['track'] = name
        kwargs['type'] = tracktype
        kwargs['longLabel'] = kwargs.get('longLabel', long_label)
        kwargs['shortLabel'] = kwargs.get('shortLabel', short_label)

        self.kwargs = kwargs

        self._orig_kwargs = kwargs.copy()
Example #4
0
    def __init__(self, genome, trackdb=None, genome_file_obj=None):
        """
        Represents a 2-line genome stanza within a "genomes.txt" file.

        The file itself is represented by a :class:`GenomesFile` object.
        """
        HubComponent.__init__(self)
        self.genome = genome
        self.trackdb = None
        if trackdb is not None:
            self.add_trackdb(trackdb)
        if genome_file_obj:
            self.add_parent(genome_file_obj)
Example #5
0
    def __init__(self, genome, trackdb=None, genome_file_obj=None):
        """
        Represents a 2-line genome stanza within a "genomes.txt" file.

        The file itself is represented by a :class:`GenomesFile` object.
        """
        HubComponent.__init__(self)
        self.genome = genome
        self.trackdb = None
        if trackdb is not None:
            self.add_trackdb(trackdb)
        if genome_file_obj:
            self.add_parent(genome_file_obj)
Example #6
0
    def __init__(self, trackdbs=None):
        """
        Represents the file containing one or more include trackDb.* lines
        """
        HubComponent.__init__(self)
        if trackdbs is None:
            trackdbs = []

        self._trackdbs = []
        for trackdb in trackdbs:
            self.add_trackdbs(trackdb)

        self._local_fn = None
        self._remote_fn = None
Example #7
0
    def __init__(self, tracks=None):
        """
        Represents the file containing one or more Track objects (which each
        represent a stanza).
        """
        HubComponent.__init__(self)
        if tracks is None:
            tracks = []

        self._tracks = []
        for track in tracks:
            self.add_track(track)

        self._local_fn = None
        self._remote_fn = None
Example #8
0
    def __init__(self, tracks=None):
        """
        Represents the file containing one or more Track objects (which each
        represent a stanza).
        """
        HubComponent.__init__(self)
        if tracks is None:
            tracks = []

        self._tracks = []
        for track in tracks:
            self.add_track(track)

        self._local_fn = None
        self._remote_fn = None
Example #9
0
    def __init__(self, genome=None):
        """
        Represents the genomes file on disk.  Can contain multiple
        :class:`Genome` objects, each of which represent a stanza in this
        file.

        The file ultimately created (with the self.render() method) will be
        determined by the parent Hub's `genome_filename` attribute.  By
        default, this is the hub name, plus ".genomes.txt"
        """
        HubComponent.__init__(self)
        self._local_fn = None
        self._remote_fn = None
        self.genomes = []
        if genome is None:
            genome = []
        for genome in genome:
            self.add_genome(genome)
Example #10
0
    def __init__(self, genome=None):
        """
        Represents the genomes file on disk.  Can contain multiple
        :class:`Genome` objects, each of which represent a stanza in this
        file.

        The file ultimately created (with the self.render() method) will be
        determined by the parent Hub's `genome_filename` attribute.  By
        default, this is the hub name, plus ".genomes.txt"
        """
        HubComponent.__init__(self)
        self._local_fn = None
        self._remote_fn = None
        self.genomes = []
        if genome is None:
            genome = []
        for genome in genome:
            self.add_genome(genome)
Example #11
0
    def __init__(self, hub, short_label="", long_label=None,
                 genomes_file=None, genomes_filename=None, email="",
                 url=None):
        """
        Represents a top-level track hub container.
        """
        HubComponent.__init__(self)
        self.url = url
        self._local_fn = None
        self._remote_fn = None
        self._local_dir = None
        self._remote_dir = None
        self.hub = hub
        self.short_label = short_label
        if not long_label:
            long_label = short_label
        self.long_label = long_label
        self.email = email

        self.genomes_file = None
        if genomes_file is not None:
            self.add_genomes_file(genomes_file)
Example #12
0
 def __init__(self, groups):
     HubComponent.__init__(self)
     self._local_fn = None
     self._remote_fn = None
     self.groups = []
     self.add_groups(groups)
Example #13
0
    def __init__(self,
                 name,
                 tracktype=None,
                 short_label=None,
                 long_label=None,
                 subgroups=None,
                 local_fn=None,
                 remote_fn=None,
                 html_string=None,
                 **kwargs):
        """
        Represents a single track stanza.

        :param name: String; name of the track

        :param tracktype: String; type of the track (e.g., "bam")

        :param url: String; full URL for the track (i.e., bigDataUrl)

        :param short_label: String; used for the left-hand side track label

        :param long_label:
            String; used for the longer middle labels; if None will copy
            short_label

        :param subgroups:

            A dictionary of `{name: tag}` where each `name` is the name of
            a SubGroupDefinition in a parent :class:`CompositeTrack` and each
            `tag` is a key in the SubGroupDefinition.mapping dictionary.  They
            end up looking like this in the string representation::

                subGroups view=aln celltype=ES

        :param local_fn:
            String; Local path to the file (used for uploading)

        :param remote_fn:
            String; path to upload the file to, over rsync and ssh.
        """
        HubComponent.__init__(self)
        _check_name(name)
        self.name = name
        self.tracktype = tracktype
        if short_label is None:
            short_label = name
        self.short_label = short_label
        if long_label is None:
            long_label = short_label
        self.long_label = long_label

        self._local_fn = local_fn
        self._remote_fn = remote_fn
        self.html_string = html_string
        self.subgroups = {}
        self.add_subgroups(subgroups)

        # Convert pythonic strings to UCSC versions
        kwargs['track'] = name
        kwargs['type'] = tracktype
        kwargs['longLabel'] = kwargs.get('longLabel', long_label)
        kwargs['shortLabel'] = kwargs.get('shortLabel', short_label)

        self.kwargs = kwargs

        self._orig_kwargs = kwargs.copy()
Example #14
0
 def __init__(self, groups):
     HubComponent.__init__(self)
     self._local_fn = None
     self._remote_fn = None
     self.groups = []
     self.add_groups(groups)