Ejemplo n.º 1
0
 def __init__(self, eval_space, unit_data):
     WS_Unit.__init__(self, eval_space, unit_data, "enum",
                      unit_data["sub-kind"])
     variants_info = unit_data.get("variants")
     self.mVariantSet = VariantSet([info[0] for info in variants_info])
     self._setScreened(sum(info[1] for info in variants_info) == 0)
     self.mArray = array('L')
     self.mPackSetDict = dict()
     self.mPackSetSeq = [set()]
Ejemplo n.º 2
0
 def __init__(self, eval_space, unit_data):
     WS_Unit.__init__(self, eval_space, unit_data, "enum",
                      "transcript-status")
     variants_info = self.getDescr().get("variants")
     self.mVariantSet = VariantSet([info[0] for info in variants_info])
     self.mDefaultValue = self.mVariantSet.indexOf(
         self.getDescr()["default"])
     assert self.mDefaultValue is not None
     self._setScreened(sum(info[1] for info in variants_info) == 0)
     self.mArray = array('L')
Ejemplo n.º 3
0
 def __init__(self, eval_space, unit_data):
     WS_Unit.__init__(self, eval_space, unit_data, "enum",
                      "transcript-status")
     variants_info = unit_data.get("variants")
     self.mVariantSet = VariantSet([info[0] for info in variants_info])
     self.mDefaultValue = self.mVariantSet.indexOf(unit_data["default"])
     assert self.mDefaultValue is not None, ("No default falue for " +
                                             self.getName())
     self._setScreened(sum(info[1] for info in variants_info) == 0)
     self.mArray = array('L')
     self.mIdMode = unit_data.get("tr-id-mode")
Ejemplo n.º 4
0
class WS_TranscriptStatusUnit(WS_Unit, EnumUnitSupport):
    def __init__(self, eval_space, unit_data):
        WS_Unit.__init__(self, eval_space, unit_data, "enum",
                         "transcript-status")
        variants_info = unit_data.get("variants")
        self.mVariantSet = VariantSet([info[0] for info in variants_info])
        self.mDefaultValue = self.mVariantSet.indexOf(unit_data["default"])
        assert self.mDefaultValue is not None, ("No default falue for " +
                                                self.getName())
        self._setScreened(sum(info[1] for info in variants_info) == 0)
        self.mArray = array('L')
        self.mIdMode = unit_data.get("tr-id-mode")

    def isDetailed(self):
        return True

    def isTranscriptID(self):
        return self.mIdMode

    def getVariantSet(self):
        return self.mVariantSet

    def getItemVal(self, item_idx):
        return {self.mArray[item_idx]}

    def getItValIdx(self, item_idx):
        return self.mArray[item_idx]

    def fillRecord(self, inp_data, rec_no):
        values = inp_data.get(self.getInternalName())
        if not values:
            self.mArray.append(self.mDefaultValue)
        else:
            self.mArray.extend(
                [self.mVariantSet.indexOf(value) for value in values])

    def makeStat(self, condition, eval_h):
        ret_handle = self.prepareStat()
        enum_stat = EnumStat(self.mVariantSet, detailed=True)
        for group_no, it_idx in condition.iterItemIdx():
            enum_stat.regValues(
                [self.mArray[it_idx]],
                group_no=group_no,
                transcript_id=self.getEvalSpace().mapTranscriptID(it_idx))
        enum_stat.reportResult(ret_handle)
        ret_handle["detailed"] = True
        return ret_handle
Ejemplo n.º 5
0
 def __init__(self, eval_space, unit_data, sub_kind=None):
     WS_Unit.__init__(self, eval_space, unit_data, "enum", sub_kind)
     variants_info = unit_data.get("variants")
     if variants_info is None:
         self._setScreened()
         self.mVariantSet = None
     else:
         self.mVariantSet = VariantSet([info[0] for info in variants_info])
         self._setScreened(sum(info[1] for info in variants_info) == 0)
Ejemplo n.º 6
0
class WS_TranscriptMultisetUnit(WS_Unit, EnumUnitSupport):
    def __init__(self, eval_space, unit_data):
        WS_Unit.__init__(self, eval_space, unit_data, "enum",
                         unit_data["sub-kind"])
        variants_info = unit_data.get("variants")
        self.mVariantSet = VariantSet([info[0] for info in variants_info])
        self._setScreened(sum(info[1] for info in variants_info) == 0)
        self.mArray = array('L')
        self.mPackSetDict = dict()
        self.mPackSetSeq = [set()]

    def isDetailed(self):
        return True

    def getVariantSet(self):
        return self.mVariantSet

    def getItemVal(self, item_idx):
        return self.mPackSetSeq[self.mArray[item_idx]]

    def _fillOne(self, values):
        if values:
            idx_set = self.mVariantSet.makeIdxSet(values)
            key = WS_MultiCompactUnit.makePackKey(idx_set)
            idx = self.mPackSetDict.get(key)
            if idx is None:
                idx = len(self.mPackSetSeq)
                self.mPackSetDict[key] = idx
                self.mPackSetSeq.append(set(idx_set))
        else:
            idx = 0
        self.mArray.append(idx)

    def fillRecord(self, inp_data, rec_no):
        seq = inp_data.get(self.getInternalName())
        if not seq:
            self.mArray.append(0)
        else:
            for values in seq:
                self._fillOne(values)

    def makeStat(self, condition, eval_h):
        ret_handle = self.prepareStat()
        enum_stat = EnumStat(self.mVariantSet, detailed=True)
        for group_no, it_idx in condition.iterItemIdx():
            enum_stat.regValues(
                self.mPackSetSeq[self.mArray[it_idx]],
                group_no=group_no,
                transcript_id=self.getEvalSpace().mapTranscriptID(it_idx))
        enum_stat.reportResult(ret_handle)
        ret_handle["detailed"] = True
        return ret_handle
Ejemplo n.º 7
0
 def __init__(self, eval_space, descr):
     XL_Unit.__init__(self, eval_space, descr, "enum")
     self.mVariants = [info[0] for info in descr["variants"]]
     self.mAccumCount = sum(info[1] for info in descr["variants"])
     self.mVariantSet = VariantSet(self.mVariants)
Ejemplo n.º 8
0
 def getVariantSet(self):
     return VariantSet([dtree_h.getDTreeName()
         for dtree_h in self.mDS.iterSolEntries("dtree")])