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

def Bio::NeuralNetwork::Gene::Motif::MotifFinder::find_differences (   self,
  first_records,
  second_records,
  motif_size 
)

Find motifs in two sets of records and return the differences.

This is used for finding motifs, but instead of just counting up all
of the motifs in a set of records, this returns the differences
between two listings of seq_records.

o first_records, second_records - Two listings of SeqRecord objects
to have their motifs compared.

o motif_size - The size of the motifs we are looking for.

Returns:
A PatternRepository object that has motifs, but instead of their
raw counts, this has the counts in the first set of records
subtracted from the counts in the second set.

Definition at line 89 of file Motif.py.

00089                                                                          :
        """Find motifs in two sets of records and return the differences.

        This is used for finding motifs, but instead of just counting up all
        of the motifs in a set of records, this returns the differences
        between two listings of seq_records.

        o first_records, second_records - Two listings of SeqRecord objects
        to have their motifs compared.

        o motif_size - The size of the motifs we are looking for.

        Returns:
        A PatternRepository object that has motifs, but instead of their
        raw counts, this has the counts in the first set of records
        subtracted from the counts in the second set.
        """
        first_motifs = self._get_motif_dict(first_records, motif_size)
        second_motifs = self._get_motif_dict(second_records, motif_size)

        motif_diffs = {}

        # first deal with all of the keys from the first motif
        for cur_key in first_motifs.keys():
            if second_motifs.has_key(cur_key):
                motif_diffs[cur_key] = first_motifs[cur_key] - \
                                       second_motifs[cur_key]
            else:
                motif_diffs[cur_key] = first_motifs[cur_key]

        # now see if there are any keys from the second motif
        # that we haven't got yet.
        missing_motifs = second_motifs.keys()[:]

        # remove all of the motifs we've already added
        for added_motif in motif_diffs.keys():
            if added_motif in missing_motifs:
                missing_motifs.remove(added_motif)

        # now put in all of the motifs we didn't get
        for cur_key in missing_motifs:
            motif_diffs[cur_key] = 0 - second_motifs[cur_key]

        return PatternRepository(motif_diffs)
                
    def _add_motif(self, motif_dict, motif_to_add):


Generated by  Doxygen 1.6.0   Back to index