diff --git a/PRIMERS.TXT b/PRIMERS.TXT
new file mode 100644
index 00000000..32ddbc22
--- /dev/null
+++ b/PRIMERS.TXT
@@ -0,0 +1,5 @@
+
+>fw64 t-sequence
+atgactgctaacccttc
+>rv64 t-sequence
+catcgtaagtttcgaac
\ No newline at end of file
diff --git a/pydna/__init__.py b/pydna/__init__.py
index 9a78ee6a..288d2121 100644
--- a/pydna/__init__.py
+++ b/pydna/__init__.py
@@ -1,20 +1,15 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
-# Copyright 2013,2014, 2015 by Björn Johansson. All rights reserved.
-# This code is part of the Python-dna distribution and governed by its
-# license. Please see the LICENSE.txt file that should have been included
-# as part of this package.
'''
- pydna
- ~~~~~
+# pydna
- The pydna package.
+The pydna package.
- :copyright: Copyright 2013 - 2015 by Björn Johansson. All rights reserved.
- :license: This code is part of the pydna distribution and governed by its
- license. Please see the LICENSE.txt file that should have been included
- as part of this package.
+:copyright: Copyright 2013 - 2016 by Björn Johansson. All rights reserved.
+:license: This code is part of the pydna distribution and governed by its
+ license. Please see the LICENSE.txt file that should have been included
+ as part of this package.
'''
@@ -32,7 +27,7 @@
'''
-Pydna caches results from the assembly2 dsdna and amplify
+Pydna caches results from the assembly dsdna and amplify
modules. pydna sets an environmental variable "pydna_cache"
which can have three different values:
@@ -325,3 +320,37 @@ def _open_folder(pth):
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
+
+class PydnaWarning(Warning):
+ """Pydna warning.
+
+ Pydna uses this warning (or subclasses of it), to make it easy to
+ silence all warning messages:
+
+ >>> import warnings
+ >>> from pydna import PydnaWarning
+ >>> warnings.simplefilter('ignore', PydnaWarning)
+
+ Consult the warnings module documentation for more details.
+ """
+ pass
+
+
+class PydnaDeprecationWarning(PydnaWarning):
+ """pydna deprecation warning.
+
+ Pydna uses this warning instead of the built in DeprecationWarning
+ since those are ignored by default since Python 2.7.
+
+ To silence all our deprecation warning messages, use:
+
+ >>> import warnings
+ >>> from pydna import PydnaDeprecationWarning
+ >>> warnings.simplefilter('ignore', PydnaDeprecationWarning)
+
+ Code marked as deprecated will be removed in a future version
+ of Pydna. This can be discussed in the Pydna google group:
+ https://groups.google.com/forum/#!forum/pydna
+
+ """
+ pass
diff --git a/pydna/_pretty.py b/pydna/_pretty.py
index c8596c4c..12a2498b 100644
--- a/pydna/_pretty.py
+++ b/pydna/_pretty.py
@@ -7,8 +7,8 @@ class pretty_str(str):
''' Thanks to Min RK, UC Berkeley for this'''
def _repr_pretty_(self, p, cycle):
p.text(self)
- def _repr_html_(self):
- return "123"
+# def _repr_html_(self):
+# return "123"
class pretty_unicode(str):
def _repr_pretty_(self, p, cycle):
diff --git a/pydna/amplify.py b/pydna/amplify.py
index c19e8d21..5fb2dc89 100644
--- a/pydna/amplify.py
+++ b/pydna/amplify.py
@@ -167,13 +167,13 @@ class Amplicon(Dseqrecord):
def __init__( self,
record,
+ *args,
template=None,
forward_primer=None,
reverse_primer=None,
saltc=None,
fprimerc=1000.0,
rprimerc=1000.0,
- *args,
**kwargs):
super().__init__(record, *args, **kwargs)
@@ -199,6 +199,12 @@ def __repr__(self):
'''returns a short string representation of the object'''
return "Amplicon({})".format(self.__len__())
+ def _repr_pretty_(self, p, cycle):
+ p.text("Amplicon({})".format(self.__len__()))
+
+ def _repr_html_(self):
+ return "Amplicon({})".format(self.__len__())
+
def flankup(self, flankuplength=50):
'''Returns a Dseqrecord object containing flankuplength bases upstream of the forward primer footprint,
Truncated if the template is not long enough.
@@ -829,7 +835,7 @@ def pcr(*args, **kwargs):
elif isinstance(s, str):
s = SeqRecord(Seq(s))
else:
- raise TypeError("the record property needs to be a string, a Seq object or a SeqRecord object")
+ raise TypeError("the record property needs to be a string, Seq, SeqRecord or Dseqrecord object")
new.append(s)
anneal_primers = Anneal( new[:-1],
@@ -838,10 +844,7 @@ def pcr(*args, **kwargs):
if anneal_primers:
if len(anneal_primers.products) == 1:
- result = anneal_primers.products.pop()
- msg = "```\n"+result.__repr__()+"```"
- display(Markdown(msg))
- return result
+ return anneal_primers.products[0]
elif len(anneal_primers.products) == 0:
raise Exception("No PCR products! {}".format(anneal_primers.report()))
else:
diff --git a/pydna/assembly.py b/pydna/assembly.py
index accf5509..fb007ac7 100644
--- a/pydna/assembly.py
+++ b/pydna/assembly.py
@@ -44,21 +44,23 @@
def display(item): return item
Markdown = display
-class Fragment(Dseqrecord):
+class _Fragment(Dseqrecord):
'''This class holds information about a DNA fragment in an assembly.
This class is instantiated by the :class:`Assembly` class and is not
meant to be instantiated directly.
'''
-
- def __init__(self, record, start1 = 0,
+
+ def __init__(self, record, *args,
+ start1 = 0,
end1 = 0,
start2 = 0,
end2 = 0,
alignment = 0,
- i = 0, *args, **kwargs):
+ i = 0,
+ **kwargs):
- super(Fragment, self).__init__(record, *args, **kwargs)
+ super().__init__(record, *args, **kwargs)
self.start1 = start1
self.end1 = end1
@@ -70,7 +72,7 @@ def __init__(self, record, start1 = 0,
self.i = i
def __str__(self):
- return ("Fragment alignment {}\n").format(self.alignment)+super(Fragment, self).__str__()
+ return ("Fragment alignment {}\n").format(self.alignment)+super().__str__()
class Contig(Dseqrecord):
'''This class holds information about a DNA assembly. This class is instantiated by
@@ -80,8 +82,9 @@ class Contig(Dseqrecord):
def __init__(self,
record,
+ *args,
source_fragments=[],
- *args, **kwargs):
+ **kwargs):
super().__init__(record, *args, **kwargs)
self.source_fragments = source_fragments
@@ -89,6 +92,14 @@ def __init__(self,
def __repr__(self):
return "Contig({}{})".format({True:"-", False:"o"}[self.linear],len(self))
+
+ def _repr_pretty_(self, p, cycle):
+ '''returns a short string representation of the object'''
+ p.text("Contig({}{})".format({True:"-", False:"o"}[self.linear],len(self)))
+
+ def _repr_html_(self):
+ return "
"+self.small_fig()+"
"
+ #"Contig({}{})".format({True:"-", False:"o"}[self.linear],len(self))
def detailed_figure(self):
'''Synonym of :func:`detailed_fig`'''
@@ -316,7 +327,7 @@ def __init__(self, dsrecs, limit = 25, only_terminal_overlaps=False, max_nodes=N
setattr(self, key, value )
cache.close()
- display(Markdown("```\n"+self.__repr__()+"```".replace('\n', '
')))
+ #display(Markdown("```\n"+self.__repr__()+"```".replace('\n', '
')))
def _compare(self, cached):
if str(self) != str(cached):
@@ -436,7 +447,7 @@ def _assemble(self):
olp2.location.start.position,
olp2.location.end.position,)
- source_fragment = Fragment(dsrec,s1,e1,s2,e2,i)
+ source_fragment = _Fragment(dsrec, start1=s1,end1=e1,start2=s2,end2=e2,i=i) #_Fragment(dsrec,s1,e1,s2,e2,i)
self.G.add_edge( n1, n2,
frag=source_fragment,
@@ -499,19 +510,19 @@ def _assemble(self):
for pth in all_circular_paths_edges(self.cG):
- ns = min(enumerate(pth), key = lambda x:x[1][2]['i'])[0]
+ ns = min( enumerate(pth), key = lambda x:x[1][2]['i'] )[0]
path = pth[ns:]+pth[:ns]
pred_frag = copy(path[0][2]['frag'])
source_fragments = [pred_frag, ]
-
+
if pred_frag.start2{linktext}".format(item=self.item, start=self.start or "", stop=self.stop or "", strand=self.strand, linktext=linktext)
-class Genbank():
+class Genbank(object):
'''Class to facilitate download from genbank.
Parameters
@@ -98,8 +104,6 @@ def __init__(self, users_email, proxy = None, tool="pydna"):
self.email=users_email #Always tell NCBI who you are
- #print "#####", proxy
-
if proxy:
parsed = urlparse(proxy)
scheme = parsed.scheme
@@ -122,7 +126,7 @@ def __init__(self, users_email, proxy = None, tool="pydna"):
#urllib2.install_opener(self.opener)
def __repr__(self):
- return "Genbank({})".format(self.email)
+ return "GenbankConnection({})".format(self.email)
def nucleotide(self, item, start=None, stop=None, strand="watson" ):
'''Download a genbank nuclotide record.
@@ -131,8 +135,8 @@ def nucleotide(self, item, start=None, stop=None, strand="watson" ):
for a nucleotide file. Start and stop are intervals to be
downloaded. This is useful as some genbank records are large.
If strand is "c", "C", "crick", "Crick", "antisense","Antisense",
- "2" or 2, the watson(antisense) strand is returned, otherwise
- the sense strand is returned.
+ "2" or 2, the antisense (Crick) strand is returned, otherwise
+ the sense (Watson) strand is returned.
Alternatively, item can be a string containing an url that returns a
sequence in genbank or FASTA format.
@@ -226,14 +230,16 @@ def nucleotide(self, item, start=None, stop=None, strand="watson" ):
if self.email == "someone@example.com":
raise ValueError("you have to set your email address in order to download from Genbank")
- result = read(Entrez.efetch(db ="nucleotide",
- id = item,
- rettype = "gbwithparts",
- seq_start = start,
- seq_stop = stop,
- strand = strand,
- retmode = "text").read())
-
+ text = Entrez.efetch( db ="nucleotide",
+ id = item,
+ rettype = "gbwithparts",
+ seq_start = start,
+ seq_stop = stop,
+ strand = strand,
+ retmode = "text" ).read()
+ dsr = read(text)
+ result = GenbankRecord(dsr, item = item, start=start, stop=stop, strand=strand)
+
if os.environ["pydna_cache"] == "compare":
if result!=cached:
module_logger.warning('download error')
@@ -241,13 +247,10 @@ def nucleotide(self, item, start=None, stop=None, strand="watson" ):
if refresh or os.environ["pydna_cache"] == "refresh":
cache = shelve.open(os.path.join(os.environ["pydna_data_dir"], "genbank"), protocol=pickle.HIGHEST_PROTOCOL, writeback=False)
cache[key] = result, item, start, stop
-
elif cached and os.environ["pydna_cache"] not in ("nocache", "refresh"):
result = cached
cache.close()
-
- display(HTML("{item} {start}-{stop}".format(item=item, start=start, stop=stop)))
-
+
return result
def download_text(url, proxy = None):
@@ -304,16 +307,30 @@ def download_text(url, proxy = None):
return result
+email = os.getenv("pydna_email")
+
+def genbank(accession, proxy=None):
+ gb = Genbank(email, proxy=proxy)
+ return gb.nucleotide(accession)
+
def read_url(url, proxy = None):
+ from pydna import PydnaDeprecationWarning
+ warnings.warn( "This function is obsolete; use download_text()"
+ "in combination with pydna.read instead",
+ BiopythonDeprecationWarning )
wb = Web(proxy=proxy)
result = wb.download(url)
return read(result)
def parse_url(url, proxy = None):
+ from pydna import PydnaDeprecationWarning
+ warnings.warn( "This function is obsolete; use download_text()"
+ "in combination with pydna.parse instead",
+ BiopythonDeprecationWarning )
wb = Web(proxy=proxy)
result = wb.download(url)
return parse(result)
if __name__=="__main__":
import doctest
- doctest.testmod()
+ doctest.testmod()
\ No newline at end of file
diff --git a/pydna/dsdna.py b/pydna/dsdna.py
index fce23fb3..80ee8416 100644
--- a/pydna/dsdna.py
+++ b/pydna/dsdna.py
@@ -27,6 +27,7 @@
import math
import glob
import colorsys
+import collections
from warnings import warn
@@ -1370,10 +1371,10 @@ class Dseqrecord(SeqRecord):
'''
def __init__(self, record,
+ *args,
circular = None,
linear = None,
n = 5E-14, # mol (0.05 pmol)
- *args,
**kwargs):
self.n = n
if circular == None and linear in (True, False,):
@@ -1863,8 +1864,6 @@ def verify_stamp(self, chksum = (("SEGUID", seg),("cSEGUID", cseg))):
else:
return pretty_str(pattern)
-
-
def looped(self):
'''
Returns a circular version of the Dseqrecord object. The
@@ -2006,7 +2005,7 @@ def write(self, filename=None, f="gb"):
os.rename(filename, old_filename)
result = ("Sequence of pYPKa_TDH3_FaPDC_TPI1.gb changed from last save.
"
"{old_filename}
").format(old_filename=old_filename)
- display(HTML(result))
+ #display(HTML(result))
else:
raise Exception("filename has to be a string, got", type(filename))
@@ -2152,9 +2151,6 @@ def __repr__(self):
return "Dseqrecord({}{})".format({True:"-", False:"o"}[self.linear],len(self))
def _repr_pretty_(self, p, cycle):
- if cycle:
- p.text('Dseqrecord(...)')
- else:
p.text("Dseqrecord({}{})".format({True:"-", False:"o"}[self.linear],len(self)))
def __add__(self, other):
@@ -2640,11 +2636,26 @@ def synced(self, ref, limit = 25):
elif cached and os.environ["pydna_cache"] not in ("nocache", "refresh"):
result = cached
cache.close()
-
return result
+class GenbankFile(Dseqrecord):
+ def __init__(self, record, *args, path=None, **kwargs):
+ super().__init__(record, *args, **kwargs)
+ self.path=path
+
+ def __repr__(self):
+ '''returns a short string representation of the object'''
+ return "File({})({}{})".format(self.id, {True:"-", False:"o"}[self.linear],len(self))
+
+ def _repr_pretty_(self, p, cycle):
+ '''returns a short string representation of the object'''
+ p.text("File({})({}{})".format(self.id, {True:"-", False:"o"}[self.linear],len(self)))
+
+ def _repr_html_(self):
+ return "{path}
".format(path=self.path)
+
def read(data, ds = True):
'''This function is similar the :func:`parse` function but expects one and only
@@ -2765,16 +2776,12 @@ def parse(data, ds = True):
mode and parsed for EMBL, FASTA
and Genbank sequences.
- 2. an absolute path to a local directory.
- All files in the directory will be
- read and parsed as in 1.
-
- 3. a string containing one or more
+ 2. a string containing one or more
sequences in EMBL, GENBANK,
or FASTA format. Mixed formats
are allowed.
- 4. data can be a list or other iterable of 1 - 3
+ 3. data can be a list or other iterable where the elements are 1 or 2
ds : bool
If True double stranded :class:`Dseqrecord` objects are returned.
@@ -2795,82 +2802,78 @@ def parse(data, ds = True):
read
'''
- raw= ""
-
- # a string is an iterable datatype but on Python2.x it doesn't have an __iter__ method.
- if not hasattr(data, '__iter__') or isinstance(data, (str, bytes)):
- data = (data,)
- filenames = []
- for item in data:
- #fn = os.path.join(dr, item )
- try:
- with open(item, 'r', encoding="utf-8") as f:
- raw+= f.read()
- except IOError:
- raw+=textwrap.dedent(item).strip()
- else:
- filenames.append(item)
-
- pattern = r"(?:>.+\n^(?:^[^>]+?)(?=\n\n|>|LOCUS|ID))|(?:(?:LOCUS|ID)(?:(?:.|\n)+?)^//)"
- #raw = raw.replace( '\r\n', '\n')
- #raw = raw.replace( '\r', '\n')
- rawseqs = re.findall(pattern, textwrap.dedent(raw + "\n\n"), flags=re.MULTILINE)
- sequences=[]
-
- while rawseqs:
- circular = False
- rawseq = rawseqs.pop(0)
- handle = io.StringIO(rawseq)
- try:
- parsed = SeqIO.read(handle, "embl", alphabet=IUPACAmbiguousDNA())
- if "circular" in rawseq.splitlines()[0]:
- circular = True
- except ValueError:
- handle.seek(0)
+
+ def embl_gb_fasta(raw, ds, path=None):
+
+ pattern = r"(?:>.+\n^(?:^[^>]+?)(?=\n\n|>|LOCUS|ID))|(?:(?:LOCUS|ID)(?:(?:.|\n)+?)^//)"
+
+ result_list = []
+
+ rawseqs = re.findall(pattern, textwrap.dedent(raw + "\n\n"), flags=re.MULTILINE)
+
+ for rawseq in rawseqs:
+ handle = io.StringIO(rawseq)
+ circular=False
try:
- parsed = SeqIO.read(handle, "genbank", alphabet=IUPACAmbiguousDNA())
- handle.seek(0)
- parser = RecordParser()
- residue_type = parser.parse(handle).residue_type
- if "circular" in residue_type:
+ parsed = SeqIO.read(handle, "embl", alphabet=IUPACAmbiguousDNA())
+ if "circular" in rawseq.splitlines()[0]:
circular = True
except ValueError:
handle.seek(0)
try:
- parsed = SeqIO.read(handle, "fasta", alphabet=IUPACAmbiguousDNA())
- if "circular" in rawseq.splitlines()[0]:
+ parsed = SeqIO.read(handle, "genbank", alphabet=IUPACAmbiguousDNA())
+ handle.seek(0)
+ parser = RecordParser()
+ residue_type = parser.parse(handle).residue_type
+ if "circular" in residue_type:
circular = True
except ValueError:
- continue
+ handle.seek(0)
+ try:
+ parsed = SeqIO.read(handle, "fasta", alphabet=IUPACAmbiguousDNA())
+ if "circular" in rawseq.splitlines()[0]:
+ circular = True
+ except ValueError:
+ parsed = ""
+ handle.close()
+
+ if ds and path:
+ result_list.append( GenbankFile(parsed, circular=circular, path=path) )
+ elif ds:
+ result_list.append( Dseqrecord(parsed, circular =circular) )
+ else:
+ result_list.append( parsed )
+
+ return result_list
- if ds:
- sequences.append( Dseqrecord(parsed, circular = circular) )
- else:
- sequences.append( parsed )
- handle.close()
- if filenames:
- msg=""
- for fn in filenames:
- msg += "{fn}
".format(fn=fn)
- display(HTML(msg))
+ # a string is an iterable datatype but on Python2.x it doesn't have an __iter__ method.
+ if not hasattr(data, '__iter__') or isinstance(data, (str, bytes)):
+ data = (data,)
+
+ sequences = []
+
+ for item in data:
+ try:
+ # item is a path to a utf-8 encoded text file?
+ with open(item, 'r', encoding="utf-8") as f:
+ raw = f.read()
+ except IOError:
+ # item was not a path, add sequences parsed from item
+ raw=item
+ path=None
+ else:
+ # item was a readable text file, seqences are parsed from the file
+ path = item
+ finally:
+ sequences.extend(embl_gb_fasta(raw, ds, path) )
+
return sequences
- #http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?
- #db=nuccore&
- #id=21614549&
- #strand=1&
- #seq_start=1&
- #seq_stop=100&
- #rettype=gb&
- #retmode=text
-
def parse_primers(data):
return parse(data, ds=False)
def read_primer(data):
return read(data, ds=False)
-
-
if __name__=="__main__":
import doctest
diff --git a/pydna/primer_design.py b/pydna/primer_design.py
index 1893a2e9..187cc3c6 100644
--- a/pydna/primer_design.py
+++ b/pydna/primer_design.py
@@ -292,7 +292,7 @@ def cloning_primers( template,
with open(path, 'a') as f: f.write("\n"+rp.format("fasta").strip())
msg = ("\n"+fp.format("fasta")+"\n"+rp.format("fasta")+"\n").replace('\n', '
')
- display(HTML(msg))
+ #display(HTML(msg))
return fp, rp
def integration_primers( up,
diff --git a/run_test.py b/run_test.py
index b46aa5f7..c400cc16 100755
--- a/run_test.py
+++ b/run_test.py
@@ -53,6 +53,13 @@ def main():
else:
del coveralls
args = ["--cov=pydna", "--cov-report=html", "--cov-report=xml"]
+ try:
+ import nbval
+ except ImportError:
+ print("nbval NOT installed!")
+ else:
+ del nbval
+ args.append("--nbval")
args = [".", "-v", "-s"] + args
cwd = os.getcwd()
diff --git a/tests/.ipynb_checkpoints/jupyter_test_repr-checkpoint.ipynb b/tests/.ipynb_checkpoints/jupyter_test_repr-checkpoint.ipynb
new file mode 100755
index 00000000..0031e19a
--- /dev/null
+++ b/tests/.ipynb_checkpoints/jupyter_test_repr-checkpoint.ipynb
@@ -0,0 +1,881 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# This notebook shows rich jupyter representations of Dseqrecord and derived classes\n",
+ "\n",
+ "* Dseqrecord --> base class\n",
+ "* GenbankRecord(Dseqrecord) --> read from Genbank link\n",
+ "* GenbankFile(Dseqrecord) --> read from local file\n",
+ "* Amplicon(Dseqrecord) --> PCR product\n",
+ "* Contig(Dseqrecord) --> Produced through Assembly "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "import pydna"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "ldsr = pydna.Dseqrecord(\"aaa\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "pydna.dsdna.Dseqrecord"
+ ]
+ },
+ "execution_count": 3,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "type(ldsr)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "Dseqrecord(-3)"
+ ]
+ },
+ "execution_count": 4,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "ldsr"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "cdsr = pydna.Dseqrecord(\"aaa\", circular=True)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "pydna.dsdna.Dseqrecord"
+ ]
+ },
+ "execution_count": 6,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "type(cdsr)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "Dseqrecord(o3)"
+ ]
+ },
+ "execution_count": 7,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "cdsr"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "fromstring = pydna.read(\">string\\naaaa\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "pydna.dsdna.Dseqrecord"
+ ]
+ },
+ "execution_count": 9,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "type(fromstring)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "Dseqrecord(-4)"
+ ]
+ },
+ "execution_count": 10,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "fromstring"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "from pydna.download import GenbankRecord"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "gbr = GenbankRecord(\"aaa\", circular=True)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 13,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ ""
+ ],
+ "text/plain": [
+ "Genbank(-)(o3)"
+ ]
+ },
+ "execution_count": 13,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "gbr"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "gbr = pydna.genbank(\"E05006\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 15,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "E05006"
+ ],
+ "text/plain": [
+ "Genbank(E05006.1)(-25)"
+ ]
+ },
+ "execution_count": 15,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "gbr"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "gbr = pydna.genbank(\"E05006 REGION: 5..15\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 17,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "E05006 5-15"
+ ],
+ "text/plain": [
+ "Genbank(E05006.1)(-11)"
+ ]
+ },
+ "execution_count": 17,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "gbr"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 18,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "gbr = pydna.genbank(\"E05006 REGION: complement(5..15)\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 19,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "E05006 5-15"
+ ],
+ "text/plain": [
+ "Genbank(E05006.1)(-11)"
+ ]
+ },
+ "execution_count": 19,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "gbr"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 20,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "from pydna.dsdna import GenbankFile"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 21,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "gbf=GenbankFile(\"aaa\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 22,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "None
"
+ ],
+ "text/plain": [
+ "File(-)(-3)"
+ ]
+ },
+ "execution_count": 22,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "gbf"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 23,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "gbf = pydna.read(\"sequence.gb\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 24,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "pydna.dsdna.GenbankFile"
+ ]
+ },
+ "execution_count": 24,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "type(gbf)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 25,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "sequence.gb
"
+ ],
+ "text/plain": [
+ "File(E05006.1)(-25)"
+ ]
+ },
+ "execution_count": 25,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "gbf"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 26,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "gbf = pydna.read(\"subfolder/sequence.gb\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 27,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "pydna.dsdna.GenbankFile"
+ ]
+ },
+ "execution_count": 27,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "type(gbf)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 28,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "subfolder/sequence.gb
"
+ ],
+ "text/plain": [
+ "File(E05006.1)(-25)"
+ ]
+ },
+ "execution_count": 28,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "gbf"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 29,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "from pydna.amplify import Amplicon"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 30,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "amp = Amplicon(\"aaa\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 31,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "pydna.amplify.Amplicon"
+ ]
+ },
+ "execution_count": 31,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "type(amp)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 32,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "Amplicon(3)"
+ ],
+ "text/plain": [
+ "Amplicon(3)"
+ ]
+ },
+ "execution_count": 32,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "amp"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 33,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "import pydna\n",
+ "primers = pydna.parse_primers('''>ForwardPrimer\n",
+ "gctactacacacgtactgactg\n",
+ ">ReversePrimer\n",
+ "tgtggttactgactctatcttg ''')\n",
+ "temp = pydna.Dseqrecord(\"gctactacacacgtactgactgcctccaagatagagtcagtaaccaca\")\n",
+ "prd = pydna.pcr(primers, temp)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 34,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "pydna.amplify.Amplicon"
+ ]
+ },
+ "execution_count": 34,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "type(prd)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 35,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "Amplicon(48)"
+ ],
+ "text/plain": [
+ "Amplicon(48)"
+ ]
+ },
+ "execution_count": 35,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "prd"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 36,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "5gctactacacacgtactgactg...caagatagagtcagtaaccaca3\n",
+ " |||||||||||||||||||||| tm 54.6 (dbd) 57.7\n",
+ " 3gttctatctcagtcattggtgt5\n",
+ "5gctactacacacgtactgactg3\n",
+ " |||||||||||||||||||||| tm 57.9 (dbd) 58.3\n",
+ "3cgatgatgtgtgcatgactgac...gttctatctcagtcattggtgt5"
+ ]
+ },
+ "execution_count": 36,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "prd.figure()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 37,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "(Amplicon(48), Amplicon(48))"
+ ]
+ },
+ "execution_count": 37,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "(prd, prd)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 38,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "from pydna.assembly import Contig"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 39,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "cnt = Contig(\"aaa\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 40,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "pydna.assembly.Contig"
+ ]
+ },
+ "execution_count": 40,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "type(cnt)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 41,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "a = pydna.Dseqrecord(\"acgatgctatactgCCCCCtgtgctgtgctcta\", name=\"SequenceA\")\n",
+ "b = pydna.Dseqrecord(\"tgtgctgtgctctaTTTTTtattctggctgtatc\", name=\"SequenceB\")\n",
+ "c = pydna.Dseqrecord(\"tattctggctgtatcGGGGGtacgatgctatact\", name=\"SequenceC\")\n",
+ "x = pydna.Assembly((a,b,c), limit=13)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 42,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "Assembly:\n",
+ "Sequences........................: [33] [34] [34]\n",
+ "Sequences with shared homologies.: [33] [34] [34]\n",
+ "Homology limit (bp)..............: 13\n",
+ "Number of overlaps...............: 3\n",
+ "Nodes in graph(incl. 5' & 3')....: 5\n",
+ "Only terminal overlaps...........: No\n",
+ "Circular products................: [59]\n",
+ "Linear products..................: [74] [73] [72] [54] [53] [53] [15] [14] [13]"
+ ]
+ },
+ "execution_count": 42,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "x"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 43,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "cnt = x.circular_products[0]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 44,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "pydna.assembly.Contig"
+ ]
+ },
+ "execution_count": 44,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "type(cnt)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 45,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ " -|SequenceA|14\n",
+ "| \\/\n",
+ "| /\\\n",
+ "| 14|SequenceB|15\n",
+ "| \\/\n",
+ "| /\\\n",
+ "| 15|SequenceC|13\n",
+ "| \\/\n",
+ "| /\\\n",
+ "| 13-\n",
+ "| |\n",
+ " -----------------------------------------
"
+ ],
+ "text/plain": [
+ "Contig(o59)"
+ ]
+ },
+ "execution_count": 45,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "cnt"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "kernelspec": {
+ "display_name": "Python 3",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.5.2"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
diff --git a/tests/jupyter_test_repr.ipynb b/tests/jupyter_test_repr.ipynb
new file mode 100755
index 00000000..0031e19a
--- /dev/null
+++ b/tests/jupyter_test_repr.ipynb
@@ -0,0 +1,881 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# This notebook shows rich jupyter representations of Dseqrecord and derived classes\n",
+ "\n",
+ "* Dseqrecord --> base class\n",
+ "* GenbankRecord(Dseqrecord) --> read from Genbank link\n",
+ "* GenbankFile(Dseqrecord) --> read from local file\n",
+ "* Amplicon(Dseqrecord) --> PCR product\n",
+ "* Contig(Dseqrecord) --> Produced through Assembly "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "import pydna"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "ldsr = pydna.Dseqrecord(\"aaa\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "pydna.dsdna.Dseqrecord"
+ ]
+ },
+ "execution_count": 3,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "type(ldsr)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "Dseqrecord(-3)"
+ ]
+ },
+ "execution_count": 4,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "ldsr"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "cdsr = pydna.Dseqrecord(\"aaa\", circular=True)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "pydna.dsdna.Dseqrecord"
+ ]
+ },
+ "execution_count": 6,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "type(cdsr)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "Dseqrecord(o3)"
+ ]
+ },
+ "execution_count": 7,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "cdsr"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "fromstring = pydna.read(\">string\\naaaa\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "pydna.dsdna.Dseqrecord"
+ ]
+ },
+ "execution_count": 9,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "type(fromstring)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "Dseqrecord(-4)"
+ ]
+ },
+ "execution_count": 10,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "fromstring"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "from pydna.download import GenbankRecord"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "gbr = GenbankRecord(\"aaa\", circular=True)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 13,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ ""
+ ],
+ "text/plain": [
+ "Genbank(-)(o3)"
+ ]
+ },
+ "execution_count": 13,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "gbr"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "gbr = pydna.genbank(\"E05006\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 15,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "E05006"
+ ],
+ "text/plain": [
+ "Genbank(E05006.1)(-25)"
+ ]
+ },
+ "execution_count": 15,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "gbr"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "gbr = pydna.genbank(\"E05006 REGION: 5..15\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 17,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "E05006 5-15"
+ ],
+ "text/plain": [
+ "Genbank(E05006.1)(-11)"
+ ]
+ },
+ "execution_count": 17,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "gbr"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 18,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "gbr = pydna.genbank(\"E05006 REGION: complement(5..15)\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 19,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "E05006 5-15"
+ ],
+ "text/plain": [
+ "Genbank(E05006.1)(-11)"
+ ]
+ },
+ "execution_count": 19,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "gbr"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 20,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "from pydna.dsdna import GenbankFile"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 21,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "gbf=GenbankFile(\"aaa\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 22,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "None
"
+ ],
+ "text/plain": [
+ "File(-)(-3)"
+ ]
+ },
+ "execution_count": 22,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "gbf"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 23,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "gbf = pydna.read(\"sequence.gb\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 24,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "pydna.dsdna.GenbankFile"
+ ]
+ },
+ "execution_count": 24,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "type(gbf)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 25,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "sequence.gb
"
+ ],
+ "text/plain": [
+ "File(E05006.1)(-25)"
+ ]
+ },
+ "execution_count": 25,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "gbf"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 26,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "gbf = pydna.read(\"subfolder/sequence.gb\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 27,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "pydna.dsdna.GenbankFile"
+ ]
+ },
+ "execution_count": 27,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "type(gbf)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 28,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "subfolder/sequence.gb
"
+ ],
+ "text/plain": [
+ "File(E05006.1)(-25)"
+ ]
+ },
+ "execution_count": 28,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "gbf"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 29,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "from pydna.amplify import Amplicon"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 30,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "amp = Amplicon(\"aaa\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 31,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "pydna.amplify.Amplicon"
+ ]
+ },
+ "execution_count": 31,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "type(amp)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 32,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "Amplicon(3)"
+ ],
+ "text/plain": [
+ "Amplicon(3)"
+ ]
+ },
+ "execution_count": 32,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "amp"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 33,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "import pydna\n",
+ "primers = pydna.parse_primers('''>ForwardPrimer\n",
+ "gctactacacacgtactgactg\n",
+ ">ReversePrimer\n",
+ "tgtggttactgactctatcttg ''')\n",
+ "temp = pydna.Dseqrecord(\"gctactacacacgtactgactgcctccaagatagagtcagtaaccaca\")\n",
+ "prd = pydna.pcr(primers, temp)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 34,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "pydna.amplify.Amplicon"
+ ]
+ },
+ "execution_count": 34,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "type(prd)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 35,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "Amplicon(48)"
+ ],
+ "text/plain": [
+ "Amplicon(48)"
+ ]
+ },
+ "execution_count": 35,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "prd"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 36,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "5gctactacacacgtactgactg...caagatagagtcagtaaccaca3\n",
+ " |||||||||||||||||||||| tm 54.6 (dbd) 57.7\n",
+ " 3gttctatctcagtcattggtgt5\n",
+ "5gctactacacacgtactgactg3\n",
+ " |||||||||||||||||||||| tm 57.9 (dbd) 58.3\n",
+ "3cgatgatgtgtgcatgactgac...gttctatctcagtcattggtgt5"
+ ]
+ },
+ "execution_count": 36,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "prd.figure()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 37,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "(Amplicon(48), Amplicon(48))"
+ ]
+ },
+ "execution_count": 37,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "(prd, prd)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 38,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "from pydna.assembly import Contig"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 39,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "cnt = Contig(\"aaa\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 40,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "pydna.assembly.Contig"
+ ]
+ },
+ "execution_count": 40,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "type(cnt)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 41,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "a = pydna.Dseqrecord(\"acgatgctatactgCCCCCtgtgctgtgctcta\", name=\"SequenceA\")\n",
+ "b = pydna.Dseqrecord(\"tgtgctgtgctctaTTTTTtattctggctgtatc\", name=\"SequenceB\")\n",
+ "c = pydna.Dseqrecord(\"tattctggctgtatcGGGGGtacgatgctatact\", name=\"SequenceC\")\n",
+ "x = pydna.Assembly((a,b,c), limit=13)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 42,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "Assembly:\n",
+ "Sequences........................: [33] [34] [34]\n",
+ "Sequences with shared homologies.: [33] [34] [34]\n",
+ "Homology limit (bp)..............: 13\n",
+ "Number of overlaps...............: 3\n",
+ "Nodes in graph(incl. 5' & 3')....: 5\n",
+ "Only terminal overlaps...........: No\n",
+ "Circular products................: [59]\n",
+ "Linear products..................: [74] [73] [72] [54] [53] [53] [15] [14] [13]"
+ ]
+ },
+ "execution_count": 42,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "x"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 43,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "cnt = x.circular_products[0]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 44,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "pydna.assembly.Contig"
+ ]
+ },
+ "execution_count": 44,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "type(cnt)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 45,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ " -|SequenceA|14\n",
+ "| \\/\n",
+ "| /\\\n",
+ "| 14|SequenceB|15\n",
+ "| \\/\n",
+ "| /\\\n",
+ "| 15|SequenceC|13\n",
+ "| \\/\n",
+ "| /\\\n",
+ "| 13-\n",
+ "| |\n",
+ " -----------------------------------------
"
+ ],
+ "text/plain": [
+ "Contig(o59)"
+ ]
+ },
+ "execution_count": 45,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "cnt"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "kernelspec": {
+ "display_name": "Python 3",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.5.2"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
diff --git a/tests/sequence.gb b/tests/sequence.gb
new file mode 100644
index 00000000..aa100f84
--- /dev/null
+++ b/tests/sequence.gb
@@ -0,0 +1,41 @@
+LOCUS E05006 25 bp DNA linear PAT 04-NOV-2005
+DEFINITION PCR primer to generate NcoI and SphI site adjacent to T7 promoter
+ on pGEMEX2.
+ACCESSION E05006
+VERSION E05006.1
+KEYWORDS JP 1993105699-A/1.
+SOURCE synthetic construct
+ ORGANISM synthetic construct
+ other sequences; artificial sequences.
+REFERENCE 1 (bases 1 to 25)
+ AUTHORS Mori,T., Takada,T., Koike,K. and Sugano,H.
+ TITLE PRODUCTION OF B TYPE HEPATITIS VIRUS X PROTEIN AND DIAGNOSTIC AGENT
+ USING THE SAME
+ JOURNAL Patent: JP 1993105699-A 1 27-APR-1993;
+ JAPAN FOUND CANCER RES, MEIJI MILK PROD CO LTD
+COMMENT OS Artificial gene
+ OC Artificial sequence; Genes.
+ PN JP 1993105699-A/1
+ PD 27-APR-1993
+ PF 07-AUG-1991 JP 1991198008
+ PI MORI TAKESHI, TAKADA TOMOKO, KOIKE KATSURO, SUGANO HARUO PC
+ C07K15/04,A61K39/29,C12N15/51,C12P21/02,G01N33/53,G01N33/569, PC
+ G01N33/576,
+ PC (C12P21/02,C12R1:19);
+ CC strandedness: Double;
+ CC topology: Linear;
+ FH Key Location/Qualifiers
+ FH
+ FT misc_feature 1..25
+ FT /note='PCR primer to generate NcoI and SphI
+ FT site adjacent
+ FT to T7 promoter on pGEMEX2'.
+FEATURES Location/Qualifiers
+ source 1..25
+ /organism="synthetic construct"
+ /mol_type="unassigned DNA"
+ /db_xref="taxon:32630"
+ORIGIN
+ 1 atatgggtac cgatcgtacg gacca
+//
+
diff --git a/tests/subfolder/sequence.gb b/tests/subfolder/sequence.gb
new file mode 100644
index 00000000..aa100f84
--- /dev/null
+++ b/tests/subfolder/sequence.gb
@@ -0,0 +1,41 @@
+LOCUS E05006 25 bp DNA linear PAT 04-NOV-2005
+DEFINITION PCR primer to generate NcoI and SphI site adjacent to T7 promoter
+ on pGEMEX2.
+ACCESSION E05006
+VERSION E05006.1
+KEYWORDS JP 1993105699-A/1.
+SOURCE synthetic construct
+ ORGANISM synthetic construct
+ other sequences; artificial sequences.
+REFERENCE 1 (bases 1 to 25)
+ AUTHORS Mori,T., Takada,T., Koike,K. and Sugano,H.
+ TITLE PRODUCTION OF B TYPE HEPATITIS VIRUS X PROTEIN AND DIAGNOSTIC AGENT
+ USING THE SAME
+ JOURNAL Patent: JP 1993105699-A 1 27-APR-1993;
+ JAPAN FOUND CANCER RES, MEIJI MILK PROD CO LTD
+COMMENT OS Artificial gene
+ OC Artificial sequence; Genes.
+ PN JP 1993105699-A/1
+ PD 27-APR-1993
+ PF 07-AUG-1991 JP 1991198008
+ PI MORI TAKESHI, TAKADA TOMOKO, KOIKE KATSURO, SUGANO HARUO PC
+ C07K15/04,A61K39/29,C12N15/51,C12P21/02,G01N33/53,G01N33/569, PC
+ G01N33/576,
+ PC (C12P21/02,C12R1:19);
+ CC strandedness: Double;
+ CC topology: Linear;
+ FH Key Location/Qualifiers
+ FH
+ FT misc_feature 1..25
+ FT /note='PCR primer to generate NcoI and SphI
+ FT site adjacent
+ FT to T7 promoter on pGEMEX2'.
+FEATURES Location/Qualifiers
+ source 1..25
+ /organism="synthetic construct"
+ /mol_type="unassigned DNA"
+ /db_xref="taxon:32630"
+ORIGIN
+ 1 atatgggtac cgatcgtacg gacca
+//
+
diff --git a/tests/test_assemble_pGUP1.py b/tests/test_assemble_pGUP1.py
index 630de582..dd995cad 100644
--- a/tests/test_assemble_pGUP1.py
+++ b/tests/test_assemble_pGUP1.py
@@ -4,10 +4,9 @@
test pGUP1
'''
import pytest
-import sys
import pydna
-def test_empty():
+def test_assemble_pGUP1():
''' test pGUP1'''
GUP1rec1sens = pydna.read("GUP1rec1sens.txt")
@@ -36,4 +35,4 @@ def test_empty():
assert pGUP1.seguid() == "42wIByERn2kSe_Exn405RYwhffU"
if __name__ == '__main__':
- pytest.cmdline.main([__file__, "-v", "-s"])
+ pytest.cmdline.main([__file__, "-v", "-s"])
\ No newline at end of file
diff --git a/tests/test_download.py b/tests/test_download.py
index 0968eed1..3ab38078 100644
--- a/tests/test_download.py
+++ b/tests/test_download.py
@@ -2,7 +2,6 @@
# -*- coding: utf-8 -*-
import os
-import sys
import pytest
import pydna