Example #1
0
 def isValidTrack(genome, trackName, fullAccess=False):
     if not TrackInfo(genome, trackName).isValid(fullAccess):
         return False
     
     for fn in ProcTrackOptions._getDirContents(genome, trackName):
         if GenomeInfo.isValidChr(genome, fn) or isBoundingRegionFileName(fn):
             return True
     return False
    def _checkValidStart(self, chr, start):
        if start < 0:
            raise InvalidFormatError('Error: start position is negative: %s' % start)

        if self.genome and \
            GenomeInfo.isValidChr(self.genome, chr) and \
                start > GenomeInfo.getChrLen(self.genome, chr):
                    raise InvalidFormatError('Error: start position is larger than the size of chromosome "%s" (%s > %s)' % \
                                             (chr, start, GenomeInfo.getChrLen(self.genome, chr)))
        return start
Example #3
0
    def getSubtypes(genome, trackName, fullAccess=False):
        dirPath = createDirPath(trackName, genome)
        subtypes = [fn for fn in ProcTrackOptions._getDirContents(genome, trackName) \
                    if not (fn[0] in ['.','_'] or os.path.isfile(dirPath + os.sep + fn) \
                    or GenomeInfo.isValidChr(genome, fn))]

        #fixme, just temporarily:, these dirs should start with _
        subtypes= [x for x in subtypes if not x in ['external','ucsc'] ]
        
        #if not fullAccess and not ProcTrackOptions._isLiteratureTrack(genome, trackName):
        #    subtypes = [x for x in subtypes if not TrackInfo(genome, trackName+[x]).private]

        return sorted(subtypes, key=str.lower)
    def _checkValidEnd(self, chr, end, start=None):
        if end < 0:
            raise InvalidFormatError('Error: end position is negative: %s' % end)

        if self.genome and \
            GenomeInfo.isValidChr(self.genome, chr) and \
                end-1 > GenomeInfo.getChrLen(self.genome, chr):
                    raise InvalidFormatError('Error: end position is larger than the size of chromosome "%s" (%s > %s)' % \
                                             (chr, end-1, GenomeInfo.getChrLen(self.genome, chr)))
        if start is not None and end <= start:
            if not start == end == 1:
                raise InvalidFormatError('Error: end position (end-exclusive) is smaller than or equal to start position: %d <= %d' % (end, start))

        return end
 def _checkValidChr(self, chr):
     if self.genome and not GenomeInfo.isValidChr(self.genome, chr):
         raise InvalidFormatWarning('Chromosome incorrectly specified: ' + chr)
     return chr