Next version will be a Python 3 release

19 views
Skip to first unread message

Björn Johansson

unread,
Jul 21, 2016, 1:58:24 PM7/21/16
to pydna
Hi all,

I know I havent written here for a long time, I have mostly interacted with pydna users through the issues on 
Github. 

I have decided that the next release will be a python 3 release. I have never had much motivation to do the switch from 
2 to 3 before. When I first thought of it, some of the important libraries were not available for python 3. However, recently 
some projects that make pydna useful such as IPython and Jupyter have announced that they will soon stop supporting 
python 2. 

I have also started teaching with python and python 3 is much more pedagogic for beginners, mostly I think due to the
division and also consistency (print is a function). I also received a request for python 3 support from githubber Brian Naughton 
who also basically did the job for me (Thanks!). 

The old python 2 code will still be there in a branch called py2. The new python 3 development branch will be called py3.
The plan is to only pull changes to the master branch for releases in the future to have a more gitflow like procedure.

Another important change is the option of putting often used data in a ini file. This file is called pydna.ini and is located 
wherever appdirs decides is the right place for each OS (the appdirs function user_config_dir is used).

my file looks like this:

[main]
email =    bjXX...@gmail.com
data_dir = /home/bjorn/.local/share/pydna
log_dir =  /home/bjorn/.cache/pydna/log
cache =    cached
ape =      tclsh /home/bjorn/.ApE/apeextractor/ApE.vfs/lib/app-AppMain/AppMain.tcl
primers =  /home/bjorn/Dropbox/wikidata/Primers.wiki

the file is read using the configparser module. 

The purpose of the email address is to let NCBI know who is using their service. The pydna.genbank function can be used directly if the email has been set in pydna.ini:

pydna.genbank( "L09137" ) 


will download the pUC19 vector. The old pydna.Genbank class with the nucleotide method remains.

You can set the locations of data_dir and log_dir.

The ape variable holds a command to start the plasmid editor ape from the terminal. this can be used to open
a sequence in ape.

finally, primers is a path to a text file that contains sequences in FASTA or Genbank formats. 
I keep my primer list in such a file where each primer is identified by a number.

see below for examples

(bjorn3) bjorn@bjorn-ThinkPad-T450s:~$ ipython
Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul  2 2016, 17:53:06) 
Type "copyright", "credits" or "license" for more information.

IPython 5.0.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import pydna

In [2]: puc = pydna.genbank("L09137")

In [3]: puc
Out[3]: Dseqrecord(o2686)

In [4]: from pydna.editor import ape

In [5]: ape(puc) # opens puc in an ape window

In [6]: from pydna import myprimers

In [7]: p15 = myprimers.p015

In [8]: p15
Out[8]: SeqRecord(seq=Seq('GATAAATACTCTCTGGAAGCAGACG', IUPACAmbiguousDNA()), id='15_D-CYC1', name='15_D-CYC1', description='15_D-CYC1', dbxrefs=[])

In [9]: p16 = myprimers.primer_l
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-9-e42d2511fc36> in <module>()
----> 1 p16 = myprimers.primer_l

AttributeError: module 'pydna.myprimers' has no attribute 'primer_l'

In [10]: p16 = myprimers.primer_list[15]

In [11]: p16
Out[11]: SeqRecord(seq=Seq('GATAAATACTCTCTGGAAGCAGACG', IUPACAmbiguousDNA()), id='15_D-CYC1', name='15_D-CYC1', description='15_D-CYC1', dbxrefs=[])

In [12]: 

There will also be som bugfixes to the gel module to make it more useful.

/bjorn

.
 






 
Reply all
Reply to author
Forward
0 new messages