Converts this rnaQuant into its GA4GH protocol equivalent.
511511
def toProtocolElement(self):
        
        protocolElement = protocol.RnaQuantificationSet()
        protocolElement.id = self.getId()
        protocolElement.dataset_id = self._parentContainer.getId()
        protocolElement.name = self._name
        self.serializeAttributes(protocolElement)
        return protocolElement
634517
def rnaseq2ga(quantificationFilename, sqlFilename, localName, rnaType,
              dataset=None, featureType="gene",
              description="", programs="", featureSetNames="",
              readGroupSetNames="", biosampleId=""):
    
    readGroupSetName = ""
    if readGroupSetNames:
        readGroupSetName = readGroupSetNames.strip().split(",")[0]
    featureSetIds = ""
    readGroupIds = ""
    if dataset:
        featureSetIdList = []
        if featureSetNames:
            for annotationName in featureSetNames.split(","):
                featureSet = dataset.getFeatureSetByName(annotationName)
                featureSetIdList.append(featureSet.getId())
            featureSetIds = ",".join(featureSetIdList)
        # TODO: multiple readGroupSets
        if readGroupSetName:
            readGroupSet = dataset.getReadGroupSetByName(readGroupSetName)
            readGroupIds = ",".join(
                [x.getId() for x in readGroupSet.getReadGroups()])
    if rnaType not in SUPPORTED_RNA_INPUT_FORMATS:
        raise exceptions.UnsupportedFormatException(rnaType)
    rnaDB = RnaSqliteStore(sqlFilename)
    if rnaType == "cufflinks":
        writer = CufflinksWriter(rnaDB, featureType, dataset=dataset)
    elif rnaType == "kallisto":
        writer = KallistoWriter(rnaDB, featureType, dataset=dataset)
    elif rnaType == "rsem":
        writer = RsemWriter(rnaDB, featureType, dataset=dataset)
    writeRnaseqTable(rnaDB, [localName], description, featureSetIds,
                     readGroupId=readGroupIds, programs=programs,
                     biosampleId=biosampleId)
    writeExpressionTable(writer, [(localName, quantificationFilename)])
1181606
def from_gtp(gtpc):
    """"""
    gtpc = gtpc.upper()
    if gtpc == 'PASS':
        return None
    col = _GTP_COLUMNS.index(gtpc[0])
    row_from_bottom = int(gtpc[1:])
    return go.N - row_from_bottom, col
211931
def to_gtp(coord):
    """"""
    if coord is None:
        return 'pass'
    y, x = coord
    return '{}{}'.format(_GTP_COLUMNS[x], go.N - y)
635046
def convertLocationHgvsC(self, hgvsc):
        
        if isUnspecified(hgvsc):
            return None
        match = re.match(".*c.(\d+)(\D+)>(\D+)", hgvsc)
        if match:
            pos = int(match.group(1))
            if pos > 0:
                allLoc = self._createGaAlleleLocation()
                allLoc.start = pos - 1
                allLoc.reference_sequence = match.group(2)
                allLoc.alternate_sequence = match.group(3)
                return allLoc
        return None
1313499
def device_gen(chain, urls):
    """"""
    itr = iter(urls)
    last = next(itr)
    for url in itr:
        yield Device(chain, make_hop_info_from_url(last), driver_name='jumphost', is_target=False)
        last = url
    yield Device(chain, make_hop_info_from_url(last), driver_name='generic', is_target=True)
815651
def _assemble_gef(self, stmt):
        """"""
        gef = deepcopy(stmt.gef)
        gef.activity = ActivityCondition('gef', True)
        ras = deepcopy(stmt.ras)
        ras.activity = ActivityCondition('gtpbound', True)
        self._add_nodes_edges(gef, ras, pc.DIRECTLY_INCREASES, stmt.evidence)
523529
private BufferedImage to24Bit3ComponentRGB(int[][] decoded, int width, int height) {
        BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR);
        byte[] imageBuffer = ((DataBufferByte) image.getRaster().getDataBuffer()).getData();

        for (int i = 0; i < imageBuffer.length / 3; i++) {
            // Convert to RGB (BGR)
            imageBuffer[i * 3 + 2] = (byte) decoded[0][i];
            imageBuffer[i * 3 + 1] = (byte) decoded[1][i];
            imageBuffer[i * 3] = (byte) decoded[2][i];
        }

        return image;
    }
1062290
def rnaQuantificationsGenerator(self, request):
        
        if len(request.rna_quantification_set_id) < 1:
            raise exceptions.BadRequestException(
                "Rna Quantification Set Id must be specified")
        else:
            compoundId = datamodel.RnaQuantificationSetCompoundId.parse(
                request.rna_quantification_set_id)
            dataset = self.getDataRepository().getDataset(
                compoundId.dataset_id)
            rnaQuantSet = dataset.getRnaQuantificationSet(
                compoundId.rna_quantification_set_id)
        results = []
        for obj in rnaQuantSet.getRnaQuantifications():
            include = True
            if request.biosample_id:
                if request.biosample_id != obj.getBiosampleId():
                    include = False
            if include:
                results.append(obj)
        return self._objectListGenerator(request, results)
