[med-svn] [perlprimer] 06/12: New upstream version 1.2.3

Charles Plessy plessy at moszumanska.debian.org
Sun Jan 22 14:25:56 UTC 2017


This is an automated email from the git hooks/post-receive script.

plessy pushed a commit to branch master
in repository perlprimer.

commit 00b28bafc03f1141f6abfb03883b47b301f09b48
Author: Charles Plessy <plessy at debian.org>
Date:   Sun Jan 22 17:32:44 2017 +0900

    New upstream version 1.2.3
---
 Changelog                   |  12 ++
 LICENSE                     | 339 ++++++++++++++++++++++++++++++++++++++++++++
 README.md                   |  23 +++
 ReadMe                      |  85 -----------
 ReadMe.txt                  |  91 ------------
 perlprimer.pl => perlprimer | 302 +++++++++++++++++++++++----------------
 todo                        |  11 --
 7 files changed, 554 insertions(+), 309 deletions(-)

diff --git a/Changelog b/Changelog
index 2f13c95..0434975 100644
--- a/Changelog
+++ b/Changelog
@@ -1,3 +1,15 @@
+22/1/17  (PerlPrimer-1.2.3)
+- Added the option of using Onodera and Melcher (2004) rules for the 3' GC clamp.  This option is not currently enabled by default, but can be selected in the prefs "Exclusions" tab
+
+21/1/17  (PerlPrimer-1.2.2)
+- Added a "-1" button to the range options: use "Set from ORF" and then "-1" to only find primers that cover the entire ORF.
+
+20/1/17  (PerlPrimer-1.2.1)
+- Added a name column when copying primers (the name is built from the gene name, the coordinates of the primer and the direction).
+
+16/1/17  (PerlPrimer-1.2)
+- Re-wrote Ensembl routines to use the Ensembl REST API (a much more elegant solution -- thanks to Ensembl for developing this).  Ensembl compatibility should never break again. (Some code tidying still needs to be done to remove some redundancies, but the code is fully functional.  Please note that Ensembl REST sadly provides no fuzzy searching for genes: the correct gene name or Ensembl ID must be used.)
+
 17/2/11  (PerlPrimer-1.1.20)
 - Fixed Ensembl compatibility
 - Fixed small error in Tm calculation code (thanks to Henning Lenz for pointing this out)
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..23cb790
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,339 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                            NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    {description}
+    Copyright (C) {year}  {fullname}
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License along
+    with this program; if not, write to the Free Software Foundation, Inc.,
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  {signature of Ty Coon}, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..8a30d30
--- /dev/null
+++ b/README.md
@@ -0,0 +1,23 @@
+# PerlPrimer
+
+PerlPrimer is a free, open-source GUI application written in Perl that designs primers for standard PCR, bisulphite PCR, real-time PCR (QPCR) and sequencing. It aims to automate and simplify the process of primer design.
+
+PerlPrimer's current features include the following:
+
+* Calculation of possible primer-dimers
+* Retrieval of genomic or cdna sequences from Ensembl (including both sequences automatically for QPCR)
+* Ability to BLAST search primers using the NCBI server or a local server
+* Results can be saved or optionally exported in a tab-delimited format that is compatible with most spreadsheet applications.
+* ORF and CpG island detection algorithms
+* Ability to add cloning sequences to primers, automatically adjusted to be in-frame
+* QPCR primer design without manual intron-exon boundary entry 
+
+PerlPrimer calculates primer melting temperature using J. SantaLucia's extensive nearest-neighbour thermodynamic parameters. To adjust for the salt conditions of the PCR, PerlPrimer uses the empirical formula derived by von Ahsen, et al. (2001) and allows the user to specify the concentration of Mg2+, dNTPs and primers, or use standard PCR conditions. The result is a highly accurate prediction of primer melting temperature, giving rise to a maximum yield of product when amplified.
+
+PerlPrimer is written in Perl and Perl/Tk. In addition, for QPCR functionality PerlPrimer uses the open-source Spidey executable from NCBI, and restriction enzyme data from the REBASE project is used when adding cloning sites. The program is designed to be cross-platform compatible and has been developed and tested on both Microsoft Windows and GNU/Linux-based operating systems. Users have also reported success using the program under Mac OS X.
+
+Please cite the reference below if this program is useful.
+
+    Marshall OJ. PerlPrimer: cross-platform, graphical primer design for standard, bisulphite and real-time PCR. Bioinformatics 2004 20(15):2471-2472 [Pubmed]
+
+
diff --git a/ReadMe b/ReadMe
deleted file mode 100644
index 8c17be7..0000000
--- a/ReadMe
+++ /dev/null
@@ -1,85 +0,0 @@
-PerlPrimer
-----------
-
-Copyright � 2003-2006, Owen Marshall (owenjm at users.sourceforge.net)
-
-
-Contents
---------
-
-1. Introduction
-2. Installation / Using the program
-3. Links to external programs
-4. Suggestions/patches/bugs/support
-
-
-1. Introduction
----------------
-
-Perlprimer is a GUI application that designs primers for standard PCR, bisulphite PCR, Real-time PCR (QPCR) and sequencing.
-
-Perlprimer's current features include the following:
-
-* Calculation of possible primer-dimers
-* Retrieval of genomic or cdna sequences from Ensembl (including both sequences automatically for QPCR)
-* Ability to BLAST search primers using the NCBI server
-* Results can be saved or optionally exported in a tab-delimited format that is compatible with most spreadsheet applications.
-* ORF and CpG island detection algorithms
-* Ability to add cloning sequences to primers, automatically adjusted to be in-frame
-* QPCR primer design without manual intron-exon boundary entry
-
-Perlprimer calculates primer melting temperature using J. SantaLucia's extensive nearest-neighbour thermodynamic parameters.  To adjust for the salt conditions of the PCR, PerlPrimer uses the empirical formula derived by von Ahsen, et al. (2001) and allows the user to specify the concentration of Mg2+, dNTPs and primers, or use default, standard, PCR conditions. The result is a highly accurate prediction of primer melting temperature, giving rise to a maximum yeild of product when amplified.
-
-Perlprimer is written in Perl and requires Perl/Tk.  In addition, for QPCR functionality perlprimer requires the open-source Spidey executable from NCBI.  The program is designed to be cross-platform and has been tested on both Microsoft Windows and GNU/Linux-based operating systems.  Users have also had success using the program under Mac OS X.
-
-
-2. Installation / Using the program
------------------------------------
-
-PerlPrimer requires Perl and Perl/Tk.  These should be provided by your distribution if using a UNIX-based operating system; if using Windows I recommend using ActiveState's distribution of Perl 5.8, which includes Perl/Tk, freely available from
-
-	http://www.activestate.com/Products/ActivePerl/
-
-After installing ActivePerl under Windows, the file "perlprimer.pl" should run if double-clicked.
-
-PerlPrimer can also be started from the commandline, and this would be the normal mode of operation for UNIX-based OSes (including Mac OS X):
-
-	$ perl perlprimer.pl [file to open]
-
-(the file to open parameter is optional)
-
-
-Users under UNIX-based OSes may need to install Perl/Tk manually if it is not included in your distribution.  Perl/Tk can be downloaded from 
-
-	http://search.cpan.org/~ni-s/Tk/
-
-and can be installed by following the instructions included in the archive.  Users may also need the Perl modules HTTP::Request and LWP::UserAgent for BLAST searching and gene retieval from Ensembl; these are part of libwww-perl-5.76 which can be found at
-
-	http://search.cpan.org/~gaas/libwww-perl-5.76/
-
-In addition to installing Perl/Tk (and libwww-perl if required), Mac OS X users will generally require OS 10.3 (Panther) or later and an X-server.  (Please note that as I do not have access to a Mac OS X system I cannot guarantee compatibility, although I will try to fix any issues that are reported).
-
-
-Using PerlPrimer should be fairly self-explanatory, with extensive "balloon help" (turned on by default) and a separate help window detailing the operation of the graphical display of the DNA sequence, selection ranges and primers.
-
-
-3. Links to external programs
------------------------------
-
-For Real-time PCR (QPCR) functionality, PerlPrimer uses the program Spidey, released freely by the NCBI, to calculate intron/exon boundaries.  This may be obtained from
-
-	http://www.ncbi.nlm.nih.gov/spidey/
-
-The program by default expects the spidey executable to be in your home directory on UNIX-based systems, or at C:\Spidey.exe for Windows.  The location may be changed in the preferences window.
-
-
-4.  Suggestions/patches/bugs/support
-------------------------------------
-
-The latest release of PerlPrimer can be obtained from
-	
-	http://perlprimer.sourceforge.net/
-
-Please check the lastest version before reporting bugs.
-
-Bugs, feature suggestions and support requests can be placed on the web forums provided at the above address, or alternatively by emailing me directly.
diff --git a/ReadMe.txt b/ReadMe.txt
deleted file mode 100644
index f37ecc9..0000000
--- a/ReadMe.txt
+++ /dev/null
@@ -1,91 +0,0 @@
-PerlPrimer
-----------
-
-Copyright � 2003-2006, Owen Marshall (owenjm at users.sourceforge.net)
-
-
-Contents
---------
-
-1. Introduction
-2. Installation / Using the program
-3. Links to external programs
-4. Suggestions/patches/bugs/support
-
-
-1. Introduction
----------------
-
-Perlprimer is a GUI application that designs primers for standard PCR, bisulphite PCR, Real-time PCR (QPCR) and sequencing.
-
-Perlprimer's current features include the following:
-
-* Calculation of possible primer-dimers
-* Retrieval of genomic or cdna sequences from Ensembl (including both sequences automatically for QPCR)
-* Ability to BLAST search primers using either the NCBI server or a local server
-* Results can be saved or optionally exported in a tab-delimited format that is compatible with most spreadsheet applications.
-* ORF and CpG island detection algorithms
-* Ability to add cloning sequences to primers, automatically adjusted to be in-frame
-* QPCR primer design without manual intron-exon boundary entry
-
-Perlprimer calculates primer melting temperature using J. SantaLucia's extensive nearest-neighbour thermodynamic parameters.  To adjust for the salt conditions of the PCR, PerlPrimer uses the empirical formula derived by von Ahsen, et al. (2001) and allows the user to specify the concentration of Mg2+, dNTPs and primers, or use default, standard, PCR conditions. The result is a highly accurate prediction of primer melting temperature, giving rise to a maximum yeild of product when amplified.
-
-Perlprimer is written in Perl and requires Perl/Tk.  In addition, for QPCR functionality perlprimer requires the open-source Spidey executable from NCBI.  The program is designed to be cross-platform and has been tested on both Microsoft Windows and GNU/Linux-based operating systems.  Users have also had success using the program under Mac OS X.
-
-Restriction enzyme data is provided by the REBASE project (http://rebase.neb.com/)
-
-
-2. Installation / Using the program
------------------------------------
-
-PerlPrimer requires Perl and Perl/Tk.  These should be provided by your distribution if using a UNIX-based operating system; if using Windows I recommend using ActiveState's distribution of Perl 5.8, which includes Perl/Tk, freely available from
-
-	http://www.activestate.com/Products/ActivePerl/
-
-After installing ActivePerl under Windows, the file "perlprimer.pl" should run if double-clicked.
-
-PerlPrimer can also be started from the commandline, and this would be the normal mode of operation for UNIX-based OSes (including Mac OS X):
-
-	$ perl perlprimer.pl [file to open]
-
-(the file to open parameter is optional)
-
-
-Users under UNIX-based OSes may need to install Perl/Tk manually if it is not included in your distribution.  Perl/Tk can be downloaded from 
-
-	http://search.cpan.org/~ni-s/Tk/
-
-and can be installed by following the instructions included in the archive.  Users may also need the Perl modules HTTP::Request and LWP::UserAgent for BLAST searching and gene retieval from Ensembl; these are part of libwww-perl-5.76 which can be found at
-
-	http://search.cpan.org/~gaas/libwww-perl-5.76/
-
-In addition to installing Perl/Tk (and libwww-perl if required), Mac OS X users will generally require OS 10.3 (Panther) or later and an X-server.  (Please note that as I do not have access to a Mac OS X system I cannot guarantee compatibility, although I will try to fix any issues that are reported).
-
-
-Using PerlPrimer should be fairly self-explanatory, with extensive "balloon help" (turned on by default) and a separate help window detailing the operation of the graphical display of the DNA sequence, selection ranges and primers. A tutorial is provided with this distribution, and is also available at
-
-	http://perlprimer.sourceforge.net/tutorial.html
-
-which covers the most commonly used features of the program.
-
-
-3. Links to external programs
------------------------------
-
-For Real-time PCR (QPCR) functionality, PerlPrimer uses the program Spidey, released freely by the NCBI, to calculate intron/exon boundaries.  This may be obtained from
-
-	http://www.ncbi.nlm.nih.gov/spidey/
-
-The program by default expects the spidey executable to be in your home directory on UNIX-based systems, or at C:\Spidey.exe for Windows.  The location may be changed in the preferences window.
-
-
-4.  Suggestions/patches/bugs/support
-------------------------------------
-
-The latest release of PerlPrimer can be obtained from
-	
-	http://perlprimer.sourceforge.net/
-
-Please check the lastest version before reporting bugs.
-
-Bugs, feature suggestions and support requests can be placed on the web forums provided at the above address, or alternatively by emailing me directly.
diff --git a/perlprimer.pl b/perlprimer
old mode 100644
new mode 100755
similarity index 98%
rename from perlprimer.pl
rename to perlprimer
index 83f7872..1efbee3
--- a/perlprimer.pl
+++ b/perlprimer
@@ -3,8 +3,7 @@
 # PerlPrimer
 # Designs primers for PCR, Bisulphite PCR, QPCR (Realtime), and Sequencing
 
-# version 1.1.21 (21 Nov 2011) 
-# Copyright � 2003-2011, Owen Marshall
+# Copyright � 2003-2017, Owen Marshall
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -29,7 +28,7 @@ use strict;
 
 my ($version, $commandline, $win_exe);
 BEGIN {
-	$version = "1.1.21";
+	$version = "1.2.3";
 	$win_exe = 0;
 	
 	($commandline) = @ARGV;
@@ -39,7 +38,7 @@ BEGIN {
 PerlPrimer v$version
 Designs primers for PCR, Bisulphite PCR, QPCR (Realtime), and Sequencing
 
-Copyright � 2003-2011 Owen Marshall\n
+Copyright � 2003-2017 Owen Marshall\n
 Usage: perlprimer.pl [file.ppr]\n
 EOT
 		exit 0;
@@ -49,7 +48,7 @@ EOT
 	if ($win_exe) {
 		print <<EOT;
 PerlPrimer v$version 
-Copyright � 2003-2011 Owen Marshall
+Copyright � 2003-2017 Owen Marshall
 Designs primers for PCR, Bisulphite PCR, QPCR (Realtime), and Sequencing
 
 This window is required for PerlPrimer to run - 
@@ -113,6 +112,9 @@ use IO::Socket;
 use Win32::GUI();
 use File::Copy;
 use File::Glob ':glob';
+use HTTP::Tiny;
+use JSON;
+use File::Basename;
 require Tk::NoteBook;
 require Tk::HList;
 require Tk::ItemStyle;
@@ -321,6 +323,7 @@ my $bs=0;
 my $qpcr_flag=0;
 my $cancel=0;
 my $defer_to_caps=0;
+my $onodera_clamp=0;
 
 # benchmarking - for code optimisation
 my $benchmark=0;
@@ -456,7 +459,7 @@ Schizosaccharomyces_pombe");
 my @ensembl_types = split("\n",
 "genomic
 cdna
-coding
+cds
 utr5
 utr3");
 
@@ -771,6 +774,7 @@ my %pref_variables = (
 	repeats_bs => \$repeat_bs,
 	runs_bs => \$run_bs,
 	exclude_rr_bs => \$exclude_rr_bs,
+	onodera_clamp => \$onodera_clamp,
 	max_gc => \$max_gc,
 	min_gc => \$min_gc,
 	mg_conc => \$mg_conc,
@@ -920,6 +924,7 @@ read_prefs();
 my %balloonmsg = (
 	'primer_getgene', "Find the longest ORF within the sequence and set the selected range",
 	'primer_reset', "Reset the range to the ORF boundaries",
+	'primer_stepin_1', "Reduce the inner range by 1bp on each side",
 	'primer_stepin', "Reduce the inner range by 10bp on each side",
 	'primer_stepout', "Increase the outer range by 10bp on each side",
 	'exclude_gc', "Exclude primers with a GC content outside the range specified in the preferences\n(default is 40-60% GC)",
@@ -1466,7 +1471,8 @@ pack_gui('LabFrame', 'Amplified range', 'primer_range_l', \$page_primer_designf)
 		pack_gui('Label', 'bases');
 	nr('', 0);
   		pack_gui('Button', 'Set from ORF', 'primer_getgene', \&reset_bounds);
-		pack_gui('Button', '-10', 'primer_stepin', \&step_in);
+		pack_gui('Button', '-1', 'primer_stepin_1', sub{step_in(1)});
+		pack_gui('Button', '-10', 'primer_stepin', sub{step_in(10)});
 		pack_gui('Button', '+10', 'primer_stepout', \&step_out);
 	
 pack_gui('LabFrame', 'Options', 'primer_options_l', \$page_primer_designf);
@@ -1632,7 +1638,8 @@ pack_gui('LabFrame', 'Amplified range', 'bisul_range_l', \$page_bisul_seqf);
 		pack_gui('Label', 'bases');
 	nr('', 0);
   		pack_gui('Button', 'Set from CpG island', 'bisul_getcpg', \&reset_bounds);
-		pack_gui('Button', '-10', 'primer_stepin', \&step_in);
+		pack_gui('Button', '-1', 'primer_stepin_1', sub{step_in(1)});
+		pack_gui('Button', '-10', 'primer_stepin', sub{step_in(10)});
 		pack_gui('Button', '+10', 'primer_stepout', \&step_out);
 
 pack_gui('LabFrame', 'Options', 'bisul_options_l', \$page_bisul_seqf);
@@ -2421,9 +2428,14 @@ sub primer_window {
 			}
 			
 			if ($exclude_clamp) {
-				# calculate GC clamp at 5' end: two out of last three residues required...
-				my $gc_clamp=gc(substr($currwindow, -3, 3));
-				next unless $gc_clamp > 50;
+				if ($onodera_clamp) {
+					# Onodera and Melcher exclusion
+					next unless onodera(substr($currwindow, -3, 3));
+				} else {
+					# calculate GC clamp at 5' end: two out of last three residues required...
+					my $gc_clamp=gc(substr($currwindow, -3, 3));
+					next unless $gc_clamp > 50;
+				}
 			}
 			
 			if ($exclude_rr) {
@@ -2897,6 +2909,11 @@ sub cc {
 	return $cc;
 }
 
+# Onodera and Melcher exclusion
+sub onodera {
+	$_ = shift;
+	return 1 if (m/[G|C][A|T][G|C]/ || m/[A|T][G|C][G|C]/ && !(m/[A|T]CG/));
+}
 
 #----------------#
 # Clean sequence #
@@ -3093,23 +3110,24 @@ sub primer_dimer {
 	# and because it's 3' primer-dimers that are the real problem in PCR.
 	
 	# create a binding array for each of the four bases
-	for $l (0 .. $pfl-1) {
+	foreach $l (0 .. $pfl-1) {
 		my $mbase = substr($fprimer_r, $l, 1);
 		$primer_hash{$mbase}[$l]=1;
-		for $k qw(a g c t) {
+		my @nucleotides = qw(a g c t);
+		foreach $k (@nucleotides) {
 			$primer_hash{$k}[$l] ||=0;
 		}
 	}
 		
 	# create the primer matrix
 	my @primer_comp;
-	for $k (0 .. $prl-1) {
+	foreach $k (0 .. $prl-1) {
 		$primer_comp[$k]=$primer_hash{substr($rcomprlc, $k, 1)};
 	}
 		
 	# read each combination from the matrix, calculate dG for each dimer
 	my $pd_len = ($pd_full ? $pfl+$prl-1 : $pl-2);
-	for $k (0 .. $pd_len) {
+	foreach $k (0 .. $pd_len) {
 		$score[$k]=0;
 		my $bind;
 		my $score_p=0;
@@ -3129,7 +3147,7 @@ sub primer_dimer {
 		# }
 		
 		# read the binding data
-		for $l (0 .. $prl-1) {
+		foreach $l (0 .. $prl-1) {
 			if (($k-$l)<$pfl) {
 				$bind .= $primer_comp[$l][$k-$l] if ($k-$l)>=0;
 			} else {
@@ -3148,7 +3166,7 @@ sub primer_dimer {
 		
 		# Find start and end of similarity
 		my ($pb_init,$pb_end);
-		for $l (0 .. length($bind)-1) {
+		foreach $l (0 .. length($bind)-1) {
 			# at first I tried finding the initiating terminal bases with
 			# regexps, but that was much slower ...
 			if (substr($bind, $l, 1) eq "1") {
@@ -3159,7 +3177,7 @@ sub primer_dimer {
 				
 		if (defined($pb_init)) {
 			# deltaG calculation
-			for $l ($pb_init .. $pb_end-1) {
+			foreach $l ($pb_init .. $pb_end-1) {
 				next if substr($bind, $l, 2) eq "00";
 				next if substr($bind, $l, 1) eq "2";
 				$score_p+=$oligo_dG{substr($primer_f, $pfl-$k+$l-1, 2).substr($rprimer_r, $l, 2)};
@@ -3228,44 +3246,44 @@ sub primer_dimer_new {
 	# and because it's 3' primer-dimers that are the real problem in PCR.
 	
 	# create a binding array for each of the four bases
-	for $l (0 .. $pfl-1) {
+	foreach $l (0 .. $pfl-1) {
 		my $mbase = substr($fprimer_r, $l, 1);
 		$primer_hash{$mbase}[$l]=1;
-		for $k qw(a g c t) {
+		foreach $k (qw(a g c t)) {
 			$primer_hash{$k}[$l] ||=0;
 		}
 	}
 		
 	# create the primer matrix
 	my @primer_comp;
-	for $k (0 .. $prl-1) {
-		$primer_comp[$k]=$primer_hash{substr($rcomprlc, $k, 1)};
+	foreach my $kk (0 .. $prl-1) {
+		$primer_comp[$kk]=$primer_hash{substr($rcomprlc, $kk, 1)};
 	}
 	
 	# print the matrix - for debugging
 	print "$primer_f vs. $primer_r - full pd = $pd_full\n";
 	print "  \t";
-	for $l (0 .. $pfl-1) {
+	foreach $l (0 .. $pfl-1) {
 		my $mbase = substr($fprimer_r, $l, 1);
 		print "$mbase ";
 	}
 	print "\n";
-	for $k (0 .. $prl-1) {
-		my $base = substr($rprimer_r, $k, 1);
-		print "$base:\t@{$primer_comp[$k]}\n";
+	foreach my $kk (0 .. $prl-1) {
+		my $base = substr($rprimer_r, $kk, 1);
+		print "$base:\t@{$primer_comp[$kk]}\n";
 	}
 	
 	my @binding_data;
 	# read each combination from the matrix, calculate dG for each dimer
 	my $pd_len = ($pd_full ? $pfl+$prl-1 : $pl-2);
-	for my $k (0 .. $pd_len) {
-		$score[$k]=0;
+	foreach my $kk (0 .. $pd_len) {
+		$score[$kk]=0;
 		my $bind;
 		my $score_p=0;
 		
 		# starting coords
-		my $pf_coord_start = ($k >= $pfl ? $pfl-1 : $k);
-		my $pr_coord_start = ($k - $pfl > 0 ? $k - $pfl : 0);
+		my $pf_coord_start = ($kk >= $pfl ? $pfl-1 : $kk);
+		my $pr_coord_start = ($kk - $pfl > 0 ? $kk - $pfl : 0);
 		my ($pf_coord, $pr_coord, $first, $flag);
 		
 		# read through each combination finding multiple matches
@@ -3285,7 +3303,7 @@ sub primer_dimer_new {
 				}
 			} elsif ($flag) {
 				# end of a binding stretch
-				push @binding_data, [$k, $first, $bind] if $bind > 1;
+				push @binding_data, [$kk, $first, $bind] if $bind > 1;
 				$bind=0;
 				$flag=0;
 			}
@@ -3325,7 +3343,7 @@ sub primer_dimer_new {
 		# # }
 				# 
 		# # read the binding data
-		# for $l (0 .. $prl-1) {
+		# foreach $l (0 .. $prl-1) {
 			# if (($k-$l)<$pfl) {
 				# $bind .= $primer_comp[$l][$k-$l] if ($k-$l)>=0;
 			# } else {
@@ -3344,7 +3362,7 @@ sub primer_dimer_new {
 		# 
 		# # Find start and end of similarity
 		# my ($pb_init,$pb_end);
-		# for $l (0 .. length($bind)-1) {
+		# foreach $l (0 .. length($bind)-1) {
 			# # at first I tried finding the initiating terminal bases with
 			# # regexps, but that was much slower ...
 			# if (substr($bind, $l, 1) eq "1") {
@@ -3355,7 +3373,7 @@ sub primer_dimer_new {
 				# 
 		# if (defined($pb_init)) {
 			# # deltaG calculation
-			# for $l ($pb_init .. $pb_end-1) {
+			# foreach $l ($pb_init .. $pb_end-1) {
 				# next if substr($bind, $l, 2) eq "00";
 				# next if substr($bind, $l, 1) eq "2";
 				# $score_p+=$oligo_dG{substr($primer_f, $pfl-$k+$l-1, 2).substr($rprimer_r, $l, 2)};
@@ -4248,7 +4266,9 @@ sub copy_selected_primers {
 	my @sel = $$ref->selectionGet;
 	
 	# Clipboard copying routine	
-	my $clip = "Forward Primer\tPos\tLen\tTm\tReverse Primer\tPos\tLen\tTm\tAmp\tdG\n";
+	my $clip = ($page eq "seq") ?
+		"Name\tForward Primer\tPos\tLen\tTm\n" :
+		"Name\tForward Primer\tPos\tLen\tTm\tName\tReverse Primer\tPos\tLen\tTm\tAmp\tdG\n";
 	
 	my (@gene_array, $gene_frame, $seq);
 	if ($page eq "pd" && (($primer_seq_5f) || ($primer_seq_5r))) {
@@ -4257,10 +4277,28 @@ sub copy_selected_primers {
 		$gene_frame=$gene_array[0][0]%3;
 	}
 	
-	foreach (@sel) {
-		my $sel = $_;
-		for my $j ( 0 .. 4, 8, 6, 7, 9, 10 ) {
-	    		if ($page eq "bis") {
+	my ($file_name,$dir,$ext) = fileparse($open_file{$page}, qr/\.[^.]*/);
+	$file_name =~ s/_.*//g;
+		
+	foreach my $sel (@sel) {
+		my $nb_page = which_nb_page();
+		
+		my @details;
+		if ($page eq "seq") {
+			@details = (0 .. 3);
+		} else {
+			@details = ( 0 .. 4, 8, 6, 7, 9, 10 );
+		}
+		
+		for my $j (@details) {
+			# Names
+			if ($j == 0) {
+				$clip .= $file_name."_".$$slist[$sel][1]."F\t";
+			} elsif ($j == 4) {
+				$clip .= $file_name."_".$$slist[$sel][8]."R\t";
+			}
+			
+	    	if ($page eq "bis") {
 	    			# Primer redundancy for CpG residues:
 				# Replaces T with Y (pyrimidine) for forward
 				# Replaces A with R (purine) for reverse
@@ -4725,10 +4763,9 @@ sub get_ensembl {
 	return if check_packages("HTTP::Request", "LWP::UserAgent");
 	# retrieve a gene sequence (or a gene and genomic sequence) from ensembl.org ...
 	
-	# Why do we use Ensembl?  Simply because it happens to provide easy sequence 
-	# retrieval, including the genomic sequence of a gene (i.e. not just the cDNA
-	# sequence).  However, unlike NCBI, Ensembl provides no documentation on their
-	# cgi scripts; this was all worked out from going through the page sources.
+	# Now uses Ensembl's very nice REST API to retrieve all details -- should never break again!
+	# (a very quick kludge for now ... will tidy up code later ...)
+	
 	my $nb_page = which_nb_page();
 	if ($nb_page eq "primer") {
 		dialogue("Please switch to the project page that you wish to enter the Ensembl data into");
@@ -4768,21 +4805,49 @@ sub fetch_ensembl {
 		return;
 	}
 	
-	# Search for the gene:
-	# New search method as of v1.1.18 (modified in 1.1.20, and again in 1.1.21 thanks to Nick Kennedy)
-	$_ = http_get("http://www.ensembl.org/$ensembl_organism/Search/Details?species=$ensembl_organism;idx=Gene;end=2;q=$ensembl_gene");
-	#$_ = http_get("http://www.ensembl.org/$ensembl_organism/Search/Details?species=$ensembl_organism;idx=Gene;q=$ensembl_gene");
-	#print "http://www.ensembl.org/$ensembl_organism/Search/Details?species=$ensembl_organism;idx=Gene;q=$ensembl_gene\n";
+	print STDERR "Gene was $ensembl_gene ...\n";
+ 
+	my $http = HTTP::Tiny->new();
+	 
+	my $server = 'http://rest.ensembl.org';
+	my $ext = "/xrefs/symbol/$ensembl_organism/$ensembl_gene?content-type=application/json";
+	my $response = $http->get($server.$ext, {
+	  headers => { 'Content-type' => 'application/json' }
+	});
+	 
+	die "Failed!\n" unless $response->{success};
+	
+	
+	my $gene_id;
+	
+	if(length $response->{content}) {
+		my $gene = decode_json($response->{content});
+				
+		unless (@{$gene}[0]) {
+			# no matches
+			dialogue("Sorry, a matching Ensembl ID for that gene name was not found.  Gene names need to be typed exactly (both Ensembl names and Ensembl IDs can be used).\n\nPlease try again.");
+			# print "output was\n$_\n";
+			return;
+		}
+		
+	  
+		#print Dumper @{$gene};
+		$gene_id = @{$gene}[0]->{id};
 		
-	s/<\/*span.*?>//g; # rip out highlight spans
-	s/<\/*font.*?>//g; # rip out font spans
+		printf("Gene: %s\n",$gene_id);
+	}
+	
 	
-	# Print the HTML output for debugging:
-	# print "$_\n\n";
-							
+	$ext = "/lookup/id/$gene_id?expand=1";
+	$response = $http->get($server.$ext, {
+	  headers => { 'Content-type' => 'application/json' }
+	});
+	 
+	die "Failed!\n" unless $response->{success};
+	 
+	 
 	# find the Ensembl gene ID, and count the number - if there's more than one
 	# we'll have to ask the user to be more specific
-	my $gene_id;
 	my @gene_names;
 	my $name;
 	my %ids;
@@ -4790,34 +4855,13 @@ sub fetch_ensembl {
 	my %trans;
 	my @enst_readable;
 	
-	# As of 03/2010, Ensembl now returns the matching genes first, without listing transcripts
-	# So we need a new http call to get the page we really want, and we'll need to prompt the
-	# if there's more than one match here ...
-	
-	#~ # Find genes and gene_ids
-	#~ while (m/\<a href="(.*?)"\>[\w_]+ ([\w_]+) Gene: ([\w\d\.\-]+) \(.*?: ([\w\d\.\-]+)\)/mg) {
-		#~ my ($href, $gene_type, $gene_id, $name) = ($1, $2, $3, $4);
-		#~ #print "($href, $gene_type, $gene_id, $name)\n\n";
+	if(length $response->{content}) {
+		my $gene = decode_json($response->{content});
+
+		push @gene_names, $gene->{description};
 		
-		#~ $name ||= "$gene_id: no description available";
-		#~ push @gene_names, $name;
-		#~ $ids{$name}=[$gene_id, $href];
-	#~ }
-	
-	# As of 02/2011, Ensembl has changed formats again, leading to a slightly different parsing ... and again for version 1.1.21
-	
-	# Find genes and gene_ids
-	while (m/\<div class=\"hit\"\>.*?href=\"(.*?)\".*?strong\>(.*?)\W*\<.*?\[(.*?): (.*?) ].*?Description.*?dd\>\W*(.*?)\W*\</sg) {
-		my ($href, $name, $gene_type, $gene_id, $gene_des) = ($1, $2, $3, $4, $5);
-		#print "($href, $gene_type, $gene_id, $name, $gene_des)\n\n";
-		$name .= " -- $gene_des";
-		$name ||= "$gene_id: no description available";
-		push @gene_names, $name;
-		$ids{$name}=[$gene_id, $href];
 	}
 	
-	# No need to sort -- genes are listed in order of relevance
-	#@gene_names = sort(@gene_names);
 	
 	if (@gene_names) {
 		# Ask user to confirm gene identity or pick the gene of interest if multiple matches	
@@ -4849,36 +4893,34 @@ sub fetch_ensembl {
 		return if $cancel;
 	}
 	
-	# Having selected the gene, we can now get the transcripts ... (parsing changed for 1.1.21)
-	if ($name && ($ids{$name}[1])) {
-		 $_ = http_get("http://www.ensembl.org/$ids{$name}[1]");
-		 #print "$_\n";
-		 my ($transcripts) = m/id="transcripts"(.*?)\/table/sg;
-		 while ($transcripts =~ m/\/Summary\?.*?t=([\w\d\.]+).*?<td.*?>.*?<td.*?>.*?<td.*?>([\d\-]+).*?<td.*?>.*?>([\w\s]+)</sg) {
-			#print "$1 $2 $3\n";
-			push @enst, $1;
-			if ($2 eq '-') {
-				# Processed transcript, not protein coding
-				push @enst_readable, "$1 $3";
+	# Having selected the gene, we can now get the transcripts ... 
+	
+	
+	if(length $response->{content}) {
+		my $gene = decode_json($response->{content});
+		$gene_id = $gene->{id};
+		foreach my $v (@{ $gene->{Transcript}}) {
+			if ($v->{Translation}) {
+				push @enst_readable, "$v->{id} $v->{display_name} (size: $v->{Translation}->{length} aa)";
 			} else {
-				# Protein coding
-				push @enst_readable, "$1 $3 (size: $2 aa)";
+				push @enst_readable, "$v->{id} $v->{display_name}"
 			}
-			$ids{$1} = [$2, $3];
-		 }
+			
+			push @enst, $v->{id};
+		}
 	}
-		
+			
 	my $transcript;
 	if (@enst) {
-		$transcript = $enst[0];
-		if ($#enst > 1) {
+		$transcript = $enst_readable[0];
+		if ($#enst > 0) {
 			# multiple transcripts: ask user to select transcript ID
 			my @transcripts = @enst;
 			my $ensembl_mt = $top->Toplevel(-title=>"Please select transcipt ...");
 			my $ensembl_mt_f = $ensembl_mt->Frame()->pack(-fill=>'both', -pady=>7);
 			my $ensembl_mt_fb = $ensembl_mt->Frame()->pack(-side=>'bottom', -fill=>'none');
 			nr(\$ensembl_mt_f);		
-				pack_gui('Label', "Ensemble gene $ids{$name}[0] has ".($#transcripts+1)." transcript".($#transcripts > 0 ? 's' : '')." ...", "ensemble_mt_d_note");
+				pack_gui('Label', "Ensemble gene $name has ".($#transcripts+1)." transcript".($#transcripts > 0 ? 's' : '')." ...", "ensemble_mt_d_note");
 			nr();
 				pack_gui('BrowseEntry', \$transcript, 'ensembl_mt_d_genes', \@enst_readable, 50);
 			
@@ -4930,11 +4972,11 @@ sub fetch_ensembl {
 	
 	if ($page eq 'qpcr') {
 		# retrieve both gene and transcript sequences - retrieval type is ignored
-		$_ = http_get(convert_ensembl($ensembl_organism,$transcript,'genomic','Location'));
+		$_ = convert_ensembl($ensembl_organism,$transcript,'genomic');
 		$packed_widgets{qdna_seq}->delete(0.1,"end");
 		$packed_widgets{qdna_seq}->insert(0.1,$_);
 				
-		$_ = http_get(convert_ensembl($ensembl_organism,$transcript,'cdna'));
+		$_ = convert_ensembl($ensembl_organism,$transcript,'cdna');
 		$packed_widgets{qmrna_seq}->delete(0.1,"end");
 		$packed_widgets{qmrna_seq}->insert(0.1,$_);
 		
@@ -4943,7 +4985,7 @@ sub fetch_ensembl {
 	} else {
 		# retrieve requested sequence
 		my ($seq_ref) = get_variables('seq');
-		$_ = http_get(convert_ensembl($ensembl_organism,$transcript,$ensembl_type));
+		$_ = convert_ensembl($ensembl_organism,$transcript,$ensembl_type);
 		$$seq_ref->delete(0.1,"end");
 		$$seq_ref->insert(0.1,$_);
 	}
@@ -4965,21 +5007,18 @@ sub fetch_ensembl {
 sub convert_ensembl {
 	# argument to http address converter (addresses changed for 1.1.21)
 	my ($ensembl_organism,$transcript,$ensembl_type,$export_type) = @_;
-	$export_type||='Transcript';
+	my $http = HTTP::Tiny->new();
+	 
+	my $server = 'http://rest.ensembl.org';
+	my $ext = "/sequence/id/$transcript?content-type=text/plain;type=$ensembl_type";
+	my $response_cds = $http->get($server."/sequence/id/$transcript?content-type=text/plain;type=$ensembl_type");
 	
-	# my $address = "http://www.ensembl.org/$ensembl_organism/exportview?seq_region_name=&type1=transcript&anchor1=$transcript&type2=bp&anchor2=&downstream=&upstream=&format=fasta&action=export&_format=Text&options=$ensembl_type&output=txt";
-	# my $address = "http://www.ensembl.org/$ensembl_organism/$export_type/Export/fasta?db=core;t=$transcript;st=$ensembl_type;_format=Text";
-	# return $address;
+	#print $server."/sequence/id/$transcript?content-type=text/plain;type=$ensembl_type"."\n";
+	
+	if(length $response_cds->{content}) {
+		return $response_cds->{content};
+	}
 	
-	# Thanks to Karl Kashofer for the following fix ...
-	# for genomic retrieval we need to append "genomic=unmasked"
-	if ($ensembl_type eq 'genomic') {
-		my $address = "http://www.ensembl.org/$ensembl_organism/Export/Output/Transcript?output=fasta;db=core;t=$transcript;param=$ensembl_type;genomic=unmasked;_format=Text";
-		return $address;
-	} else {
-		my $address = "http://www.ensembl.org/$ensembl_organism/Export/Output/Transcript?output=fasta;db=core;t=$transcript;param=$ensembl_type;_format=Text";
-		return $address;
-	};
 }
 
 
@@ -5225,7 +5264,7 @@ sub generate_report {
 	}
 	
 	my ($hlist_sel) = $$hlist_ref->selectionGet;
-	unless (defined(@$slist) && defined($hlist_sel)) {
+	unless (@$slist && defined($hlist_sel)) {
 		dialogue("The Generate Report function saves the statistics and alignment of a particular primer pair - please select a primer pair first");
 		return;
 	}
@@ -5377,7 +5416,7 @@ sub info {
 	
 	my $text = <<EOT;
 PerlPrimer v$version
-Copyright � 2003-2011 Owen Marshall\n
+Copyright � 2003-2017 Owen Marshall\n
 EOT
 	my $text2 = <<EOT;
 An application to design primers for PCR, Bisulphite PCR, Real-time PCR and Sequencing.
@@ -5385,7 +5424,7 @@ An application to design primers for PCR, Bisulphite PCR, Real-time PCR and Sequ
 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\n
 EOT
 	my $address = <<EOT;	
-http://perlprimer.sourceforge.net
+https://github.com/owenjm/perlprimer
 EOT
 	$info_d = $top->Toplevel(-title=>'About PerlPrimer ...');
 	my $info_d_f = $info_d->Frame()->pack(-padx=>4, -pady=>4, -expand=>1, -fill=>'both');
@@ -5500,11 +5539,16 @@ Restriction enzyme data are provided by the REBASE project (http://rebase.neb.co
 Roberts RJ, Vincze T, Posfai J, Macelis D.  REBASE - restriction enzymes and methylases.  Nucleic Acids Res. 2003; 31:418-20.
 EOT
 
-	
+	my $text_gc_clamp=<<EOT;
+Strict GC clamp rules (need to be enabled in preferences) are based on:
+
+Onodera K, Melcher U.  Selection for 3' end triplets for polymerase chain reaction primers.  Mol Cell Probes. 2004 Dec;18(6):369-72.
+EOT
+		
 	my $text_thermo=<<EOT;
 Thermodynamic parameters are based on the following papers:
 
-Allawi HT, SantaLucia J Jr.  Thermodynamics and NMR of internal G.T mismatches in DNA.  Biochemistry. 1997 Aug 26;36(34):10581-94
+Allawi HT, SantaLucia J Jr.  Thermodynamics and NMR of internal G.T mismatches in DNA.  Biochemistry. 1997 Aug 26;36(34):10581-94.
 
 SantaLucia J Jr.  A unified view of polymer, dumbbell, and oligonucleotide DNA nearest-neighbor thermodynamics.  Proc Natl Acad Sci U S A. 1998 Feb 17;95(4):1460-5. 
 
@@ -5552,6 +5596,9 @@ EOT
 	$packed_widgets{ack_text}->insert('end', "\n\nEntropy corrections\n\n", 'bold');
 	$packed_widgets{ack_text}->insert('end', $text_entropy);
 	
+	$packed_widgets{ack_text}->insert('end', "\n\nGC clamp parameters\n\n", 'bold');
+	$packed_widgets{ack_text}->insert('end', $text_gc_clamp);
+	
 	$packed_widgets{ack_text}->insert('end', "\n\nBisulphate PCR primer design\n\n", 'bold');
 	$packed_widgets{ack_text}->insert('end', $text_cpg);
 	
@@ -5751,6 +5798,14 @@ sub prefs {
 			pack_gui('Label', '% GC content');
 		nr();
 			pack_gui('Label', '(Used when "Exclude %GC" is checked on a project page)');
+		nr('', 7);
+		
+		nr();
+			pack_gui('Label', "3' GC clamp", '', -font=>$gui_font_bold);
+		nr();
+			pack_gui('Checkbutton', 'Use Onodera and Melcher (2004) rules', "prefs_onodera", \$onodera_clamp);
+		nr();
+			pack_gui('Label', '(Selects for WSS or SWS but not WCG at 3\' end)');
 		
 		nr('',2);
 			
@@ -6630,12 +6685,15 @@ sub reset_bounds {
 }
 
 sub step_in {
+	my $step_length=shift;
+	$step_length ||= 10;
+	
 	my ($min_ampsize, $max_ampsize, $max_range_5p, $min_range, $max_range, $max_range_3p, $sub_ref, $canv_ref, $seq_ref) 
 		= get_variables(qw(min_ampsize max_ampsize max_range_5p min_range max_range max_range_3p subroutine canvas seq)); 
 	
 	&$sub_ref() unless defined($$max_range_5p) && defined($$max_range_3p);
-	$$min_range += 10;
-	$$max_range -= 10;
+	$$min_range += $step_length;
+	$$max_range -= $step_length;
 	if ($$min_range >= $$max_range) {
 		sbarprint("\nNo primers found");
 		$cancel=1;
@@ -7307,7 +7365,7 @@ sub open_fasta {
 }
 
 sub format_file_name {
-	my ($name) = @_;
+	my $name = shift;
 	$name =~ s/\s+/_/g; # replace spaces with underscores
 	$name =~ s/[\(\)\,\.\;]//g; # remove brackets and punctuation
 	$name =~ s/\|/-/g; # replace pipes with dashes
diff --git a/todo b/todo
deleted file mode 100644
index 22ac09b..0000000
--- a/todo
+++ /dev/null
@@ -1,11 +0,0 @@
-For v1.2
-
-*  Use an in vitro PCR server rather than straight BLAST for checking primers.  MFEPrimer (http://biocompute.bmi.ac.cn/MFEprimer/) looks a good candidate.
-
-*  More intelligent sequencing primer design - search for primers around the midpoint between minimum and maximum distances, and then gradually move out
-
-*  More complex primer-dimer routines - including detection of unequal primer-dimer internal loops
-
-*  More emphasis on RealTime PCR design?  Show primers on intron/exon map, for example?
-
-*  Ability to designate regions with starting/ending coordinates or starting/ending sequence strings, and assign colours and PCR ranges to such regions

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/perlprimer.git



More information about the debian-med-commit mailing list