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

# Bio.Seq.reverse_complement

All Samples(85)  |  Call(61)  |  Derive(0)  |  Import(24)
```Returns the reverse complement sequence of a nucleotide string.

If given a string, returns a new string object.
Given a Seq or a MutableSeq, returns a new Seq object with the same alphabet.

Supports unambiguous and ambiguous nucleotide sequences.

e.g.

>>> reverse_complement("ACTG-NH")(more...)
```

```        def reverse_complement(sequence):
"""Returns the reverse complement sequence of a nucleotide string.

If given a string, returns a new string object.
Given a Seq or a MutableSeq, returns a new Seq object with the same alphabet.

Supports unambiguous and ambiguous nucleotide sequences.

e.g.

>>> reverse_complement("ACTG-NH")
'DN-CAGT'
"""
if isinstance(sequence, Seq):
#Return a Seq
return sequence.reverse_complement()
elif isinstance(sequence, MutableSeq):
#Return a Seq
#Don't use the MutableSeq reverse_complement method as it is 'in place'.
return sequence.toseq().reverse_complement()

#Assume its a string.
#In order to avoid some code duplication, the old code would turn the string
#into a Seq, use the reverse_complement method, and convert back to a string.
#This worked, but is over five times slower on short sequences!
if ('U' in sequence or 'u' in sequence) \
and ('T' in sequence or 't' in sequence):
raise ValueError("Mixed RNA/DNA found")
elif 'U' in sequence or 'u' in sequence:
ttable = _rna_complement_table
else:
ttable = _dna_complement_table
return sequence.translate(ttable)[::-1]
```

```
"""
from Bio.Seq import reverse_complement, translate
anti = reverse_complement(seq)
comp = anti[::-1]
```

```

from Bio.Seq import reverse_complement, translate
from Bio.SeqUtils import GC

```
```    def complement(self, seq):
#TODO - use Seq methods instead of this hack:?
return reverse_complement(seq)[::-1]

def reverse(self, seq):
return seq[::-1]

def antiparallel(self, seq):
return reverse_complement(seq)
```

```

from Bio.Seq import reverse_complement, translate
from Bio.SeqUtils import GC

```
```    def complement(self, seq):
#TODO - use Seq methods instead of this hack:?
return reverse_complement(seq)[::-1]

def reverse(self, seq):
return seq[::-1]

def antiparallel(self, seq):
return reverse_complement(seq)
```

```
"""
from Bio.Seq import reverse_complement, translate
anti = reverse_complement(seq)
comp = anti[::-1]
```

```from Bio.Seq import Seq, reverse_complement, translate
from Bio.SeqRecord import SeqRecord
from Bio import SeqIO
from Bio.Data import CodonTable
from Bio.Alphabet import IUPAC
```
```        if int(strand) == -1:
# we might have unicode here hence the cast
seq = reverse_complement(str(seq))
elif int(strand) == 1:
pass
```
```        if int(strand) == -1:
# we might have unicode here hence the cast
seq = reverse_complement(str(seq))
elif int(strand) == 1:
pass
```
```
if strand < 0:
ref_substr = reverse_complement(ref_substr)
cns_substr = reverse_complement(cns_substr)

```

```    '''

from Bio.Seq import reverse_complement
from Bio.SeqRecord import SeqRecord
import itertools
```
```        # force circular comparison of all given sequences
for s1, s2 in itertools.combinations(args_string_list, 2):
if not ( s1 in s2+s2 or reverse_complement(s1) in s2+s2):
same = False
elif topology == "linear":
# force linear comparison of all given sequences
for s1,s2 in itertools.combinations(args_string_list, 2):
if not ( s1==s2 or s1==reverse_complement(s2) ):
```
```    import itertools
import copy
from Bio.Seq import reverse_complement
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
```
```        a    = str(sequence).lower()
a_rc = str(reverse_complement(sequence)).lower()
sequence_rc = reverse_complement(sequence)
double_sequence = a+a

```

```    '''

from Bio.Seq import reverse_complement
from Bio.SeqRecord import SeqRecord
import itertools
```
```        # force circular comparison of all given sequences
for s1, s2 in itertools.combinations(args_string_list, 2):
if not ( s1 in s2+s2 or reverse_complement(s1) in s2+s2):
same = False
elif topology == "linear":
# force linear comparison of all given sequences
for s1,s2 in itertools.combinations(args_string_list, 2):
if not ( s1==s2 or s1==reverse_complement(s2) ):
```
```    '''
import re
from Bio.Seq import reverse_complement as rc
target_length    = len(target_sr)
target_string    = str(target_sr.seq).upper()
```
```
trgt_string = target_string
trgt_string_rc = rc(trgt_string)

for feature in [f for f in source_sr.features if len(f)>limit]:
```

```from __future__ import print_function

from Bio.Seq import MutableSeq, reverse_complement

```
```            except AttributeError:
assert isinstance(f_seq, str)
f_seq = reverse_complement(f_seq)
return f_seq

```

```from __future__ import print_function

from Bio.Seq import MutableSeq, reverse_complement

```
```            except AttributeError:
assert isinstance(f_seq, str)
f_seq = reverse_complement(f_seq)
return f_seq

```

```
from Bio.Data.IUPACData import ambiguous_dna_values
from Bio.Seq import reverse_complement

```
```    def do_search(self, other_strand=0):
pattern = self.get_pattern()
if other_strand:
pattern = reverse_complement(pattern)
self.SetPattern(pattern)
```

1 | 2 | 3  Next