Logo Search packages:      
Sourcecode: python-biopython version File versions

def Bio::GenBank::_FeatureConsumer::_set_function (   self,
  function,
  cur_feature 
) [private]

Set the location information based on a function.

This handles all of the location functions like 'join', 'complement'
and 'order'.

Arguments:
o function - A LocationParser.Function object specifying the
function we are acting on.
o cur_feature - The feature to add information to.

Definition at line 638 of file __init__.py.

00638                                                   :
        """Set the location information based on a function.

        This handles all of the location functions like 'join', 'complement'
        and 'order'.

        Arguments:
        o function - A LocationParser.Function object specifying the
        function we are acting on.
        o cur_feature - The feature to add information to.
        """
        from Bio import SeqFeature
        from Bio.GenBank import LocationParser
        assert isinstance(function, LocationParser.Function), \
               "Expected a Function object, got %s" % function
        
        if function.name == "complement":
            # mark the current feature as being on the opposite strand
            cur_feature.strand = -1
            # recursively deal with whatever is left inside the complement
            for inner_info in function.args:
                self._set_location_info(inner_info, cur_feature)
        # deal with functions that have multipe internal segments that
        # are connected somehow.
        # join and order are current documented functions.
        # one-of is something I ran across in old files. Treating it
        # as a sub sequence feature seems appropriate to me.
        # bond is some piece of junk I found in RefSeq files. I have
        # no idea how to interpret it, so I jam it in here
        elif (function.name == "join" or function.name == "order" or
              function.name == "one-of" or function.name == "bond"):
            self._set_ordering_info(function, cur_feature)
        elif (function.name == "gap"):
            assert len(function.args) == 1, \
              "Unexpected number of arguments in gap %s" % function.args
            # make the cur information location a gap object
            position = self._get_position(function.args[0].local_location)
            cur_feature.location = SeqFeature.PositionGap(position)
        else:
            raise ValueError("Unexpected function name: %s" % function.name)

    def _set_ordering_info(self, function, cur_feature):


Generated by  Doxygen 1.6.0   Back to index