TAMO.util.PermuteTools
index
/home/David_Gordon/docs/TAMO/util/PermuteTools.py

PermuteTools.py -- Utility functions for enumerationg lists of sequence permutations
 
Copyright (2005) Whitehead Institute for Biomedical Research (except as noted below)
All Rights Reserved
 
Author: David Benjamin Gordon

 
Functions
       
dimer_groups(width)
dimer_groups(width) -- For every possible word of width "width" with at most one ambiguity code,
                       assemble the REGULAR EXPRESSIONS of form word-gap-(word'), where (word')
                       is the reverse complement of word, and the gap is the text string '.{a,b}'
                       where 'a' and 'b' vary between 0-16 such that b > a.  Intended to represent
                       all possible variable gap motifs that are symmetric.
dimer_words(width)
dimer_words(width) -- For every possible word of width "width" with at most one ambiguity code,
                      assemble the words of form word-gap-(word'), where (word') is the reverse
                      complement of word, and gap is a string of "N"s ranging in length from
                      0 to 12.
expt()
gapped_words(width)
gapped_words(width) -- For every pair returned from uniq_syl_pairs (see documentation for that function)
                       assemble into words with spacings 0-12.   So (AA, GT) --> AAGT, AANGT, AANNGT, ...
permute(letters, depth, seqs=[''], curdepth=0)
permute(letters, depth, seqs=[''],curdepth=0) -- Generate all possible sequences from the alphabet
                                                 "letters" of length "depth" (sorry about the
                                                 variable names).  For example, "permute('ACGT',4)"
                                                 generates all 256 possible 4-letter DNA sequences.
restricted_permute(base_letters, extra_letters, depth, seqs=[''])
restricted_permute(base_letters, extra_letters, depth, seqs = ['']) -- [Utility function] Like permute()
                                                                    above, but allows at most one letter
                                                                    from "extra_letters" into the
                                                                    permutations.  Used for including
                                                                    ambiguity codes.
uniq_syl_pairs(width)
uniq_syl_pairs(width) -- Generates all possible (left,right) sequences, allowing at most one
                         ambiguous letter (S, W, R, or Y) in either left or right.  uniq_syl_pairs(4)
                         returns 836,160 tuples, beginning ('AAAA', 'AAAA'), ('AAAA', 'AAAC'),
                         ('AAAA', 'AAAG'), ('AAAA', 'AAAT'), ('AAAA', 'AAAS'), ...