Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(1231)  |  Call(966)  |  Derive(10)  |  Import(255)
A read-only sequence object (essentially a string with an alphabet).

Like normal python strings, our basic sequence object is immutable.
This prevents you from doing my_seq[5] = "A" for example, but does allow
Seq objects to be used as dictionary keys.

The Seq object provides a number of string like methods (such as count,
find, split and strip), which are alphabet aware where appropriate.

In addition to the string like sequence, the Seq object has an alphabet(more...)

src/b/i/biopython-HEAD/Bio/SeqUtils/__init__.py   biopython(Download)
from math import pi, sin, cos
 
from Bio.Seq import Seq, MutableSeq
from Bio import Alphabet
from Bio.Alphabet import IUPAC
            tmp_type = 'protein'
            # Convert to one-letter sequence. Have to use a string for seq1  
            seq = Seq(seq1(str(seq)), alphabet=Alphabet.ProteinAlphabet())
        elif not isinstance(base_alphabet, Alphabet.Alphabet):
            raise TypeError("%s is not a valid alphabet for mass calculations"

src/b/i/biopython-1.63/Bio/motifs/matrix.py   biopython(Download)
from Bio._py3k import range
 
from Bio.Seq import Seq
from Bio.Alphabet import IUPAC
 
                    sequence_letter = letter
            sequence += sequence_letter
        return Seq(sequence, self.alphabet)
 
    @property
                    sequence_letter = letter
            sequence += sequence_letter
        return Seq(sequence, self.alphabet)
 
    @property
            nucleotide = degenerate_nucleotide[key]
            sequence += nucleotide
        return Seq(sequence, alphabet = IUPAC.ambiguous_dna)
 
    @property

src/b/i/biopython-HEAD/Bio/motifs/matrix.py   biopython(Download)
from Bio._py3k import range
 
from Bio.Seq import Seq
from Bio.Alphabet import IUPAC
 
                    sequence_letter = letter
            sequence += sequence_letter
        return Seq(sequence, self.alphabet)
 
    @property
                    sequence_letter = letter
            sequence += sequence_letter
        return Seq(sequence, self.alphabet)
 
    @property
            nucleotide = degenerate_nucleotide[key]
            sequence += nucleotide
        return Seq(sequence, alphabet = IUPAC.ambiguous_dna)
 
    @property

src/b/i/biopython-HEAD/Bio/CodonAlign/CodonSeq.py   biopython(Download)
from math import log
 
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from Bio.Alphabet import IUPAC, Gapped, HasStopCodon, Alphabet
class CodonSeq(Seq):
    """CodonSeq is designed to be within the SeqRecords of a 
    CodonAlignment class.
 
    CodonSeq is useful as it allows the user to specify
    def __getitem__(self, index):
        # TODO: handle alphabet elegantly
        return Seq(self._data[index], alphabet=generic_dna)
 
    def get_codon(self, index):
    def toSeq(self, alphabet=generic_dna):
        return Seq(self._data, generic_dna)
 
    def get_full_rf_table(self):
        """This function returns a full rf_table of the given

src/b/i/biopython-1.63/Bio/motifs/__init__.py   biopython(Download)
    def __init__(self, instances=[], alphabet=None):
        from Bio.Alphabet import IUPAC
        from Bio.Seq import Seq
        self.length = None
        for instance in instances:
            if not isinstance(instance, Seq):
                sequence = str(instance)
                instance = Seq(sequence, alphabet=alphabet)
            self.append(instance)
        self.alphabet = alphabet

src/b/i/biopython-HEAD/Bio/motifs/__init__.py   biopython(Download)
    def __init__(self, instances=[], alphabet=None):
        from Bio.Alphabet import IUPAC
        from Bio.Seq import Seq
        self.length = None
        for instance in instances:
            if not isinstance(instance, Seq):
                sequence = str(instance)
                instance = Seq(sequence, alphabet=alphabet)
            self.append(instance)
        self.alphabet = alphabet

src/s/e/seqmagick-0.5.0/seqmagick/transform.py   seqmagick(Download)
from Bio.Alphabet import IUPAC
from Bio.Data import CodonTable
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from Bio.SeqUtils.CheckSum import seguid
    translation_table = string.maketrans(prune_chars, '-' * len(prune_chars))
    for record in records:
        record.seq = Seq(str(record.seq).translate(translation_table),
                         record.seq.alphabet)
        yield record
        start_gap = gap_char * start
        end_gap = gap_char * (len(seq) - end)
        seq = Seq(start_gap + str(seq[start:end]) + end_gap,
                alphabet=seq.alphabet)
        sequence.seq = seq
                   for i in range(*slice.indices(len(record))))
        keep = [i not in drop for i in xrange(len(record))]
        record.seq = Seq(''.join(itertools.compress(record.seq, keep)), record.seq.alphabet)
        yield record
 
        seq = ''.join(b if i in keep_indices else '-'
                      for i, b in enumerate(str(record.seq)))
        record.seq = Seq(seq)
        yield record
 

src/s/e/seqmagick-HEAD/seqmagick/transform.py   seqmagick(Download)
from Bio.Alphabet import IUPAC
from Bio.Data import CodonTable
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from Bio.SeqUtils.CheckSum import seguid
    translation_table = string.maketrans(prune_chars, '-' * len(prune_chars))
    for record in records:
        record.seq = Seq(str(record.seq).translate(translation_table),
                         record.seq.alphabet)
        yield record
        start_gap = gap_char * start
        end_gap = gap_char * (len(seq) - end)
        seq = Seq(start_gap + str(seq[start:end]) + end_gap,
                alphabet=seq.alphabet)
        sequence.seq = seq
                   for i in range(*slice.indices(len(record))))
        keep = [i not in drop for i in xrange(len(record))]
        record.seq = Seq(''.join(itertools.compress(record.seq, keep)), record.seq.alphabet)
        yield record
 
        seq = ''.join(b if i in keep_indices else '-'
                      for i, b in enumerate(str(record.seq)))
        record.seq = Seq(seq)
        yield record
 

src/s/s/SSuMMo-0.3/lib/ArbIO.py   SSuMMo(Download)
                        else:
                                sequence += line.rstrip()
                return arbSeqRecord( Seq.Seq(sequence,alphabet = generic_rna),id=id,name=species,description=desc)
 
        def __setitem__(self,accession,location):
                                #if sequence != '':
				sequence = self.arbSeqToStr(sequence,skipGapped)
				record = arbSeqRecord( Seq.Seq(sequence,alphabet = generic_rna),id=id,name=name,description=desc)
				yield record
				# end if block
                                sequence += line.rstrip()
                sequence = self.arbSeqToStr(sequence,skipGapped)
                record = arbSeqRecord( Seq.Seq(sequence,alphabet=generic_rna),id=id, name=name, description=desc)
                yield record
 

src/s/s/SSuMMo-0.3/lib/simulate_lengths.py   SSuMMo(Download)
    def writer(cls, seqRecord,length,start=0 ):
        seqRecord.seq = Seq.Seq( cls.replSub.sub( '', seqRecord.seq.tostring() ), alphabet=Alphabet.generic_rna )[start:start+length]
        return seqRecord
    @classmethod
    def reverser(cls, seqRecord,length,start=0 ):
        """N.B. This doesn't take the reverse complement. It returns a
        sequence slice from the opposite end."""
        seqRecord.seq = Seq.Seq( cls.replSub.sub( '', seqRecord.seq.tostring() ) , alphabet = Alphabet.generic_rna )[-start-length:-start]

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next