Gets the alignment stream for a particular plate value

        :param plate: The plate on which the alignment node lives
        :param plate_value: The plate value to select the stream from the node
        :return: The alignment stream
961740
def get_alignment_stream(self, plate=None, plate_value=None):
        
        if not self.alignment_node:
            return None
        if plate is not None or plate_value is not None:
            # TODO: Need to implement alignment nodes that live inside plates
            raise NotImplementedError("Currently only alignment nodes outside of plates are supported")
        return self.alignment_node.streams[plate]
100036
def _TableFactory(tag, stream, offset, length):
    
    TableClass = {
        'head': _HeadTable,
        'name': _NameTable,
    }.get(tag, _BaseTable)
    return TableClass(tag, stream, offset, length)
145372
public Template parseTemplate(InputStream stream) throws IOException {
        return parseTemplate(new BufferedReader(new InputStreamReader(stream, Charsets.UTF_8)));
    }
905041
def get_plate_values(self, plate_definition):
        
        if not plate_definition.values and not plate_definition.complement:
            raise PlateDefinitionError()

        values = []
        for n in self.meta_data_manager.global_plate_definitions.all_nodes():
            if n.tag == plate_definition.meta_data_id:
                if not plate_definition.values or n.data in plate_definition.values:
                    if plate_definition.parent_plate:
                        # This plate has parent plates, so we need to get parent data for the node
                        parent_plate_value = self.get_parent_plate_value(
                            self.meta_data_manager.global_plate_definitions, n)
                        # if tuple(parent_plate_value) not in self.plates[plate_definition.parent_plate].values:
                        if set(parent_plate_value) not in map(set, self.plates[plate_definition.parent_plate].values):
                            continue
                        values.insert(0, self.get_parent_data(
                            self.meta_data_manager.global_plate_definitions, n, [(n.tag, n.data), ]))
                    else:
                        values.insert(0, [(n.tag, n.data), ])
        if not values:
            # raise PlateEmptyError(plate_definition.plate_id)
            logging.warn("Plate {} is empty during the creation".format(plate_definition.plate_id))
        return values
176842
def find_stream(cls, fileobj, max_bytes):
        

        r = BitReader(fileobj)
        stream = cls(r)
        if stream.sync(max_bytes):
            stream.offset = (r.get_position() - 12) // 8
            return stream
1062118
def find_stream(self, **kwargs):
        
        found = list(self.find_streams(**kwargs).values())
        if not found:
            raise StreamNotFoundError(kwargs)
        if len(found) > 1:
            raise MultipleStreamsFoundError(kwargs)
        return found[0]
515026
def template(self):
        '''
        
        '''
        instance = self.template_instance()
        offset = self._chunk.offset() + instance.template_offset()
        node = TemplateNode(self._buf, offset, self._chunk, instance)
        return node
1220737
def get_offset(self):
    
    if not self._is_open:
      raise IOError('Not opened.')

    if self._fsntfs_data_stream:
      return self._fsntfs_data_stream.get_offset()
    return self._fsntfs_file_entry.get_offset()
748046
def get_element_offset(self, ty, position):
        

        offset = ffi.lib.LLVMPY_OffsetOfElement(self, ty, position)
        if offset == -1:
            raise ValueError("Could not determined offset of {}th "
                    "element of the type '{}'. Is it a struct type?".format(
                    position, str(ty)))
        return offset
598538
def _parse_value(cls, stream_rdr, offset, value_count, value_offset):
        
        return stream_rdr.read_str(value_count-1, value_offset)
1196976
def tag_value(self, p_key, p_default=None):
        
        return self.tag_values(p_key)[0] if p_key in self.fields['tags'] else p_default
647960
def get_sequence_value(node):
        
        assert node.datatype() == 15
        data = defaultdict(list)
        cols = []
        for i in range(node.numValues()):
            row = node.getValue(i)
            if i == 0:  # Get the ordered cols and assume they are constant
                cols = [str(row.getElement(_).name()) for _ in range(row.numElements())]

            for cidx in range(row.numElements()):
                col = row.getElement(cidx)
                data[str(col.name())].append(XmlHelper.as_value(col))
        return pd.DataFrame(data, columns=cols)
784460
def add_plate(self, plate_definition):
        
        values = self.get_plate_values(plate_definition)

        # TODO: We should also be checking that the plate is defined over all of the values of the parent plate
        self.plates[plate_definition.plate_id] = Plate(
            plate_id=plate_definition.plate_id,
            meta_data_id=plate_definition.meta_data_id,
            values=values,
            parent_plate=self.plates[plate_definition.parent_plate] if plate_definition.parent_plate else None)

        logging.debug("Added plate: {}".format(self.plates[plate_definition.plate_id]))
1374008
def as_stream(self):
        

        if not self.singular:
            raise ArgumentError("Attempted to convert a non-singular selector to a data stream, it matches multiple", selector=self)

        return DataStream(self.match_type, self.match_id, self.match_spec == DataStreamSelector.MatchSystemOnly)
715976
def get_template(self, template_id):
        
        template = self.contract_concise.getTemplate(template_id)
        if template and len(template) == 4:
            return AgreementTemplate(*template)

        return None
1215074
def _fetch_AlignmentMapper(self, tx_ac, alt_ac, alt_aln_method):
        
        return hgvs.alignmentmapper.AlignmentMapper(
            self.hdp, tx_ac=tx_ac, alt_ac=alt_ac, alt_aln_method=alt_aln_method)
1217527
def tag_value(func):
    
    def inner(self):
        tag, attrib, attrib_type = func(self)
        tag_obj = self.et.find(tag)

        if tag_obj is not None:
            try:
                return attrib_type(self.et.find(tag).attrib[attrib])
            except KeyError:
                raise AttributeError

    return inner