487015
def decode_wireformat_uuid(rawguid):
    
    if isinstance(rawguid, list):
        rawguid = bytearray(rawguid)
    lebytes = struct.unpack_from('<IHH', buffer(rawguid[:8]))
    bebytes = struct.unpack_from('>HHI', buffer(rawguid[8:]))
    return '{0:08X}-{1:04X}-{2:04X}-{3:04X}-{4:04X}{5:08X}'.format(
        lebytes[0], lebytes[1], lebytes[2], bebytes[0], bebytes[1], bebytes[2])
502716
def convert_pmod(pmod):
    """"""

    if pmod.args[0].value in spec["bel1_migration"]["protein_modifications"]:
        pmod.args[0].value = spec["bel1_migration"]["protein_modifications"][
            pmod.args[0].value
        ]

    return pmod
923128
def convert_to_4(self):
        
        from six.moves.urllib import parse

        if not self.config.has_section('backends'):
            self.config.add_section('backends')

        site = parse.urlparse(self.get('site', default_value=''))
        backend_uri = 'zebra://{username}:{password}@{hostname}'.format(
            username=self.get('username', default_value=''),
            password=parse.quote(self.get('password', default_value=''),
                                 safe=''),
            hostname=site.hostname
        )
        self.config.set('backends', 'default', backend_uri)

        self.config.remove_option('default', 'username')
        self.config.remove_option('default', 'password')
        self.config.remove_option('default', 'site')

        if not self.config.has_section('default_aliases'):
            self.config.add_section('default_aliases')

        if not self.config.has_section('default_shared_aliases'):
            self.config.add_section('default_shared_aliases')

        if self.config.has_section('wrmap'):
            for alias, mapping in self.config.items('wrmap'):
                self.config.set('default_aliases', alias, mapping)

            self.config.remove_section('wrmap')

        if self.config.has_section('shared_wrmap'):
            for alias, mapping in self.config.items('shared_wrmap'):
                self.config.set('default_shared_aliases', alias, mapping)

            self.config.remove_section('shared_wrmap')
29915
def Convert(self, metadata, interface, token=None):
    """"""
    ip4_addresses = []
    ip6_addresses = []
    for addr in interface.addresses:
      if addr.address_type == addr.Family.INET:
        ip4_addresses.append(addr.human_readable_address)
      elif addr.address_type == addr.Family.INET6:
        ip6_addresses.append(addr.human_readable_address)
      else:
        raise ValueError("Invalid address type: %s" % addr.address_type)

    result = ExportedNetworkInterface(
        metadata=metadata,
        ifname=interface.ifname,
        ip4_addresses=" ".join(ip4_addresses),
        ip6_addresses=" ".join(ip6_addresses))

    if interface.mac_address:
      result.mac_address = interface.mac_address.human_readable_address

    yield result
561680
def _gt_from_ge(self, other):
    """"""
    op_result = self.__ge__(other)
    if op_result is NotImplemented:
        return NotImplemented
    return op_result and self != other
154785
def genKw(w,msk,z):
    
    # Hash inputs into a string of bytes
    b = hmac(msk, z + w, tag="TAG_PYTHIA_KW")

    # Convert the string into a long value (no larger than the order of Gt),
    # then return a BigInt value.
    return BigInt(longFromString(b) % long(orderGt()))
804640
def unpack(cls, data):
        
        size = struct.calcsize(APPHeader.fmt_header)
        (
            version, msg_type, payload_len,
            timestamp, device_id, flags,
        ), payload = struct.unpack(
            APPHeader.fmt_header, data[:size]
        ), data[size:]
        ack_sequence_number = None
        sequence_number = None

        if flags & Flag.ACKSEQ:
            size = struct.calcsize(APPHeader.fmt_seq_ack)
            (ack_sequence_number,), payload = struct.unpack(
                APPHeader.fmt_seq_ack, payload[:size]
            ), payload[size:]
        if flags & Flag.SEQ:
            size = struct.calcsize(APPHeader.fmt_seq)
            (sequence_number,), payload = struct.unpack(
                APPHeader.fmt_seq, payload[:size]
            ), payload[size:]
        return cls(
            message_type=msg_type,
            version_major=version >> 4,
            version_minor=version & 0xf,
            payload_length=payload_len,
            device_id=device_id,
            sequence_number=sequence_number,
            flags=flags,
            timestamp=timestamp,
            ack_sequence_number=ack_sequence_number
        ), payload
1325291
def ga4ghImportGlue():
    
    path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    sys.path.append(path)