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

def Bio::GenBank::_FeatureConsumer::_set_ordering_info (   self,
  function,
  cur_feature 
) [private]
Parse a join or order and all of the information in it.

This deals with functions that order a bunch of locations,
specifically 'join' and 'order'. The inner locations are
added as subfeatures of the top level feature

Definition at line 730 of file __init__.py.

                                                       :
        """Parse a join or order and all of the information in it.

        This deals with functions that order a bunch of locations,
        specifically 'join' and 'order'. The inner locations are
        added as subfeatures of the top level feature
        """
        # for each inner element, create a sub SeqFeature within the
        # current feature, then get the information for this feature
        cur_feature.location_operator = function.name
        for inner_element in function.args:
            new_sub_feature = SeqFeature.SeqFeature()
            # inherit the type from the parent
            new_sub_feature.type = cur_feature.type 
            # add the join or order info to the location_operator
            new_sub_feature.location_operator = function.name
            # inherit references and strand from the parent feature
            new_sub_feature.ref = cur_feature.ref
            new_sub_feature.ref_db = cur_feature.ref_db
            new_sub_feature.strand = cur_feature.strand

            # set the information for the inner element
            self._set_location_info(inner_element, new_sub_feature)

            # now add the feature to the sub_features
            cur_feature.sub_features.append(new_sub_feature)

        # set the location of the top -- this should be a combination of
        # the start position of the first sub_feature and the end position
        # of the last sub_feature

        # these positions are already converted to python coordinates 
        # (when the sub_features were added) so they don't need to
        # be converted again
        feature_start = cur_feature.sub_features[0].location.start
        feature_end = cur_feature.sub_features[-1].location.end
        cur_feature.location = SeqFeature.FeatureLocation(feature_start,
                                                          feature_end)
        # Historically a join on the reverse strand has been represented
        # in Biopython with both the parent SeqFeature and its children
        # (the exons for a CDS) all given a strand of -1.  Likewise, for
        # a join feature on the forward strand they all have strand +1.
        # However, we must also consider evil mixed strand examples like
        # this, join(complement(69611..69724),139856..140087,140625..140650)
        strands = set(sf.strand for sf in cur_feature.sub_features)
        if len(strands)==1 :
            cur_feature.strand = cur_feature.sub_features[0].strand
        else :
            cur_feature.strand = None # i.e. mixed strands


Generated by  Doxygen 1.6.0   Back to index