def _process_all_allele_mutation_view(self, limit):
        """
        This fetches the mutation type for the alleles,
        and maps them to the sequence alteration.
        Note that we create a BNode for the sequence alteration because
        it isn't publicly identified.
        <sequence alteration id> a <SO:mutation_type>

        :param limit:
        :return:

        """
        if self.test_mode:
            graph = self.testgraph
        else:
            graph = self.graph
        model = Model(graph)
        line_counter = 0
        raw = '/'.join((self.rawdir, 'all_allele_mutation_view'))
        LOG.info("getting mutation types for sequence alterations")
        with open(raw, 'r') as f:
            f.readline()  # read the header row; skip
            for line in f:
                line = line.rstrip("\n")
                line_counter += 1

                (allele_key, mutation) = line.split('\t')
                iseqalt_id = self.idhash['seqalt'].get(allele_key)
                if iseqalt_id is None:
                    iseqalt_id = self._makeInternalIdentifier('seqalt', allele_key)

                if self.test_mode and int(allele_key) \
                        not in self.test_keys.get('allele'):
                    continue

                # TODO we might need to map the seq alteration to the MGI id
                # for unlocated things; need to use hashmap
                # map the sequence_alteration_type

                seq_alt_type_id = self.resolve(mutation, False)
                if seq_alt_type_id == mutation:
                    LOG.error("No mappjng found for seq alt '%s'", mutation)
                    LOG.info("Defaulting to 'sequence_alteration'")
                    seq_alt_type_id = self.globaltt['sequence_alteration']

                # HACK - if the seq alteration is a transgene,
                # then make sure it is a transgenic insertion
                allele_id = self.idhash['allele'].get(allele_key)
                if allele_id is not None:
                    allele_label = self.label_hash.get(allele_id)
                    if allele_label is not None and re.search(r'Tg\(', allele_label):
                        LOG.info(
                            "Found a transgenic insertion for %s", allele_label)
                        # transgenic_insertion, instead of plain old insertion
                        seq_alt_type_id = self.globaltt["transgenic_insertion"]

                model.addIndividualToGraph(iseqalt_id, None, seq_alt_type_id)

                if not self.test_mode and limit is not None and line_counter > limit:
                    break

        return
def _process_all_allele_mutation_view ( self , limit ) : if self . test_mode : graph = self . testgraph else : graph = self . graph model = Model ( graph ) line_counter = 0 raw = '/' . join ( ( self . rawdir , 'all_allele_mutation_view' ) ) LOG . info ( "getting mutation types for sequence alterations" ) with open ( raw , 'r' ) as f : f . readline ( ) for line in f : line = line . rstrip ( "\n" ) line_counter += 1 ( allele_key , mutation ) = line . split ( '\t' ) iseqalt_id = self . idhash [ 'seqalt' ] . get ( allele_key ) if iseqalt_id is None : iseqalt_id = self . _makeInternalIdentifier ( 'seqalt' , allele_key ) if self . test_mode and int ( allele_key ) not in self . test_keys . get ( 'allele' ) : continue seq_alt_type_id = self . resolve ( mutation , False ) if seq_alt_type_id == mutation : LOG . error ( "No mappjng found for seq alt '%s'" , mutation ) LOG . info ( "Defaulting to 'sequence_alteration'" ) seq_alt_type_id = self . globaltt [ 'sequence_alteration' ] allele_id = self . idhash [ 'allele' ] . get ( allele_key ) if allele_id is not None : allele_label = self . label_hash . get ( allele_id ) if allele_label is not None and re . search ( r'Tg\(' , allele_label ) : LOG . info ( "Found a transgenic insertion for %s" , allele_label ) seq_alt_type_id = self . globaltt [ "transgenic_insertion" ] model . addIndividualToGraph ( iseqalt_id , None , seq_alt_type_id ) if not self . test_mode and limit is not None and line_counter > limit : break return
This fetches the mutation type for the alleles,
        and maps them to the sequence alteration.
        Note that we create a BNode for the sequence alteration because
        it isn't publicly identified.
        <sequence alteration id> a <SO:mutation_type>

        :param limit:
        :return: