From noreply at r-forge.r-project.org Mon Mar 4 14:13:41 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 4 Mar 2013 14:13:41 +0100 (CET) Subject: [CHNOSZ-commits] r44 - pkg/Rpad Message-ID: <20130304131341.A8141184D79@r-forge.r-project.org> Author: jedick Date: 2013-03-04 14:13:41 +0100 (Mon, 04 Mar 2013) New Revision: 44 Removed: pkg/Rpad/COPYING pkg/Rpad/DESCRIPTION pkg/Rpad/NAMESPACE pkg/Rpad/R/ pkg/Rpad/debian/ pkg/Rpad/inst/ pkg/Rpad/man/ Log: Rpad: delete package (to be moved to new project) Deleted: pkg/Rpad/COPYING =================================================================== --- pkg/Rpad/COPYING 2013-02-13 14:28:35 UTC (rev 43) +++ pkg/Rpad/COPYING 2013-03-04 13:13:41 UTC (rev 44) @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 Library 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. - - - Copyright (C) - - 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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. - - , 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 Library General -Public License instead of this License. Deleted: pkg/Rpad/DESCRIPTION =================================================================== --- pkg/Rpad/DESCRIPTION 2013-02-13 14:28:35 UTC (rev 43) +++ pkg/Rpad/DESCRIPTION 2013-03-04 13:13:41 UTC (rev 44) @@ -1,14 +0,0 @@ -Package: Rpad -Title: Workbook-style, web-based interface to R -Version: 1.3.1 -Author: Tom Short (EPRI), Philippe Grosjean (UMH EcoNum) -Description: A workbook-style user interface to R through a web - browser. Provides convenient plotting, HTML GUI generation, - and HTML output routines. Can be used with R in standalone mode - or with a webserver to serve Rpad pages to other users. -Depends: graphics, utils, grDevices -Suggests: tcltk, R2HTML -LazyLoad: no -Maintainer: Jeffrey M. Dick -License: GPL (>= 2) -URL: http://r-forge.r-project.org/projects/chnosz/ Deleted: pkg/Rpad/NAMESPACE =================================================================== --- pkg/Rpad/NAMESPACE 2013-02-13 14:28:35 UTC (rev 43) +++ pkg/Rpad/NAMESPACE 2013-03-04 13:13:41 UTC (rev 44) @@ -1,57 +0,0 @@ -import(graphics) -import(utils) - -export(processRpadCommands, - Rpad, - startRpadServer, - stopRpadServer, - ROutputFormat, - Html, - H, - HtmlTree, - HfromHTML, - BR, - HTMLon, - HTMLoff, - HTMLh1, - HTMLh2, - HTMLh3, - HTMLh4, - HTMLh5, - HTMLargs, - HTMLtag, - HTMLetag, - HTMLradio, - HTMLcheckbox, - HTMLselect, - HTMLinput, - HTMLlink, - HTMLimg, - HTMLembed, - graphoptions, - newgraph, - showgraph, - RpadPlotName, - RpadURL, - RpadBaseURL, - RpadBaseFile, - RpadIsLocal, - json -) - -S3method(json, default) -S3method(json, data.frame) -S3method(json, list) -S3method(json, NULL) -S3method(json, character) -S3method(json, logical) -S3method(json, numeric) -S3method(Html, data.frame) -S3method(Html, matrix) -S3method(Html, numeric) -S3method(Html, integer) -S3method(Html, default) -S3method(HtmlTree, HtmlTree) -S3method(HtmlTree, default) -S3method(print, HtmlTree) -S3method(print, json) From noreply at r-forge.r-project.org Mon Mar 4 14:16:28 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 4 Mar 2013 14:16:28 +0100 (CET) Subject: [CHNOSZ-commits] r45 - pkg Message-ID: <20130304131628.8A6D2183A0C@r-forge.r-project.org> Author: jedick Date: 2013-03-04 14:16:28 +0100 (Mon, 04 Mar 2013) New Revision: 45 Removed: pkg/Rpad/ Log: Rpad: delete package (to be moved to new project) From noreply at r-forge.r-project.org Mon Mar 11 02:31:14 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 11 Mar 2013 02:31:14 +0100 (CET) Subject: [CHNOSZ-commits] r46 - in pkg/CHNOSZ: . R inst man Message-ID: <20130311013114.A0E4E184ED0@r-forge.r-project.org> Author: jedick Date: 2013-03-11 02:31:14 +0100 (Mon, 11 Mar 2013) New Revision: 46 Removed: pkg/CHNOSZ/LICENSE Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/R/EOSregress.R pkg/CHNOSZ/R/util.data.R pkg/CHNOSZ/inst/CHECKLIST pkg/CHNOSZ/inst/NEWS pkg/CHNOSZ/man/EOSregress.Rd Log: EOSlab() gets label from attribute of user-defined function Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2013-03-04 13:16:28 UTC (rev 45) +++ pkg/CHNOSZ/DESCRIPTION 2013-03-11 01:31:14 UTC (rev 46) @@ -1,6 +1,6 @@ -Date: 2013-02-13 +Date: 2013-03-11 Package: CHNOSZ -Version: 0.9-9.6 +Version: 0.9-9.7 Title: Chemical Thermodynamics and Activity Diagrams Author: Jeffrey M. Dick Maintainer: Jeffrey M. Dick Deleted: pkg/CHNOSZ/LICENSE =================================================================== --- pkg/CHNOSZ/LICENSE 2013-03-04 13:16:28 UTC (rev 45) +++ pkg/CHNOSZ/LICENSE 2013-03-11 01:31:14 UTC (rev 46) @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 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. - - - Copyright (C) - - 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. - - , 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. Modified: pkg/CHNOSZ/R/EOSregress.R =================================================================== --- pkg/CHNOSZ/R/EOSregress.R 2013-03-04 13:16:28 UTC (rev 45) +++ pkg/CHNOSZ/R/EOSregress.R 2013-03-11 01:31:14 UTC (rev 46) @@ -35,7 +35,7 @@ return(out) } -EOSlab <- function(var,coeff="") { +EOSlab <- function(var, coeff="") { # make pretty labels for the variables lab <- switch(EXPR = var, # these are regression variables listed in EOSregress.Rd @@ -46,19 +46,34 @@ "invTTheta" = substitute(YYY/(italic(T)-Theta), list(YYY=coeff)), "TTheta2" = substitute(YYY%*%(italic(T)-Theta)^2, list(YYY=coeff)), "invTTheta2" = substitute(YYY/(italic(T)-Theta)^2, list(YYY=coeff)), + "invPPsi" = substitute(YYY/(italic(P)+Psi),list(YYY=coeff)), + "invPPsiTTheta" = substitute(YYY/((italic(P)+Psi)(italic(T)-Theta)), list(YYY=coeff)), "TXBorn" = substitute(YYY%*%italic(TX), list(YYY=coeff)), "drho.dT" = substitute(YYY%*%(d~rho/dT), list(YYY=coeff)), "V.kT" = substitute(YYY%*%V~kappa[italic(T)], list(YYY=coeff)), - # the rest are properties of water listed in water.Rd - "V" = substitute(YYY%*%italic(V), list(YYY=coeff)), - "E" = substitute(YYY%*%italic(E), list(YYY=coeff)), + # these are non-single-letter properties of water as listed in water.Rd "kT" = substitute(YYY%*%kappa[italic(T)], list(YYY=coeff)), "alpha" = substitute(YYY%*%alpha, list(YYY=coeff)), "beta" = substitute(YYY%*%beta, list(YYY=coeff)), + "diel" = substitute(YYY%*%epsilon, list(YYY=coeff)), + "rho" = substitute(YYY%*%rho, list(YYY=coeff)), + "NBorn" = substitute(YYY%*%italic(N), list(YYY=coeff)), + "QBorn" = substitute(YYY%*%italic(Q), list(YYY=coeff)), "XBorn" = substitute(YYY%*%italic(X), list(YYY=coeff)), - "QBorn" = substitute(YYY%*%italic(Q), list(YYY=coeff)), - # fallback, use the name of the variable (may be the name of a user-defined function) - substitute(YYY%*%italic(XXX), list(YYY=coeff, XXX=var)) + "YBorn" = substitute(YYY%*%italic(Y), list(YYY=coeff)), + "ZBorn" = substitute(YYY%*%italic(Z), list(YYY=coeff)), + ( + # if var is a function, does have an attribute named "label"? + if(exists(var)) { + if(is.function(get(var))) { + if(!is.null(attr(get(var), "label"))) { + return(substitute(YYY*XXX, list(YYY=coeff, XXX=attr(get(var), "label")))) + # fallback, use the name of the variable + # (e.g. for a property of water such as A, G, S, U, H, or name of a user-defined function) + } else substitute(YYY%*%italic(XXX), list(YYY=coeff, XXX=var)) + } else substitute(YYY%*%italic(XXX), list(YYY=coeff, XXX=var)) + } else substitute(YYY%*%italic(XXX), list(YYY=coeff, XXX=var)) + ) ) return(lab) } Modified: pkg/CHNOSZ/R/util.data.R =================================================================== --- pkg/CHNOSZ/R/util.data.R 2013-03-04 13:16:28 UTC (rev 45) +++ pkg/CHNOSZ/R/util.data.R 2013-03-11 01:31:14 UTC (rev 46) @@ -79,14 +79,15 @@ if(length(iold) > 0) { # loop over species for(i in 1:length(iold)) { - # the old values + # the old values and the state oldprop <- thermo$obigt[ispecies[iold[i]], icol] + state <- thermo$obigt$state[ispecies[iold[i]]] # tell user if they're the same, otherwise update the data entry if(isTRUE(all.equal(oldprop, args[iold[i], ], check.attributes=FALSE))) - msgout("mod.obigt: no change for ", args$name[iold[i]], "(", args$state[iold[i]], ")\n") + msgout("mod.obigt: no change for ", args$name[iold[i]], "(", state, ")\n") else { thermo$obigt[ispecies[iold[i]], icol] <<- args[iold[i], ] - msgout("mod.obigt: updated ", args$name[iold[i]], "(", args$state[iold[i]], ")\n") + msgout("mod.obigt: updated ", args$name[iold[i]], "(", state, ")\n") } } } Modified: pkg/CHNOSZ/inst/CHECKLIST =================================================================== --- pkg/CHNOSZ/inst/CHECKLIST 2013-03-04 13:16:28 UTC (rev 45) +++ pkg/CHNOSZ/inst/CHECKLIST 2013-03-11 01:31:14 UTC (rev 46) @@ -29,3 +29,5 @@ - ensure all Rd files have \keyword{...} - test read.supcrt(), write.supcrt() on e.g. slop98.dat + +- update .Rinstignore with any new/deleted files Modified: pkg/CHNOSZ/inst/NEWS =================================================================== --- pkg/CHNOSZ/inst/NEWS 2013-03-04 13:16:28 UTC (rev 45) +++ pkg/CHNOSZ/inst/NEWS 2013-03-11 01:31:14 UTC (rev 46) @@ -1,4 +1,4 @@ -CHANGES IN CHNOSZ 0.9-9.6 (2013-02-13) +CHANGES IN CHNOSZ 0.9-9.7 (2013-03-11) -------------------------------------- - Fix calculation of free energy derivative in wjd(). @@ -54,7 +54,10 @@ - [temporary] Deactivate code using 'central' method in guess() (wjd.Rnw) as limSolve package on not available on R-Forge for windows. +- EOSlab() gets label from attribute (if present) of user-defined + function. + CHANGES IN CHNOSZ 0.9-9 (2013-01-01) ------------------------------------ Modified: pkg/CHNOSZ/man/EOSregress.Rd =================================================================== --- pkg/CHNOSZ/man/EOSregress.Rd 2013-03-04 13:16:28 UTC (rev 45) +++ pkg/CHNOSZ/man/EOSregress.Rd 2013-03-11 01:31:14 UTC (rev 46) @@ -67,7 +67,9 @@ The point symbols are filled circles where the calculated value is within 10\% of the experimental value; open circles otherwise. \code{EOSlab} produces labels for the variables listed above that can be used \code{\link{as.expression}}s in plots. -The value of \code{coeff} is prefixed (using \code{\link{substitute}}) to the name of the variable. +The value of \code{coeff} is prefixed to the name of the variable (using \code{\link{substitute}}, with a multiplication symbol). +For the properties listed in the table above, and selected properties listed in \code{\link{water}}, the label is formatted using \code{\link{plotmath}} expressions (e.g., with italicized symbols and Greek letters). +If \code{var} is a user-defined function, the function can be given a \samp{label} attribute to provide \code{\link{plotmath}}-style formatting; in this case the appropriate multiplication or division symbol should be specified (see example below). \code{EOScoeffs} retrieves coefficients in the Helgeson-Kirkham-Flowers equations from the thermodynamic database (\code{\link{thermo}$obigt}) for the given aqueous \code{species}. If the \code{property} is \samp{Cp}, the resulting data frame has column names of \samp{(Intercept)}, \samp{invTTheta2} and \samp{TX}, respectively holding the coefficients \eqn{c_1}{c1}, \eqn{c_2}{c2} and \eqn{\omega}{omega} in the equation \eqn{Cp^\circ = c_1 + c_2/(T-\Theta)^2 + {\omega}TX}{Cp = c1 + c2/(T-Theta)^2 + omega*TX}. @@ -123,16 +125,20 @@ EOSplot(d, coefficients=CH4coeffs, T.plot=600) title("Cp from EOS parameters in database") -# following from above, with user-defined variables +# continuing from above, with user-defined variables invTTTheta3 <- function(T, P) (2*T)/(T-T*thermo$opt$Theta)^3 invTX <- function(T, P) 1/T*water("XBorn", T=T, P=P)[,1] +# print the calculated values of invTTTheta3 EOSvar("invTTTheta3", d$T, d$P) +# use invTTTheta and invTX in a regression var <- c("invTTTheta3", "invTX") EOSregress(d, var) -# the plot is commented for this toy example +# give them a "label" attribute for use in the legend +attr(invTTTheta3, "label") <- quote(phantom()\%*\%2*italic(T)/(italic(T)-italic(T)*Theta)^3) +attr(invTX, "label") <- quote(phantom()/italic(T*X)) +# uncomment the following to make the plot #EOSplot(d, var) - ## model experimental volumes of CH4 ## using HKF equation and an exploratory one f <- system.file("extdata/cpetc/V.CH4.HWM96.csv", package="CHNOSZ") From noreply at r-forge.r-project.org Thu Mar 14 02:06:37 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 14 Mar 2013 02:06:37 +0100 (CET) Subject: [CHNOSZ-commits] r47 - in pkg/CHNOSZ: . R inst inst/doc inst/tests man vignettes Message-ID: <20130314010637.B4471184EA7@r-forge.r-project.org> Author: jedick Date: 2013-03-14 02:06:37 +0100 (Thu, 14 Mar 2013) New Revision: 47 Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/R/revisit.R pkg/CHNOSZ/inst/CHECKLIST pkg/CHNOSZ/inst/NEWS pkg/CHNOSZ/inst/doc/wjd.pdf pkg/CHNOSZ/inst/tests/test-util.data.R pkg/CHNOSZ/man/revisit.Rd pkg/CHNOSZ/vignettes/wjd.Rnw pkg/CHNOSZ/vignettes/wjd.lyx Log: pass R CMD check using R configured with --disable-long-double Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2013-03-11 01:31:14 UTC (rev 46) +++ pkg/CHNOSZ/DESCRIPTION 2013-03-14 01:06:37 UTC (rev 47) @@ -1,6 +1,6 @@ -Date: 2013-03-11 +Date: 2013-03-14 Package: CHNOSZ -Version: 0.9-9.7 +Version: 0.9-9.8 Title: Chemical Thermodynamics and Activity Diagrams Author: Jeffrey M. Dick Maintainer: Jeffrey M. Dick Modified: pkg/CHNOSZ/R/revisit.R =================================================================== --- pkg/CHNOSZ/R/revisit.R 2013-03-11 01:31:14 UTC (rev 46) +++ pkg/CHNOSZ/R/revisit.R 2013-03-14 01:06:37 UTC (rev 47) @@ -120,7 +120,6 @@ # construct array of values: Astar (for DGtr) if(any(grepl("Astar", objargs))) { Astar <- eout$Astar[ispecies] -eout <<- eout # one row for each condition Astar <- sapply(Astar, as.vector) # for 0-D case we want a 1-row matrix (sapply simplifies to vector) @@ -161,12 +160,14 @@ # plot the points for a referenced objective ylab <- "loga1" xlab <- "loga2" - plot(loga2, loga1, xlab=xlab, ylab=ylab, pch=pch, col=col) + plot(loga2, loga1, xlab=xlab, ylab=ylab, pch=pch, col=col, xlim=xlim, ylim=ylim) # add a 1:1 line lines(range(loga2), range(loga2), col="grey") # add a lowess line - ls <- loess.smooth(loga2, loga1, family="gaussian") - lines(ls$x, ls$y, col="red") + if(!is.null(lwd)) { + ls <- loess.smooth(loga2, loga1, family="gaussian") + lines(ls$x, ls$y, col="red", lwd=lwd) + } } else plot.it <- FALSE # add a title if(missing(main)) main <- paste(objective, "=", round(H,3)) Modified: pkg/CHNOSZ/inst/CHECKLIST =================================================================== --- pkg/CHNOSZ/inst/CHECKLIST 2013-03-11 01:31:14 UTC (rev 46) +++ pkg/CHNOSZ/inst/CHECKLIST 2013-03-14 01:06:37 UTC (rev 47) @@ -31,3 +31,6 @@ - test read.supcrt(), write.supcrt() on e.g. slop98.dat - update .Rinstignore with any new/deleted files + +- run R CMD check using R compiled without long doubles (as in Solaris checks on CRAN) + (CFLAGS=-ffloat-store ./configure --disable-long-double) Modified: pkg/CHNOSZ/inst/NEWS =================================================================== --- pkg/CHNOSZ/inst/NEWS 2013-03-11 01:31:14 UTC (rev 46) +++ pkg/CHNOSZ/inst/NEWS 2013-03-14 01:06:37 UTC (rev 47) @@ -1,4 +1,4 @@ -CHANGES IN CHNOSZ 0.9-9.7 (2013-03-11) +CHANGES IN CHNOSZ 0.9-9.8 (2013-03-14) -------------------------------------- - Fix calculation of free energy derivative in wjd(). @@ -57,7 +57,10 @@ - EOSlab() gets label from attribute (if present) of user-defined function. +- Modify test-util.data.R and wjd.Rd to pass R CMD check using R + configured with --disable-long-double . + CHANGES IN CHNOSZ 0.9-9 (2013-01-01) ------------------------------------ Modified: pkg/CHNOSZ/inst/doc/wjd.pdf =================================================================== (Binary files differ) Modified: pkg/CHNOSZ/inst/tests/test-util.data.R =================================================================== --- pkg/CHNOSZ/inst/tests/test-util.data.R 2013-03-11 01:31:14 UTC (rev 46) +++ pkg/CHNOSZ/inst/tests/test-util.data.R 2013-03-14 01:06:37 UTC (rev 47) @@ -26,10 +26,10 @@ # G is set higher; is there an incorrect group value somewhere? expect_true(max(abs(obigt.calc$G - obigt.ref$G)) < 31) expect_true(max(abs(obigt.calc$H - obigt.ref$H)) == 0) - expect_true(max(abs(obigt.calc$S - obigt.ref$S)) < 0.02000001) - expect_true(max(abs(obigt.calc$Cp - obigt.ref$Cp)) < 0.04) - expect_true(max(abs(obigt.calc$V - obigt.ref$V)) < 0.1) - expect_true(max(abs(obigt.calc$a1.a - obigt.ref$a1.a)) < 0.01) + expect_true(max(abs(obigt.calc$S - obigt.ref$S)) < 0.02001) + expect_true(max(abs(obigt.calc$Cp - obigt.ref$Cp)) < 0.04001) + expect_true(max(abs(obigt.calc$V - obigt.ref$V)) < 0.1001) + expect_true(max(abs(obigt.calc$a1.a - obigt.ref$a1.a)) < 0.01001) expect_true(max(abs(obigt.calc$a2.b - obigt.ref$a2.b)) < 1e-13) expect_true(max(abs(obigt.calc$a3.c - obigt.ref$a3.c)) < 1e-14) }) Modified: pkg/CHNOSZ/man/revisit.Rd =================================================================== --- pkg/CHNOSZ/man/revisit.Rd 2013-03-11 01:31:14 UTC (rev 46) +++ pkg/CHNOSZ/man/revisit.Rd 2013-03-14 01:06:37 UTC (rev 47) @@ -52,8 +52,12 @@ Generally, \code{loga2} must be a numeric vector with length equal to that of \code{loga1} (i.e., number of species). If a single numeric value is supplied for \code{loga2}, it is recycled to the length of \code{loga1}. +For calculations at a single condition (0-D, no variation), with the \samp{qqr} objective, a quantile-quantile plot (\code{\link{qqnorm}}) is shown. +For \samp{rmsd} and other objective functions having reference values (\code{loga2}), a scatter plot is shown with a smooth line calculated using \code{\link{loess.smooth}}. +The line can be suppressed using \code{lwd=NULL}. +Otherwise, no plot is made for 0-D calculations for the other objective functions. + If \code{plot.it} is TRUE, and \code{eout} is the output from \code{equilibrate}, and the number of variables is 1 or 2, the results are plotted --- a line diagram in 1 dimension or a contour plot in 2 dimensions. -No plot is made for calculations at a single condition (0-D, no variation), except for the \code{qqr} objective, showing a quantile-quantile plot (\code{\link{qqnorm}}). \code{style.2D} can be set to \code{\link{image}} to fill the plot with colors instead of the \code{\link{contour}} plot that is the default. If \code{plot.optval} is TRUE, the location of the optimum (or optima) is indicated by a dashed vertical line(s) on a 1-D plot or a point(s) marked by an asterisk on a 2-D plot. @@ -63,7 +67,7 @@ An alternative source for the \code{eout} argument is any list of numeric values, each element of which corresponds to a different observation (such as a single species), all having the same dimensions (as vectors, matrices or higher-dimensional arrays) In this case, plotting is disabled, since the names of the variables are not in the input. -\samp{revisit} is a loose anagram of \samp{diversity}, which was the provisional name of the function but was changed in CHNOSZ-0.9. +\samp{revisit} is a partial anagram of \samp{diversity}, which was the provisional name of the function but was changed in CHNOSZ-0.9. While the \code{\link[vegan]{diversity}} function (in \pkg{vegan}) operates on a matrix with (biological) species on the columns, \code{revisit} operates on a list with (chemical) species as the elements of the list. The name of the \samp{H} output value is the conventional symbol for the Shannon diversity index, which was the first target statistic to be implemented in \code{revisit}. Modified: pkg/CHNOSZ/vignettes/wjd.Rnw =================================================================== --- pkg/CHNOSZ/vignettes/wjd.Rnw 2013-03-11 01:31:14 UTC (rev 46) +++ pkg/CHNOSZ/vignettes/wjd.Rnw 2013-03-14 01:06:37 UTC (rev 47) @@ -472,10 +472,12 @@ = 1.261905). That FALSE means the chemical potentials of the elements calculated from different combinations of species differ by more than 0.01, the default setting of \texttt{tol} in \texttt{is.near.equil()}. -We can make it TRUE by running more iterations: +We can make it TRUE by running more iterations and increasing the +number of intervals tested for fractional distance change at each +step (\texttt{nlambda}): <>= -waa <- run.wjd(c(ialk, iaro), Y=rep(1, 8), imax=12, Gfrac=1e-14) +waa <- run.wjd(c(ialk, iaro), Y=rep(1, 8), imax=20, Gfrac=1e-14, nlambda=501) is.near.equil(waa) @ Modified: pkg/CHNOSZ/vignettes/wjd.lyx =================================================================== --- pkg/CHNOSZ/vignettes/wjd.lyx 2013-03-11 01:31:14 UTC (rev 46) +++ pkg/CHNOSZ/vignettes/wjd.lyx 2013-03-14 01:06:37 UTC (rev 47) @@ -67,22 +67,22 @@ \branch short \selected 1 \filename_suffix 0 -\color #000000 +\color #faf0e6 \end_branch \branch long \selected 1 \filename_suffix 0 -\color #101010 +\color #faf0e6 \end_branch \branch stuff \selected 1 \filename_suffix 0 -\color #000000 +\color #faf0e6 \end_branch \branch inactive \selected 0 \filename_suffix 0 -\color #000000 +\color #faf0e6 \end_branch \index Index \shortcut idx @@ -1289,7 +1289,7 @@ \begin_layout Standard \begin_inset Branch short -status collapsed +status open \begin_layout Chunk @@ -2066,7 +2066,12 @@ is.near.equil() \family default . - We can make it TRUE by running more iterations: + We can make it TRUE by running more iterations and increasing the number + of intervals tested for fractional distance change at each step ( +\family typewriter +nlambda +\family default +): \end_layout \begin_layout Standard @@ -2080,7 +2085,7 @@ \begin_layout Chunk -waa <- run.wjd(c(ialk, iaro), Y=rep(1, 8), imax=12, Gfrac=1e-14) +waa <- run.wjd(c(ialk, iaro), Y=rep(1, 8), imax=20, Gfrac=1e-14, nlambda=501) \end_layout \begin_layout Chunk From noreply at r-forge.r-project.org Fri Mar 15 02:23:24 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 15 Mar 2013 02:23:24 +0100 (CET) Subject: [CHNOSZ-commits] r48 - in pkg/CHNOSZ: . R data inst inst/doc inst/tests man vignettes Message-ID: <20130315012324.5C9301847A5@r-forge.r-project.org> Author: jedick Date: 2013-03-15 02:23:23 +0100 (Fri, 15 Mar 2013) New Revision: 48 Removed: pkg/CHNOSZ/R/util.supcrt.R pkg/CHNOSZ/data/xxx.R pkg/CHNOSZ/data/yyy.R Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/R/EOSregress.R pkg/CHNOSZ/R/affinity.R pkg/CHNOSZ/R/anim.R pkg/CHNOSZ/R/basis.R pkg/CHNOSZ/R/buffer.R pkg/CHNOSZ/R/cgl.R pkg/CHNOSZ/R/examples.R pkg/CHNOSZ/R/findit.R pkg/CHNOSZ/R/hkf.R pkg/CHNOSZ/R/info.R pkg/CHNOSZ/R/iprotein.R pkg/CHNOSZ/R/makeup.R pkg/CHNOSZ/R/protein.info.R pkg/CHNOSZ/R/species.R pkg/CHNOSZ/R/subcrt.R pkg/CHNOSZ/R/swap.basis.R pkg/CHNOSZ/R/transfer.R pkg/CHNOSZ/R/util.affinity.R pkg/CHNOSZ/R/util.args.R pkg/CHNOSZ/R/util.data.R pkg/CHNOSZ/R/util.expression.R pkg/CHNOSZ/R/util.formula.R pkg/CHNOSZ/R/util.misc.R pkg/CHNOSZ/R/util.plot.R pkg/CHNOSZ/R/util.seq.R pkg/CHNOSZ/R/util.units.R pkg/CHNOSZ/R/water.R pkg/CHNOSZ/R/wjd.R pkg/CHNOSZ/R/zzz.R pkg/CHNOSZ/data/thermo.R pkg/CHNOSZ/inst/NEWS pkg/CHNOSZ/inst/doc/anintro.pdf pkg/CHNOSZ/inst/doc/equilibrium.pdf pkg/CHNOSZ/inst/doc/hotspring.pdf pkg/CHNOSZ/inst/doc/wjd.pdf pkg/CHNOSZ/inst/tests/test-EOSregress.R pkg/CHNOSZ/inst/tests/test-affinity.R pkg/CHNOSZ/inst/tests/test-basis.R pkg/CHNOSZ/inst/tests/test-iprotein.R pkg/CHNOSZ/inst/tests/test-protein.info.R pkg/CHNOSZ/inst/tests/test-species.R pkg/CHNOSZ/inst/tests/test-swap.basis.R pkg/CHNOSZ/inst/tests/test-thermo.R pkg/CHNOSZ/man/IAPWS95.Rd pkg/CHNOSZ/man/anim.Rd pkg/CHNOSZ/man/buffer.Rd pkg/CHNOSZ/man/eos.Rd pkg/CHNOSZ/man/iprotein.Rd pkg/CHNOSZ/man/objective.Rd pkg/CHNOSZ/man/protein.Rd pkg/CHNOSZ/man/read.expr.Rd pkg/CHNOSZ/man/revisit.Rd pkg/CHNOSZ/man/sideeffects.Rd pkg/CHNOSZ/man/species.Rd pkg/CHNOSZ/man/subcrt.Rd pkg/CHNOSZ/man/swap.basis.Rd pkg/CHNOSZ/man/util.affinity.Rd pkg/CHNOSZ/man/util.args.Rd pkg/CHNOSZ/man/util.array.Rd pkg/CHNOSZ/man/util.blast.Rd pkg/CHNOSZ/man/util.character.Rd pkg/CHNOSZ/man/util.data.Rd pkg/CHNOSZ/man/util.expression.Rd pkg/CHNOSZ/man/util.formula.Rd pkg/CHNOSZ/man/util.matrix.Rd pkg/CHNOSZ/man/util.misc.Rd pkg/CHNOSZ/man/util.seq.Rd pkg/CHNOSZ/man/util.units.Rd pkg/CHNOSZ/man/water.Rd pkg/CHNOSZ/man/wjd.Rd pkg/CHNOSZ/vignettes/anintro.Rnw pkg/CHNOSZ/vignettes/anintro.lyx pkg/CHNOSZ/vignettes/equilibrium.Rnw pkg/CHNOSZ/vignettes/equilibrium.lyx pkg/CHNOSZ/vignettes/hotspring.Rnw pkg/CHNOSZ/vignettes/hotspring.lyx pkg/CHNOSZ/vignettes/wjd.Rnw pkg/CHNOSZ/vignettes/wjd.lyx Log: follow "good practice" in ?data Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2013-03-14 01:06:37 UTC (rev 47) +++ pkg/CHNOSZ/DESCRIPTION 2013-03-15 01:23:23 UTC (rev 48) @@ -1,6 +1,6 @@ -Date: 2013-03-14 +Date: 2013-03-15 Package: CHNOSZ -Version: 0.9-9.8 +Version: 0.9-9.9 Title: Chemical Thermodynamics and Activity Diagrams Author: Jeffrey M. Dick Maintainer: Jeffrey M. Dick Modified: pkg/CHNOSZ/R/EOSregress.R =================================================================== --- pkg/CHNOSZ/R/EOSregress.R 2013-03-14 01:06:37 UTC (rev 47) +++ pkg/CHNOSZ/R/EOSregress.R 2013-03-15 01:23:23 UTC (rev 48) @@ -6,16 +6,17 @@ EOSvar <- function(var, T, P) { # get the variables of a term in a regression equation # T (K), P (bar) + opt <- get("thermo")$opt out <- switch(EXPR = var, "(Intercept)" = rep(1, length(T)), "T" = T, "P" = P, - "TTheta" = T-thermo$opt$Theta, # T-Theta - "invTTheta" = (T-thermo$opt$Theta)^-1, # 1/(T-Theta) - "TTheta2" = (T-thermo$opt$Theta)^2, # (T-Theta)^2 - "invTTheta2" = (T-thermo$opt$Theta)^-2, # 1/(T-Theta)^2 - "invPPsi" = (P+thermo$opt$Psi)^-1, # 1/(P-Psi) - "invPPsiTTheta" = (P+thermo$opt$Psi)^-1 * (T-thermo$opt$Theta)^-1, # 1/[(P-Psi)(T-Theta)] + "TTheta" = T-opt$Theta, # T-Theta + "invTTheta" = (T-opt$Theta)^-1, # 1/(T-Theta) + "TTheta2" = (T-opt$Theta)^2, # (T-Theta)^2 + "invTTheta2" = (T-opt$Theta)^-2, # 1/(T-Theta)^2 + "invPPsi" = (P+opt$Psi)^-1, # 1/(P-Psi) + "invPPsiTTheta" = (P+opt$Psi)^-1 * (T-opt$Theta)^-1, # 1/[(P-Psi)(T-Theta)] "TXBorn" = T*water("XBorn", T=T, P=P)[, 1], "drho.dT" = -water("rho", T=T, P=P)[, 1]*water("E", T=T, P=P)[, 1], "V.kT" = water("V", T=T, P=P)[, 1]*water("kT", T=T, P=P)[, 1], Modified: pkg/CHNOSZ/R/affinity.R =================================================================== --- pkg/CHNOSZ/R/affinity.R 2013-03-14 01:06:37 UTC (rev 47) +++ pkg/CHNOSZ/R/affinity.R 2013-03-15 01:23:23 UTC (rev 48) @@ -22,6 +22,7 @@ args <- c(args,list(sout=sout,exceed.Ttr=exceed.Ttr)) # the species we're given + thermo <- get("thermo") mybasis <- thermo$basis myspecies <- thermo$species @@ -48,6 +49,7 @@ # account for protein activities later resprot <- paste(resnames,"RESIDUE",sep="_") species(resprot, 0) + thermo <- get("thermo", "CHNOSZ") ires <- match(resprot, thermo$species$name) } @@ -59,6 +61,7 @@ msgout('affinity: loading buffer species\n') if(!is.null(thermo$species)) is.species <- 1:nrow(thermo$species) else is.species <- numeric() is.buffer <- buffer(logK=NULL) + thermo <- get("thermo", "CHNOSZ") is.buff <- numeric() for(i in 1:length(is.buffer)) is.buff <- c(is.buff,as.numeric(is.buffer[[i]])) is.only.buffer <- is.buff[!is.buff %in% is.species] Modified: pkg/CHNOSZ/R/anim.R =================================================================== --- pkg/CHNOSZ/R/anim.R 2013-03-14 01:06:37 UTC (rev 47) +++ pkg/CHNOSZ/R/anim.R 2013-03-15 01:23:23 UTC (rev 48) @@ -7,10 +7,8 @@ # we depend on an empty png directory if(!"png" %in% dir()) stop("directory 'png' not present") else if(length(dir("png")) > 0) stop("directory 'png' not empty") - # initialize the system # add supplementary data (from default location of data/OBIGT-2.csv) - # which includes properties from - data(thermo) + # which includes properties for the metabolites add.obigt() # expand default logfO2 range if we're at high temperature if(high.T & missing(redox)) redox <- list(O2=c(-100,-40)) @@ -95,7 +93,6 @@ notna <- !is.na(pdata$name) pname <- pdata$name[notna] # set up the system; use O2 aq instead of gas - data(thermo) basis(c("CO2","NH3","H2S","H2","O2","H+")) basis("O2","aq") basis(c("CO2","NH3","H2S","H+"),c(-3,-3,-10,-7)) @@ -180,7 +177,6 @@ ido <- c(rep(1,15),1:res,rep(res,20)) } # set up system - data(thermo) basis(c("CO2","H2O","NH3","H2","H2S","H+"), c("aq","liq","aq","aq","aq","aq"),c(-3,0,-4,-6,-7,-7)) species(c(rubisco,accoaco)) Modified: pkg/CHNOSZ/R/basis.R =================================================================== --- pkg/CHNOSZ/R/basis.R 2013-03-14 01:06:37 UTC (rev 47) +++ pkg/CHNOSZ/R/basis.R 2013-03-15 01:23:23 UTC (rev 48) @@ -5,6 +5,7 @@ # to add the basis to thermo$obigt put.basis <- function(ispecies, logact = rep(NA, length(ispecies))) { + thermo <- get("thermo") state <- thermo$obigt$state[ispecies] # make the basis matrix, revised 20120114 # get the elemental makeup of each species, @@ -30,8 +31,9 @@ # store the basis definition in thermo$basis, including # both numeric and character data, so we need to use a data frame comp <- cbind(as.data.frame(comp), ispecies, logact, state, stringsAsFactors=FALSE) - # assign to the global thermo object - thermo$basis <<- comp + # ready to assign to the global thermo object + thermo$basis <- comp + assign("thermo", thermo, "CHNOSZ") # remove the species since there's no guarantee the # new basis includes all their elements species(delete=TRUE) @@ -40,6 +42,7 @@ # modify the states or logact values in the existing basis definition mod.basis <- function(species, state=NULL, logact=NULL) { + thermo <- get("thermo") # the basis must be defined if(is.null(thermo$basis)) stop("basis is not defined") # loop over each species to modify @@ -70,18 +73,20 @@ "' are not in the basis\n",sep="")) } } - thermo$basis$logact[ib] <<- state[i] + thermo$basis$logact[ib] <- state[i] } else { # look for a species with this name in the requested state ispecies <- suppressMessages(info(thermo$obigt$name[thermo$basis$ispecies[ib]], state[i], check.it=FALSE)) if(is.na(ispecies) | is.list(ispecies)) stop(paste("state or buffer '", state[i], "' not found for ", thermo$obigt$name[thermo$basis$ispecies[ib]], "\n", sep="")) - thermo$basis$ispecies[ib] <<- ispecies - thermo$basis$state[ib] <<- state[i] + thermo$basis$ispecies[ib] <- ispecies + thermo$basis$state[ib] <- state[i] } } # then modify the logact - if(!is.null(logact)) thermo$basis$logact[ib] <<- as.numeric(logact[i]) + if(!is.null(logact)) thermo$basis$logact[ib] <- as.numeric(logact[i]) + # assign the result to the CHNOSZ environment + assign("thermo", thermo, "CHNOSZ") } return(thermo$basis) } @@ -124,9 +129,13 @@ ## the actual basis() function ## delete, retrieve, define or modify the basis species of a thermodynamic system basis <- function(species=NULL, state=NULL, logact=NULL, delete=FALSE) { + thermo <- get("thermo") ## delete the basis species if requested oldbasis <- thermo$basis - if(delete) thermo$basis <<- NULL + if(delete) { + thermo$basis <- NULL + assign("thermo", thermo, "CHNOSZ") + } ## return the basis definition if requested if(is.null(species)) return(oldbasis) ## from now on we need something to work with Modified: pkg/CHNOSZ/R/buffer.R =================================================================== --- pkg/CHNOSZ/R/buffer.R 2013-03-14 01:06:37 UTC (rev 47) +++ pkg/CHNOSZ/R/buffer.R 2013-03-15 01:23:23 UTC (rev 48) @@ -2,8 +2,9 @@ # Calculate chemical activities of buffered species # 20061102 jmd -mod.buffer <- function(name,species=NULL,state=thermo$opt$state,logact=-3) { +mod.buffer <- function(name,species=NULL,state=get("thermo")$opt$state,logact=-3) { # 20071102 add or change a buffer system + thermo <- get("thermo") if(is.null(species)) { iname <- which(name==thermo$buffers$name) if(length(iname)>0) species <- thermo$buffers$species[iname] @@ -19,7 +20,8 @@ imod <- which(thermo$buffers$name %in% name & thermo$buffers$species %in% species) if(length(imod)>0) { if(state[1]=='') { - thermo$buffers <<- thermo$buffers[-imod,] + thermo$buffers <- thermo$buffers[-imod,] + assign("thermo", thermo, "CHNOSZ") msgout(paste('mod.buffer: removed ',c2s(species),' in ', c2s(unique(name)),' buffer.\n',sep='')) } else { @@ -29,8 +31,9 @@ if(length(logact)!=ls) logact <- rep(logact,length.out=ls) state.old <- thermo$buffers$state[imod] logact.old <- thermo$buffers$logact[imod] - thermo$buffers$state[imod] <<- state - thermo$buffers$logact[imod] <<- logact + thermo$buffers$state[imod] <- state + thermo$buffers$logact[imod] <- logact + assign("thermo", thermo, "CHNOSZ") if(identical(state.old,state) & identical(logact.old,logact)) { msgout(paste('mod.buffer: nothing changed for ', c2s(species),' in ',c2s(unique(name)),' buffer.\n',sep='')) @@ -46,13 +49,15 @@ if(add) { if(state[1]=='') state <- rep(thermo$opt$state,length.out=ls) t <- data.frame(name=name,species=species,state=state,logact=logact) - thermo$buffers <<- rbind(thermo$buffers,t) + thermo$buffers <- rbind(thermo$buffers,t) + assign("thermo", thermo, "CHNOSZ") msgout(paste('mod.buffer: added ',c2s(unique(name)),'.\n',sep='')) } return(invisible(thermo$buffers[thermo$buffers$name %in% name,])) } buffer <- function(logK=NULL,ibasis=NULL,logact.basis=NULL,is.buffer=NULL,balance='PBB') { + thermo <- get("thermo") # if logK is NULL load the buffer species # otherwise perform buffer calculations. if(is.null(logK)) { Modified: pkg/CHNOSZ/R/cgl.R =================================================================== --- pkg/CHNOSZ/R/cgl.R 2013-03-14 01:06:37 UTC (rev 47) +++ pkg/CHNOSZ/R/cgl.R 2013-03-15 01:23:23 UTC (rev 48) @@ -5,7 +5,9 @@ cgl <- function(property=NULL,T=298.15,P=1,ghs=NULL,eos=NULL) { # calculate properties of crystalline, liquid (except H2O) and gas species # argument handling - Tr <- thermo$opt$Tr; Pr <- thermo$opt$Pr + thermo <- get("thermo") + Tr <- thermo$opt$Tr + Pr <- thermo$opt$Pr eargs <- eos.args('mk',property=property) prop <- eargs$prop props <- eargs$props Modified: pkg/CHNOSZ/R/examples.R =================================================================== --- pkg/CHNOSZ/R/examples.R 2013-03-14 01:06:37 UTC (rev 47) +++ pkg/CHNOSZ/R/examples.R 2013-03-15 01:23:23 UTC (rev 48) @@ -25,7 +25,7 @@ } if(is.character(do.png)) dev.off() # at the end we attempt to restore the old par() (active as of the first call of thermo.plot.new) - par(thermo$opar) + par(get("thermo")$opar) cat("Time elapsed: ", proc.time() - .ptime, "\n") } Modified: pkg/CHNOSZ/R/findit.R =================================================================== --- pkg/CHNOSZ/R/findit.R 2013-03-14 01:06:37 UTC (rev 47) +++ pkg/CHNOSZ/R/findit.R 2013-03-15 01:23:23 UTC (rev 48) @@ -34,7 +34,7 @@ } # the initial values of the guesses (if midpoint==FALSE) - basis <- thermo$basis + basis <- get("thermo")$basis # a hack so that we can use pH as a variable if("pH" %in% names(lims)) { @@ -224,7 +224,7 @@ for(i in which) { niter <- length(x$value[[i]]) ylab <- names(x$value)[i] - if(ylab %in% c(rownames(thermo$basis),"T","P","pH","Eh")) ylab <- axis.label(ylab) + if(ylab %in% c(rownames(get("thermo")$basis),"T","P","pH","Eh")) ylab <- axis.label(ylab) # the values plot(1:niter,x$value[[i]],xlab=xlab,ylab=ylab,...) lines(1:niter,x$value[[i]]) Modified: pkg/CHNOSZ/R/hkf.R =================================================================== --- pkg/CHNOSZ/R/hkf.R 2013-03-14 01:06:37 UTC (rev 47) +++ pkg/CHNOSZ/R/hkf.R 2013-03-15 01:23:23 UTC (rev 48) @@ -6,6 +6,7 @@ H2O.PT=NULL,H2O.PrTr=NULL,domega=TRUE) { # calculate G, H, S, Cp, V, kT, and/or E using # the revised HKF equations of state + thermo <- get("thermo") # constants Tr <- thermo$opt$Tr Pr <- thermo$opt$Pr Modified: pkg/CHNOSZ/R/info.R =================================================================== --- pkg/CHNOSZ/R/info.R 2013-03-14 01:06:37 UTC (rev 47) +++ pkg/CHNOSZ/R/info.R 2013-03-15 01:23:23 UTC (rev 48) @@ -9,7 +9,7 @@ info.text <- function(ispecies) { # a textual description of species name, formula, source, e.g. # CO2 [CO2(aq)] (SSW01, SHS89, 11.Oct.07) - this <- thermo$obigt[ispecies, ] + this <- get("thermo")$obigt[ispecies, ] sourcetext <- this$ref1 ref2 <- this$ref2 if(!is.na(ref2)) sourcetext <- paste(sourcetext, ref2, sep=", ") @@ -24,6 +24,7 @@ # thermo$obigt$[species|abbrv|formula] or NA otherwise # a match to thermo$obigt$state is also required if 'state' is not NULL # (first occurence of a match to species is returned otherwise) + thermo <- get("thermo") # all matches for the species matches.species <- thermo$obigt$name==species | thermo$obigt$abbrv==species | thermo$obigt$formula==species @@ -49,6 +50,7 @@ eos <- aa2eos(aa, state) # the real assignment work nrows <- suppressMessages(mod.obigt(eos)) + thermo <- get("thermo", "CHNOSZ") matches.species <- rep(FALSE, nrows) matches.species[nrows] <- TRUE } else return(NA) @@ -59,7 +61,7 @@ # special treatment for H2O: aq retrieves the liq if(species %in% c("H2O", "water") & state=="aq") state <- "liq" # the matches for both species and state - matches.state <- matches.species & grepl(state, thermo$obigt$state) + matches.state <- matches.species & grepl(state, get("thermo")$obigt$state) if(!any(matches.state)) { # the requested state is not available for this species available.states <- thermo$obigt$state[matches.species] @@ -95,6 +97,7 @@ info.numeric <- function(ispecies, check.it=TRUE) { # from a numeric species index in 'ispecies' return the # thermodynamic properties and equations-of-state parameters + thermo <- get("thermo") # if we're called with NA, return an empty row if(is.na(ispecies)) { this <- thermo$obigt[1,] @@ -148,6 +151,7 @@ # returns species indices that have an approximate match of 'species' # to thermo$obigt$[name|abbrv|formula], # possibly restricted to a given state + thermo <- get("thermo") if(!is.null(state)) this <- thermo$obigt[thermo$obigt$state==state, ] else this <- thermo$obigt # only look for fairly close matches @@ -179,6 +183,7 @@ info <- function(species=NULL, state=NULL, check.it=TRUE) { ## return information for one or more species in thermo$obigt ## if no species are requested, summarize the available data 20101129 + thermo <- get("thermo") if(is.null(species)) { msgout("info: 'species' is NULL; summarizing information about thermodynamic data...\n") msgout(paste("thermo$obigt has", nrow(thermo$obigt[thermo$obigt$state=="aq", ]), "aqueous,", Modified: pkg/CHNOSZ/R/iprotein.R =================================================================== --- pkg/CHNOSZ/R/iprotein.R 2013-03-14 01:06:37 UTC (rev 47) +++ pkg/CHNOSZ/R/iprotein.R 2013-03-15 01:23:23 UTC (rev 48) @@ -15,6 +15,7 @@ # 'protein' numeric (the rownumber itself) # 'protein' character, e.g. LYSC_CHICK # 'protein' and 'organism', e.g. 'LYSC', 'CHICK' + thermo <- get("thermo") if(is.numeric(protein)) { iproteins <- 1:nrow(thermo$protein) protein[!protein %in% iproteins] <- NA @@ -42,13 +43,13 @@ iprotein <- iprotein(protein, organism) # drop NA matches iprotein <- iprotein[!is.na(iprotein)] - out <- thermo$protein[iprotein, ] + out <- get("thermo")$protein[iprotein, ] # compute per-residue counts if(residue) out[, 5:25] <- out[, 5:25]/rowSums(out[, 6:25]) return(out) } -aa2eos <- function(aa, state=thermo$opt$state) { +aa2eos <- function(aa, state=get("thermo")$opt$state) { # display and return the properties of # proteins calculated from amino acid composition # the names of the protein backbone groups depend on the state @@ -60,10 +61,11 @@ groups <- paste("[", groups, "]", sep="") # the rownumbers of the groups in thermo$obigt groups_state <- paste(groups, state) - obigt_state <- paste(thermo$obigt$name, thermo$obigt$state) + obigt <- get("thermo")$obigt + obigt_state <- paste(obigt$name, obigt$state) igroup <- match(groups_state, obigt_state) # the properties are in columns 8-20 of thermo$obigt - groupprops <- thermo$obigt[igroup, 8:20] + groupprops <- obigt[igroup, 8:20] # the elements in each of the groups groupelements <- i2A(igroup) # a function to work on a single row of aa @@ -150,7 +152,7 @@ read.aa <- function(file="protein.csv") { # 20090428 added colClasses here aa <- read.csv(file,colClasses=c(rep("character",4),rep("numeric",21))) - if(!identical(colnames(aa), colnames(thermo$protein))) + if(!identical(colnames(aa), colnames(get("thermo")$protein))) stop(paste("format of", file, "is incompatible with thermo$protein")) return(aa) } @@ -158,16 +160,20 @@ add.protein <- function(aa) { # add a properly constructed data frame of # amino acid counts to thermo$protein - if(!identical(colnames(aa), colnames(thermo$protein))) + thermo <- get("thermo") + if(!identical(colnames(aa), colnames(thermo$protein))) stop("the value of 'aa' is not a data frame with the same columns as thermo$protein") # find any protein IDs that are duplicated po <- paste(aa$protein, aa$organism, sep="_") ip <- suppressMessages(iprotein(po)) ipdup <- !is.na(ip) # now we're ready to go - if(!all(ipdup)) thermo$protein <<- rbind(thermo$protein, aa[!ipdup, ]) - if(any(ipdup)) thermo$protein[ip[ipdup], ] <<- aa[ipdup, ] - rownames(thermo$protein) <<- NULL + tp.new <- thermo$protein + if(!all(ipdup)) tp.new <- rbind(tp.new, aa[!ipdup, ]) + if(any(ipdup)) tp.new[ip[ipdup], ] <- aa[ipdup, ] + rownames(tp.new) <- NULL + thermo$protein <- tp.new + assign("thermo", thermo, "CHNOSZ") # return the new rownumbers ip <- iprotein(po) # make some noise Modified: pkg/CHNOSZ/R/makeup.R =================================================================== --- pkg/CHNOSZ/R/makeup.R 2013-03-14 01:06:37 UTC (rev 47) +++ pkg/CHNOSZ/R/makeup.R 2013-03-15 01:23:23 UTC (rev 48) @@ -222,6 +222,7 @@ } # if the formula argument is numeric, get the formula # of that species number in thermo$obigt + thermo <- get("thermo") if(is.numeric(formula)) formula <- thermo$obigt$formula[formula] # first deal with charge cc <- count.charge(formula) Modified: pkg/CHNOSZ/R/protein.info.R =================================================================== --- pkg/CHNOSZ/R/protein.info.R 2013-03-14 01:06:37 UTC (rev 47) +++ pkg/CHNOSZ/R/protein.info.R 2013-03-15 01:23:23 UTC (rev 48) @@ -96,6 +96,7 @@ G.Z <- rep(NA, length(pname)) ZC <- ZC(pf) # run ionization calculations if we have H+ + thermo <- get("thermo") if(!is.null(thermo$basis)) { iHplus <- match("H+", rownames(thermo$basis)) if(!is.na(iHplus)) { @@ -143,6 +144,7 @@ # what are the coefficients of the basis species in the formation reactions sb <- species.basis(pf) # calculate ionization states if H+ is a basis species + thermo <- get("thermo") iHplus <- match("H+", rownames(thermo$basis)) if(!is.na(iHplus)) { pH <- -thermo$basis$logact[iHplus] @@ -169,6 +171,7 @@ pname <- paste(aa$protein, aa$organism, sep="_") plength <- protein.length(aa) # use thermo$basis to decide whether to ionize the proteins + thermo <- get("thermo") ionize.it <- FALSE iword <- "nonionized" bmat <- basis.matrix() Modified: pkg/CHNOSZ/R/species.R =================================================================== --- pkg/CHNOSZ/R/species.R 2013-03-14 01:06:37 UTC (rev 47) +++ pkg/CHNOSZ/R/species.R 2013-03-15 01:23:23 UTC (rev 48) @@ -44,6 +44,7 @@ # 20080925 default quiet=TRUE 20101003 default quiet=FALSE # 20120128 remove 'quiet' argument (messages can be hidden with suppressMessages()) # 20120523 return thermo$species instead of rownumbers therein, and remove message showing thermo$species + thermo <- get("thermo") ## argument processing # we can't deal with NA species if(identical(species, NA)) { @@ -55,7 +56,8 @@ if(delete) { # delete the entire definition if requested if(is.null(species)) { - thermo$species <<- NULL + thermo$species <- NULL + assign("thermo", thermo, "CHNOSZ") return(thermo$species) } # from here we're trying to delete already defined species @@ -73,9 +75,10 @@ isp <- isp[!ina] # go on to delete this/these species if(length(isp) > 0) { - thermo$species <<- thermo$species[-isp,] - if(nrow(thermo$species)==0) thermo$species <<- NULL - else rownames(thermo$species) <<- 1:nrow(thermo$species) + thermo$species <- thermo$species[-isp,] + if(nrow(thermo$species)==0) thermo$species <- NULL + else rownames(thermo$species) <- 1:nrow(thermo$species) + assign("thermo", thermo, "CHNOSZ") } return(thermo$species) } @@ -109,6 +112,8 @@ if(!any(is.na(ispecies)) & !is.null(logact)) return(species(ispecies, state=logact, index.return=index.return)) # look for species in thermo$obigt iobigt <- suppressMessages(info(species, state)) + # since that could have updated thermo$obigt (with proteins), re-read thermo + thermo <- get("thermo", "CHNOSZ") # check if we got all the species ina <- is.na(iobigt) if(any(ina)) stop(paste("species not available:", paste(species[ina], collapse=" "))) @@ -134,19 +139,19 @@ } # create the new species newspecies <- data.frame(f, ispecies=iobigt, logact=logact, state=state, name=name, stringsAsFactors=FALSE) - # nasty for R, but "H2PO4-" looks better than "H2PO4." + # "H2PO4-" looks better than "H2PO4." colnames(newspecies)[1:nrow(thermo$basis)] <- rownames(thermo$basis) # initialize or add to species data frame if(is.null(thermo$species)) { - thermo$species <<- newspecies + thermo$species <- newspecies ispecies <- 1:nrow(thermo$species) } else { # don't add species that already exist idup <- newspecies$ispecies %in% thermo$species$ispecies - thermo$species <<- rbind(thermo$species, newspecies[!idup, ]) + thermo$species <- rbind(thermo$species, newspecies[!idup, ]) ispecies <- match(newspecies$ispecies, thermo$species$ispecies) } - rownames(thermo$species) <<- seq(nrow(thermo$species)) + rownames(thermo$species) <- seq(nrow(thermo$species)) } else { # update activities or states of existing species # first get the rownumbers in thermo$species @@ -160,7 +165,7 @@ } else ispecies <- match(species, thermo$species$name) # replace activities? if(!is.null(logact)) { - thermo$species$logact[ispecies] <<- logact + thermo$species$logact[ispecies] <- logact } else { # change states, checking for availability of the desired state for(i in 1:length(ispecies)) { @@ -182,13 +187,14 @@ warning(paste("can't update state of species", ispecies[i], "to", state[i], "\n"), call.=FALSE) else { ii <- match(state[i], thermo$obigt$state[iobigt]) - thermo$species$state[ispecies[i]] <<- state[i] - thermo$species$name[ispecies[i]] <<- thermo$obigt$name[iobigt[ii]] - thermo$species$ispecies[ispecies[i]] <<- as.numeric(rownames(thermo$obigt)[iobigt[ii]]) + thermo$species$state[ispecies[i]] <- state[i] + thermo$species$name[ispecies[i]] <- thermo$obigt$name[iobigt[ii]] + thermo$species$ispecies[ispecies[i]] <- as.numeric(rownames(thermo$obigt)[iobigt[ii]]) } } } } + assign("thermo", thermo, "CHNOSZ") # return the new species definition or the index(es) of affected species if(index.return) return(ispecies) else return(thermo$species) Modified: pkg/CHNOSZ/R/subcrt.R =================================================================== --- pkg/CHNOSZ/R/subcrt.R 2013-03-14 01:06:37 UTC (rev 47) +++ pkg/CHNOSZ/R/subcrt.R 2013-03-15 01:23:23 UTC (rev 48) @@ -96,6 +96,7 @@ } # get species information + thermo <- get("thermo") # pre-20110808, we sent numeric species argument through info() to # get species name and state(s) # but why slow things down if we already have a species index? @@ -115,6 +116,8 @@ mysearch <- species[i] if(can.be.numeric(mysearch)) mysearch <- thermo$obigt$name[as.numeric(mysearch)] si <- info.character(mysearch, state[i]) + # that could have the side-effect of adding a protein; re-read thermo + thermo <- get("thermo", "CHNOSZ") if(is.na(si[1])) stop('no info found for ',species[i],' ',state[i]) if(!is.null(state[i])) is.cr <- state[i]=='cr' else is.cr <- FALSE if(thermo$obigt$state[si[1]]=='cr1' & (is.null(state[i]) | is.cr)) { Modified: pkg/CHNOSZ/R/swap.basis.R =================================================================== --- pkg/CHNOSZ/R/swap.basis.R 2013-03-14 01:06:37 UTC (rev 47) +++ pkg/CHNOSZ/R/swap.basis.R 2013-03-15 01:23:23 UTC (rev 48) @@ -3,17 +3,17 @@ # extracted from basis() 20120114 jmd # return the current basis matrix -basis.matrix <- function(basis = thermo$basis) { +basis.matrix <- function(basis = get("thermo")$basis) { if(is.null(basis)) stop("basis species are not defined") return(as.matrix(basis[, 1:nrow(basis), drop=FALSE])) } # calculate chemical potentials of elements from logarithms of activity of basis species -element.mu <- function(basis = thermo$basis, T = 25) { +element.mu <- function(basis = get("thermo")$basis, T = 25) { # matrix part of the basis definition basis.mat <- basis.matrix(basis) # the standard Gibbs energies of the basis species - if(T==25) G <- thermo$obigt$G[basis$ispecies] + if(T==25) G <- get("thermo")$obigt$G[basis$ispecies] else G <- unlist(subcrt(basis$ispecies, T=T, property="G")$out) # chemical potentials of the basis species species.mu <- G - convert(basis$logact, "G") @@ -25,7 +25,7 @@ } # calculate logarithms of activity of basis species from chemical potentials of elements -basis.logact <- function(emu, basis = thermo$basis, T = 25) { +basis.logact <- function(emu, basis = get("thermo")$basis, T = 25) { # matrix part of the basis definition basis.mat <- basis.matrix(basis) # elements in emu can't be less than the number in the basis @@ -35,7 +35,7 @@ # check that elements of basis.mat and emu are identical if(any(is.na(ielem))) stop(paste("element(s)", paste(names(emu)[is.na(ielem)], collapse=" "), "not found in basis")) # the standard Gibbs energies of the basis species - if(T==25) G <- thermo$obigt$G[basis$ispecies] + if(T==25) G <- get("thermo")$obigt$G[basis$ispecies] else G <- unlist(subcrt(basis$ispecies, T=T, property="G")$out) # the chemical potentials of the basis species in equilibrium # with the chemical potentials of the elements @@ -50,7 +50,7 @@ # swap in one basis species for another swap.basis <- function(species, species2) { # before we do anything, remember the old basis definition - oldbasis <- thermo$basis + oldbasis <- get("thermo")$basis # and the species definition ts <- species() # the delete the species @@ -85,7 +85,7 @@ # restore species if they were defined if(!is.null(ts)) { suppressMessages(species(ts$ispecies)) - suppressMessages(species(1:nrow(thermo$species), ts$logact)) + suppressMessages(species(1:nrow(get("thermo")$species), ts$logact)) } # all done, return the new basis definition return(mb) Modified: pkg/CHNOSZ/R/transfer.R =================================================================== --- pkg/CHNOSZ/R/transfer.R 2013-03-14 01:06:37 UTC (rev 47) +++ pkg/CHNOSZ/R/transfer.R 2013-03-15 01:23:23 UTC (rev 48) @@ -32,6 +32,7 @@ logpresent <- -50 # the starting (basis0) and current (basis) # species and basis conditions + thermo <- get("thermo") basis <- basis0 <- thermo$basis species <- species0 <- thermo$species dmode0 <- dmode @@ -103,7 +104,8 @@ # the slow way, short version # we have to use basis species w/o the PBB tempbasis <- basis1[rownames(basis1)!="PBB",] - thermo$basis <<- tempbasis + thermo$basis <- tempbasis + assign("thermo", thermo, "CHNOSZ") # the slow way, long-winded version # (recreating affinity's call to buffer so # we can store the intermediate results) @@ -135,8 +137,9 @@ #ibuf <- buffargs$ibasis oldbasis <- thermo$basis oldspecies <- thermo$species - thermo$basis <<- buffstuff$bufbasis - thermo$species <<- buffstuff$bufspecies + thermo$basis <- buffstuff$bufbasis + thermo$species <- buffstuff$bufspecies + assign("thermo", thermo, "CHNOSZ") is.buffer <- buffargs$is.buffer for(i in 1:length(ibuf)) { ib <- is.buffer[[i]] @@ -147,8 +150,9 @@ if(i==1) br <- bresult else br <- c(br,bresult) } bresult <- br - thermo$basis <<- oldbasis - thermo$species <<- oldspecies + thermo$basis <- oldbasis + thermo$species <- oldspecies + assign("thermo", thermo, "CHNOSZ") } for(i in 1:length(ibuf)) { # reference to the moles of species @@ -287,9 +291,10 @@ # get the affinities for the first step getaff <- function(mybl,sout=NULL) { # do it for unit activities of minerals (and proteins?) - thermo$species$logact <<- 0 + thermo$species$logact <- 0 # prevent the PBB from getting in here - thermo$basis$logact <<- mybl[1:nrow(basis0)] + thermo$basis$logact <- mybl[1:nrow(basis0)] + assign("thermo", thermo, "CHNOSZ") if(is.null(sout)) { # on the first step only, grab the intermediate results # they are kept around for reasons of speed @@ -740,8 +745,9 @@ # this is the second place to be careful of PBB if('PBB' %in% rownames(basis)) basis$logact <- c(basis0$logact,0) else basis$logact <- basis0$logact - thermo$basis <<- basis0 - thermo$species <<- species0 + thermo$basis <- basis0 + thermo$species <- species0 + assign("thermo", thermo, "CHNOSZ") # report the success rate and total progress aaa <- alphas @@ -800,7 +806,7 @@ # or feldspar("open") # setup conditions for feldspar reaction #basis(c('Al+3','SiO2','K+','H2O','H+','O2')) - thermo$basis <<- NULL + basis(delete=TRUE) # SLS89 use H4SiO4 instead of SiO2 basis(c('Al+3','H4SiO4','K+','H2O','H+','O2')) # some of SLS89's initial conditions @@ -849,7 +855,7 @@ # apc("many") # apc("buffer") # assign basis species - thermo$basis <<- NULL + basis(delete=TRUE) if(basis=="CO2") basis(c("CO2","H2O","NH3","H2","H2S"),c(-10,0,-4,-10,-7)) else if(basis=="acetic") basis(c("acetic acid","H2O","NH3","H2","H2S"),c(-5.5,0,-4,-10,-7)) basis("H2","aq") Modified: pkg/CHNOSZ/R/util.affinity.R =================================================================== --- pkg/CHNOSZ/R/util.affinity.R 2013-03-14 01:06:37 UTC (rev 47) +++ pkg/CHNOSZ/R/util.affinity.R 2013-03-15 01:23:23 UTC (rev 48) @@ -1,7 +1,7 @@ # CHNOSZ/util-affinity.R # helper functions for affinity() -energy <- function(what,vars,vals,lims,T=thermo$opt$Tr,P="Psat",IS=0,sout=NULL,exceed.Ttr=FALSE,transect=FALSE) { +energy <- function(what,vars,vals,lims,T=get("thermo")$opt$Tr,P="Psat",IS=0,sout=NULL,exceed.Ttr=FALSE,transect=FALSE) { # 20090329 extracted from affinity() and made to # deal with >2 dimensions (variables) @@ -21,7 +21,7 @@ mybasis <- basis() nbasis <- nrow(mybasis) ## species definition / number of species - myspecies <- thermo$species + myspecies <- get("thermo")$species if(is.character(what)) { if(is.null(myspecies)) stop('species properties requested, but species have not been defined') nspecies <- nrow(myspecies) @@ -222,6 +222,7 @@ # over which to calculate logQ, logK and affinity # the names should be T, P, IS and names of basis species # (or pH, pe, Eh) + thermo <- get("thermo") ## inputs are like c(T1,T2,res) # and outputs are like seq(T1,T2,length.out=res) # unless transect: do the variables specify a transect? 20090627 @@ -373,7 +374,7 @@ return(a) } -A.ionization <- function(iprotein, vars, vals, T=thermo$opt$Tr, P="Psat", pH=7, transect=FALSE) { +A.ionization <- function(iprotein, vars, vals, T=get("thermo")$opt$Tr, P="Psat", pH=7, transect=FALSE) { # a function to build a list of values of A/2.303RT of protein ionization # that can be used by energy(); 20120527 jmd # some of the variables might not affect the values (e.g. logfO2) Modified: pkg/CHNOSZ/R/util.args.R =================================================================== --- pkg/CHNOSZ/R/util.args.R 2013-03-14 01:06:37 UTC (rev 47) +++ pkg/CHNOSZ/R/util.args.R 2013-03-15 01:23:23 UTC (rev 48) @@ -8,7 +8,7 @@ # things we also get with water props <- c(props,'A','U','Cv','Psat','rho','Q','X','Y','epsilon','w') # they keep on coming: things we also get with SUPCRT92 - if(length(agrep(tolower(thermo$opt$water),'supcrt9',max.distance=0.3))>0) + if(get("thermo")$opt$water == "SUPCRT92") props <- c(props,'Z','visc','tcond','tdiff','Prndtl','visck','albe','daldT','alpha','beta') else props <- c(props,'P','N','UBorn','de.dT','de.dP') [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/chnosz -r 48 From noreply at r-forge.r-project.org Sun Mar 24 08:04:53 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 24 Mar 2013 08:04:53 +0100 (CET) Subject: [CHNOSZ-commits] r49 - in pkg/CHNOSZ: . R inst inst/doc inst/extdata/bison inst/extdata/refseq man Message-ID: <20130324070453.A098A183B6A@r-forge.r-project.org> Author: jedick Date: 2013-03-24 08:04:53 +0100 (Sun, 24 Mar 2013) New Revision: 49 Added: pkg/CHNOSZ/inst/extdata/bison/bisonN_vs_refseq57.blastp.xz pkg/CHNOSZ/inst/extdata/bison/bisonP_vs_refseq57.blastp.xz pkg/CHNOSZ/inst/extdata/bison/bisonQ_vs_refseq57.blastp.xz pkg/CHNOSZ/inst/extdata/bison/bisonR_vs_refseq57.blastp.xz pkg/CHNOSZ/inst/extdata/bison/bisonS_vs_refseq57.blastp.xz pkg/CHNOSZ/inst/extdata/refseq/trim_refseq.R Removed: pkg/CHNOSZ/inst/doc/anintro.pdf pkg/CHNOSZ/inst/doc/equilibrium.pdf pkg/CHNOSZ/inst/doc/hotspring.pdf pkg/CHNOSZ/inst/doc/wjd.pdf pkg/CHNOSZ/inst/extdata/bison/bisonN_vs_refseq55.blastp.xz pkg/CHNOSZ/inst/extdata/bison/bisonP_vs_refseq55.blastp.xz pkg/CHNOSZ/inst/extdata/bison/bisonQ_vs_refseq55.blastp.xz pkg/CHNOSZ/inst/extdata/bison/bisonR_vs_refseq55.blastp.xz pkg/CHNOSZ/inst/extdata/bison/bisonS_vs_refseq55.blastp.xz Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/R/diagram.R pkg/CHNOSZ/R/revisit.R pkg/CHNOSZ/R/util.data.R pkg/CHNOSZ/inst/CHECKLIST pkg/CHNOSZ/inst/NEWS pkg/CHNOSZ/inst/extdata/bison/gi.taxid.txt.xz pkg/CHNOSZ/inst/extdata/refseq/README.txt pkg/CHNOSZ/inst/extdata/refseq/gencat.sh pkg/CHNOSZ/inst/extdata/refseq/mkfaa.sh pkg/CHNOSZ/inst/extdata/refseq/protein_refseq.csv.xz pkg/CHNOSZ/inst/extdata/refseq/taxid.names.R pkg/CHNOSZ/inst/extdata/refseq/taxid_names.csv.xz pkg/CHNOSZ/man/extdata.Rd pkg/CHNOSZ/man/protein.info.Rd pkg/CHNOSZ/man/sideeffects.Rd pkg/CHNOSZ/man/util.blast.Rd Log: update extdata/refseq for RefSeq release 57 Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2013-03-15 01:23:23 UTC (rev 48) +++ pkg/CHNOSZ/DESCRIPTION 2013-03-24 07:04:53 UTC (rev 49) @@ -1,11 +1,11 @@ -Date: 2013-03-15 +Date: 2013-03-24 Package: CHNOSZ -Version: 0.9-9.9 +Version: 0.9-9.10 Title: Chemical Thermodynamics and Activity Diagrams Author: Jeffrey M. Dick -Maintainer: Jeffrey M. Dick +Maintainer: Jeffrey M. Dick Depends: R (>= 2.12.0), utils -Suggests: testthat, parallel, limSolve +Suggests: limSolve, parallel, testthat Description: This package includes functions and data sets to support chemical thermodynamic modeling in biochemistry and low-temperature geochemistry. The features include calculation of the standard molal thermodynamic properties and chemical affinities of reactions involving Modified: pkg/CHNOSZ/R/diagram.R =================================================================== --- pkg/CHNOSZ/R/diagram.R 2013-03-15 01:23:23 UTC (rev 48) +++ pkg/CHNOSZ/R/diagram.R 2013-03-24 07:04:53 UTC (rev 49) @@ -288,7 +288,7 @@ iy <- which(y1==y2) ys[iy*2] <- NA # no line segment at a dotted position - iyd <- which(ys%%dotted==0) + iyd <- rowSums(sapply(dotted, function(y) ys%%y==0)) > 0 ys[iyd] <- NA return(list(xs=xs, ys=ys)) } @@ -302,17 +302,17 @@ ix <- which(x1==x2) xs[ix*2] <- NA # no line segment at a dotted position - ixd <- which(xs%%dotted==0) + ixd <- rowSums(sapply(dotted, function(x) xs%%x==0)) > 0 xs[ixd] <- NA return(list(xs=xs, ys=ys)) } clipfun <- function(z, zlim) { if(zlim[2] > zlim[1]) { - z[z>zlim[2]] <- zlim[2] - z[zzlim[2]] <- NA + z[zzlim[1]] <- zlim[1] - z[zzlim[1]] <- NA + z[z urllist -4. download the files using 'wget -i urllist' [1821 files, 2.8 GB] -5. move the .gz files to a directory named 'protein' -6. run ls protein/*.gz > filelist -7. use 'mkfaa.sh' to combine the sequences into a single file 'refseq55.faa' [5.5 GB, ~4 minutes] +3. download the files using 'wget -i urllist' [3227 files, 4.6 GB] +4. move the .gz files to a directory named 'protein' # protein stuff -8. use 'gencat.sh' to generate gi.taxid.txt from RefSeq-release55.catalog [3 minutes] - note that the intermediate file gi.taxid.unsrt may have to be edited manually - -- see instructions in gencat.sh - when done, the output of 'cat gi.taxid.txt | wc -l' - should be equal to 'grep "^>" refseq55.faa | wc -l' - (for microbial proteins in RefSeq 55, the number is 14162697) -9. generate protein_refseq.csv in R: [~8.9 hours] +5. gzip -d RefSeq-release57.catalog.gz [3.1 GB] +6. use 'gencat.sh' to generate gi.taxid.txt for microbial proteins in the catalog [7 minutes] + for RefSeq57, 'cat gi.taxid.txt | wc -l' is 24488527 +7. generate protein_refseq.csv in R: [~19 hours] > source("protein.refseq.R") > protein.refseq() note that this depends on gi.taxid.txt and the .faa.gz files in the 'protein' directory +8. trim entries from protein_refseq.csv (smaller size, better for package distribution) + > source("trim_refseq.R") # taxonomy stuff -10. edit 'taxid.names.R' so that 'taxdir' points to the directory where the files +9. edit 'taxid.names.R' so that 'taxdir' points to the directory where the files 'names.dmp' and 'nodes.dmp' are present. these files can be downloaded from - ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz (accessed on 2012-09-19) -11. source 'taxid.names.R' to generate the file 'taxid_names.csv' [~2.5 hours] + ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz (accessed on 2013-01-15) +10. source 'taxid.names.R' to generate the file 'taxid_names.csv' [~4.5 hours] + +# BLAST stuff (optional) +11. run ls protein/*.gz > filelist +12. use 'mkfaa.sh' to combine the sequences into a single file 'refseq57.faa' [9.3 GB, 11 minutes] + for RefSeq57, 'grep "^>" refseq57.faa | wc -l' is 24477649 + the difference from the catalog (step 6 above), is 10878 sequences: + taxid 1211777 (Rhizobium mesoamericanum STM3625) (6356 sequences) + taxid 313627 (Bacillus sp. NRRL B-14911) (4522 sequences) +13. make a BLAST database, e.g. formatdb -t refseq57 -i refseq57.faa -p T + Modified: pkg/CHNOSZ/inst/extdata/refseq/gencat.sh =================================================================== --- pkg/CHNOSZ/inst/extdata/refseq/gencat.sh 2013-03-15 01:23:23 UTC (rev 48) +++ pkg/CHNOSZ/inst/extdata/refseq/gencat.sh 2013-03-24 07:04:53 UTC (rev 49) @@ -1,6 +1,6 @@ #/bin/sh # extract microbial, genomic records from the RefSeq catalog -RELEASE=55 +RELEASE=57 ORG=microbial MOL=protein BASENAME=RefSeq-release$RELEASE.catalog @@ -12,20 +12,16 @@ # alternatively, could use egrep: #egrep "[[:space:]]AP_ | [[:space:]]NP_ | [[:space:]]XP_ | \ # [[:space:]]YP_ | [[:space:]]ZP_" $BASENAME.$ORG > $BASENAME.$ORG.$MOL -grep "[[:space:]]AP_" $BASENAME.$ORG > $BASENAME.$ORG.$MOL -grep "[[:space:]]NP_" $BASENAME.$ORG >> $BASENAME.$ORG.$MOL -grep "[[:space:]]XP_" $BASENAME.$ORG >> $BASENAME.$ORG.$MOL -grep "[[:space:]]YP_" $BASENAME.$ORG >> $BASENAME.$ORG.$MOL -grep "[[:space:]]ZP_" $BASENAME.$ORG >> $BASENAME.$ORG.$MOL +grep "[[:space:]]AP_" $BASENAME.$ORG > $BASENAME.$ORG.$MOL # 0 records +grep "[[:space:]]NP_" $BASENAME.$ORG >> $BASENAME.$ORG.$MOL # 450218 records +grep "[[:space:]]XP_" $BASENAME.$ORG >> $BASENAME.$ORG.$MOL # 0 records +grep "[[:space:]]YP_" $BASENAME.$ORG >> $BASENAME.$ORG.$MOL # 6786156 records +grep "[[:space:]]ZP_" $BASENAME.$ORG >> $BASENAME.$ORG.$MOL # 17252153 records -# to save only the gi, taxid and sequence length columns -cat $BASENAME.$ORG.$MOL | awk '{FS="\t"} {print $4,$1,$7}' > gi.taxid.unsrt +# to save only the gi, taxid and sequence length columns, in that order +# the field separator (tab) is defined in command line, not in awk program, +# otherwise the first line gets processed incorrectly +cat $BASENAME.$ORG.$MOL | awk -F\\t '{print $4,$1,$7}' > gi.taxid.unsrt -# for some reason the first line in gi.taxid.unsrt needs to be corrected manually -# (found using both RefSeq 45 and 47) -# str. 316407 W3110 --> 89106885 316407 21 -# (using RefSeq 49 and 55) -# NP_047184.1 9 PROVISIONAL --> 10954455 9 280 - # sort the file on gi so that it can be used with e.g. the unix 'join' command cat gi.taxid.unsrt | sort > gi.taxid.txt Modified: pkg/CHNOSZ/inst/extdata/refseq/mkfaa.sh =================================================================== --- pkg/CHNOSZ/inst/extdata/refseq/mkfaa.sh 2013-03-15 01:23:23 UTC (rev 48) +++ pkg/CHNOSZ/inst/extdata/refseq/mkfaa.sh 2013-03-24 07:04:53 UTC (rev 49) @@ -1,6 +1,6 @@ # send the contents of all the .faa.gz files to a single file ("OUTFILE") -OUTFILE="refseq55.faa" +OUTFILE="refseq57.faa" FILELIST="filelist" # start with an empty file Modified: pkg/CHNOSZ/inst/extdata/refseq/protein_refseq.csv.xz =================================================================== (Binary files differ) Modified: pkg/CHNOSZ/inst/extdata/refseq/taxid.names.R =================================================================== --- pkg/CHNOSZ/inst/extdata/refseq/taxid.names.R 2013-03-15 01:23:23 UTC (rev 48) +++ pkg/CHNOSZ/inst/extdata/refseq/taxid.names.R 2013-03-24 07:04:53 UTC (rev 49) @@ -3,7 +3,7 @@ # for each of the microbial taxa in RefSeq database # change this to the location where names.dmp and nodes.dmp are located -taxdir <- "/home/download/sequences/taxonomy/refseq55" +taxdir <- "./taxdump" # get the taxids from protein_refseq.csv pr <- read.csv("protein_refseq.csv.xz") Modified: pkg/CHNOSZ/inst/extdata/refseq/taxid_names.csv.xz =================================================================== (Binary files differ) Added: pkg/CHNOSZ/inst/extdata/refseq/trim_refseq.R =================================================================== --- pkg/CHNOSZ/inst/extdata/refseq/trim_refseq.R (rev 0) +++ pkg/CHNOSZ/inst/extdata/refseq/trim_refseq.R 2013-03-24 07:04:53 UTC (rev 49) @@ -0,0 +1,66 @@ +# trim the protein_refseq.csv, removing some entries with highly-represented names +# (to keep the file size down for CHNOSZ package) +# 20130320 jmd + +# the original file (7415 rows) +pr <- read.csv("protein_refseq.csv") +# the common names (comments show number in RefSeq 57 +names <- c( + "Escherichia coli", # 662 + "Streptococcus", # 432 + "Salmonella", # 299 + "Staphylococcus", # 290 + "Enterococcus", # 218 + "Vibrio", # 190 + "Lactobacillus", # 179 + "Helicobacter", # 164 + "Pseudomonas", # 155 + "Mycobacterium", # 138 + "Campylobacter", # 131 + "Neisseria", # 121 + "Clostridium", # 118 + "Yersinia", # 111 + "Bacillus cereus", # 105 + "Acinetobacter", # 103 + "Propionibacterium", # 93 + "Burkholderia", # 91 + "Candidatus", # 83 + "Bacteroides", # 80 + "Mycoplasma", # 73 + "Streptomyces", # 72 + "Corynebacterium", # 70 + "Listeria", # 60 + "Leptospira", # 57 + "Klebsiella", # 57 + "Bifidobacterium", # 55 + "Brucella", # 53 + "Shigella", # 50 + "Haemophilus", # 47 + "Rickettsia", # 46 + "Prevotella", # 44 + "Chlamydia", # 42 + "Francisella", # 37 + "Bacillus thuringiensis", # 36 + "Borrelia", # 34 + "Fusobacterium", # 33 + "Xanthomonas", # 31 + "Rhizobium", # 27 + "Bartonella", # 26 + "Pseudoalteromonas", # 24 + "Bacillus anthracis", # 23 + "Actinomyces", # 23 + "Treponema", # 21 + "Actinobacillus", # 20 + "Aggregatibacter", # 20 + "Gardnerella" # 19 +) + +# loop over the names, identify rows, leave the first row +for(name in names) { + iname <- grep(name, pr$ref) + iname <- tail(iname, -1) + pr <- pr[-iname, ] +} + +# we're left with 2600 rows +write.csv(pr, "protein_refseq.csv", row.names=FALSE) Modified: pkg/CHNOSZ/man/extdata.Rd =================================================================== --- pkg/CHNOSZ/man/extdata.Rd 2013-03-15 01:23:23 UTC (rev 48) +++ pkg/CHNOSZ/man/extdata.Rd 2013-03-24 07:04:53 UTC (rev 49) @@ -21,7 +21,7 @@ Files in \code{bison} contain BLAST results and taxonomic information for a metagenome: \itemize{ - \item \code{bisonN_vs_refseq55.blast.xz}, \code{bisonS_vs_refseq55.blast.xz}, \code{bisonR_vs_refseq55.blast.xz}, \code{bisonQ_vs_refseq55.blast.xz}, \code{bisonP_vs_refseq55.blast.xz} are partial tabular BLAST results for proteins in the Bison Pool Environmental Genome. Protein sequences predicted in the metagenome were downloaded from the Joint Genome Institute's IMG/M system on 2009-05-13. The target database for the searches was constructed from microbial protein sequences in National Center for Biotechnology Information (NCBI) RefSeq database version 55, representing 4567 microbial genomes. The \sQuote{blastall} command was used with the default setting for E value cuttoff (10.0) and options to make a tabular output file consisting of the top 20 hits for each query sequence. The function \code{\link{read.blast}} was used to extract only those hits with E values less than or equal to 1e-5 and with sequence similarity (percent identity) at least 30 percent, and to keep only the first hit for each query sequence. The function \code{\link{write.blast}} was used to save partial BLAST files (only selected columns). The files provided with CHNOSZ contain the first 5,000 hits for each sampling site at Bison Pool, representing between about 7 to 15 percent of the first BLAST hits after similarity and E value filtering. + \item \code{bisonN_vs_refseq57.blast.xz}, \code{bisonS_vs_refseq57.blast.xz}, \code{bisonR_vs_refseq57.blast.xz}, \code{bisonQ_vs_refseq57.blast.xz}, \code{bisonP_vs_refseq57.blast.xz} are partial tabular BLAST results for proteins in the Bison Pool Environmental Genome. Protein sequences predicted in the metagenome were downloaded from the Joint Genome Institute's IMG/M system on 2009-05-13. The target database for the searches was constructed from microbial protein sequences in National Center for Biotechnology Information (NCBI) RefSeq database version 57, representing 7415 microbial genomes. The \sQuote{blastall} command was used with the default setting for E value cuttoff (10.0) and options to make a tabular output file consisting of the top 20 hits for each query sequence. The function \code{\link{read.blast}} was used to extract only those hits with E values less than or equal to 1e-5 and with sequence similarity (percent identity) at least 30 percent, and to keep only the first hit for each query sequence. The function \code{\link{write.blast}} was used to save partial BLAST files (only selected columns). The files provided with CHNOSZ contain the first 5,000 hits for each sampling site at Bison Pool, representing between about 7 to 15 percent of the first BLAST hits after similarity and E value filtering. \item \code{gi.taxid.txt.xz} is a table that lists the sequence identifiers (gi numbers) that appear in the example BLAST files (see above), together with the corresponding taxon ids used in the NCBI databases. This file is \emph{not} a subset of the complete \sQuote{gi_taxid_prot.dmp.gz} available at \url{ftp://ftp.ncbi.nih.gov/pub/taxonomy/} but instead is a subset of \sQuote{gi.taxid.txt} generated from the RefSeq release catalog using \sQuote{gencat.sh} in the \code{refseq} directory. See \code{\link{id.blast}} for an example that uses this file and the BLAST files described above. } @@ -51,13 +51,14 @@ } - Files in \code{refseq} contain code and results of processing NCBI Reference Sequences (RefSeq) for microbial proteins, updated for RefSeq release 55 of 2012-09-17: + Files in \code{refseq} contain code and results of processing NCBI Reference Sequences (RefSeq) for microbial proteins, using RefSeq release 57 of 2013-01-08: \itemize{ \item \code{README.txt} Instructions for producing the data files. \item \code{gencat.sh} Bash script to extract microbial protein records from the RefSeq catalog. \item \code{gi.taxid.txt} Output from above. The complete file is too large to distribute with CHNOSZ, but a portion is included in \code{extdata/bison} to support processing example BLAST files for the Bison Pool metagenome. \item \code{mkfaa.sh} Combine the contents of .faa.gz files into a single FASTA file (to use e.g. for making a BLAST database). \item \code{protein.refseq.R} Calculate average amino acid composition of all proteins for each organism identified by a taxonomic ID. + \item \code{trim_refseq.R} Remove some entries with commonly occurring names (e.g. many different strains of Escherichia coli) to reduce size of \code{protein_refseq.csv} (to keep package size down). \item \code{protein_refseq.csv.xz} Output from above. See example for \code{\link{ZC}}. \item \code{taxid.names.R} Generate a table of scientific names for the provided taxids. Requires the complete \code{names.dmp} and \code{nodes.dmp} from NCBI taxonomy files. \item \code{taxid_names.csv.xz} Output from above. See example for \code{\link{id.blast}}. Modified: pkg/CHNOSZ/man/protein.info.Rd =================================================================== --- pkg/CHNOSZ/man/protein.info.Rd 2013-03-15 01:23:23 UTC (rev 48) +++ pkg/CHNOSZ/man/protein.info.Rd 2013-03-24 07:04:53 UTC (rev 49) @@ -133,11 +133,11 @@ zc <- ZC(pf) # the organism names we search for # "" matches all organisms -terms <- c("Halo", "Streptomyces", "Pseudomonas", "Salmonella", - "Escherichia", "Bacteroides", "Lactobacillus", "Staphylococcus", - "Streptococcus", "Methano", "Bacillus", "Thermo", "") +terms <- c("Natr", "Halo", "Rhodo", "Acido", "Methylo", + "Nitro", "Desulfo", "Chloro", "Geo", "Methano", + "Thermo", "Pyro", "Sulfo", "Buchner", "") tps <- thermo$protein$ref[ip] -plot(0, 0, xlim=c(1, 13), ylim=c(-0.3, -0.05), pch="", +plot(0, 0, xlim=c(1, 15), ylim=c(-0.3, -0.05), pch="", ylab="average oxidation state of carbon in proteins", xlab="", xaxt="n", mar=c(6, 3, 1, 1)) for(i in 1:length(terms)) { @@ -145,8 +145,8 @@ zct <- zc[it] points(jitter(rep(i, length(zct))), zct, pch=20) } -terms[13] <- paste("all microbial") -axis(1, 1:13, terms, las=2) +terms[15] <- paste("all", length(ip)) +axis(1, 1:15, terms, las=2) title(main=paste("Average Oxidation State of Carbon:", "Total Protein per taxID in NCBI RefSeq", sep="\n")) } Modified: pkg/CHNOSZ/man/sideeffects.Rd =================================================================== --- pkg/CHNOSZ/man/sideeffects.Rd 2013-03-15 01:23:23 UTC (rev 48) +++ pkg/CHNOSZ/man/sideeffects.Rd 2013-03-24 07:04:53 UTC (rev 49) @@ -12,11 +12,18 @@ The \samp{CHNOSZ} environment is \emph{not} (as of CHNOSZ 1.0.0) \code{\link{attach}ed}, rather the \code{thermo} object is accessed in functions using \code{\link{get}} (as in \code{get("thermo")}), \code{\link{assign}} (\code{assign("thermo", thermo, "CHNOSZ")}) and occasionally \code{\link{with}} (\code{with(as.environment("CHNOSZ"), ...)}). - In the functions in the package, the greatest number of accessions are to the thermodynamic database (\code{thermo$obigt}), followed by the basis and species definitions (\code{thermo$basis} and \code{thermo$species}). For example, \code{\link{info}} can be used to look up thermodynamic data in \code{thermo$obigt} by the name or chemical formula of a species. As another example, \code{\link{subcrt}} attempts to balance unbalanced chemical reactions with the user-defined basis species in \code{thermo$basis}. +In the functions in the package, the greatest number of accessions are to the thermodynamic database (\code{thermo$obigt}), followed by the basis and species definitions (\code{thermo$basis} and \code{thermo$species}). +For example, \code{\link{info}} can be used to look up thermodynamic data in \code{thermo$obigt} by the name or chemical formula of a species. +As another example, \code{\link{subcrt}} attempts to balance unbalanced chemical reactions with the user-defined basis species in \code{thermo$basis}. - Some functions modify the thermodynamic database or system definition in \code{thermo}. These are examples of \dQuote{side effects}, since the functions have an effect on the state of the program that persists beyond the lifetime of the objects returned by the functions. In the code, side effects can be recognized by the presence of the \dQuote{superassignment} operator \code{\link{<<-}}. +Some functions modify the thermodynamic database or system definition in \code{thermo}. +These are \dQuote{side effects}, since the functions have an effect on the state of the program that persists beyond the lifetime of the objects returned by the functions. +In the code, side effects can be recognized by assignment to the \samp{thermo} object in the \samp{CHNOSZ} environment, i.e. \code{assign("thermo", thermo, "CHNOSZ")} (the unquoted \code{thermo} here refers to the object that was manipulated internally by a function and is now being assigned to the environment). - Side effects are not highly desirable in functional programming languages such as \R. The reason this design is adopted in CHNOSZ is that interactive use of \code{\link{basis}} and \code{\link{species}} appeared to the author, in the early stages of developing the package and of learning \R, to be facilitated by not requiring users to assign the results of these functions to objects. Instead, using side effects, the program \dQuote{remembers} the results of these function calls. Experience has shown that this design is usable (especially for new users), and is adaptable to many usage scenarios, but the dependence on side effects probably should be eliminated in the future. +Side effects are not highly desirable in functional programming languages such as \R. +The reason this design is adopted in CHNOSZ is that interactive use of \code{\link{basis}} and \code{\link{species}} appeared to the author, in the early stages of developing the package and of learning \R, to be facilitated by not requiring users to assign the results of these functions to objects. +Instead, using side effects, the program \dQuote{remembers} the results of these function calls. +Experience has shown that this design is usable (especially for new users), and is adaptable to many usage scenarios, but the dependence on side effects probably should be eliminated in the future. The two \emph{major} side effects, that most users will encounter, are the basis and species definitions. These functions and a few other modifications (writing) and accessions (reading) of data objects are listed below. The names of objects in this table refer to the components of the \code{thermo} object; for example, one can type \code{thermo$opt} at the command line to access all of the contents of the \code{opt} component, including those not listed in the table. @@ -32,8 +39,10 @@ \code{opar} \tab \code{\link{thermo.plot.new}} \tab -- \tab graphical parameters \cr } - Beginning with CHNOSZ version 0.9-9, instances of \code{\link{<<-}} in the code have the effect of \dQuote{superassignment} to an enclosing environment (\samp{CHNOSZ:thermo} on the search path), instead of the \emph{very} highly discouraged assignment to the global environment (user's workspace) used in previous versions of the package. This convention means that if, from the command line, \emph{you} wish to alter something in \code{thermo}, you also should use the \code{\link{<<-}} operator; examples of changing \code{thermo$opt$water} in this manner can found in the help page for \code{\link{water}}. - +Beginning with CHNOSZ version 1.0.0, the \dQuote{superassignment} operator (\code{\link{<<-}}) is no longer used in functions. +However, if \emph{you} wish to alter something in \code{thermo} in an interactive session, it is recommended to use the \code{\link{<<-}} operator, instead of \code{\link{<-}}. +This way, your changes to the \code{thermo} object occur in the \samp{CHNOSZ} environment, which is where the functions in CHNOSZ expect to find it, rather than being saved to the global environment. +An example of changing \code{thermo$opt$water} in this manner can found in the help page for \code{\link{water}}. } \seealso{ Modified: pkg/CHNOSZ/man/util.blast.Rd =================================================================== --- pkg/CHNOSZ/man/util.blast.Rd 2013-03-15 01:23:23 UTC (rev 48) +++ pkg/CHNOSZ/man/util.blast.Rd 2013-03-24 07:04:53 UTC (rev 49) @@ -76,7 +76,7 @@ taxid.names <- read.csv(nfile) # the BLAST files sites <- c("N","S","R","Q","P") -bfile <- paste("extdata/bison/bison", sites, "_vs_refseq55.blastp.xz", sep="") +bfile <- paste("extdata/bison/bison", sites, "_vs_refseq57.blastp.xz", sep="") for(i in 1:5) { file <- system.file(bfile[i], package="CHNOSZ") # read the blast file, with default filtering settings From noreply at r-forge.r-project.org Wed Mar 27 01:03:52 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 27 Mar 2013 01:03:52 +0100 (CET) Subject: [CHNOSZ-commits] r50 - in pkg/CHNOSZ: . R inst man vignettes Message-ID: <20130327000352.1F59A1810A3@r-forge.r-project.org> Author: jedick Date: 2013-03-27 01:03:51 +0100 (Wed, 27 Mar 2013) New Revision: 50 Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/R/wjd.R pkg/CHNOSZ/inst/CHECKLIST pkg/CHNOSZ/inst/NEWS pkg/CHNOSZ/man/wjd.Rd pkg/CHNOSZ/vignettes/wjd.Rnw pkg/CHNOSZ/vignettes/wjd.lyx Log: guess() uses "stoich" as default method Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2013-03-24 07:04:53 UTC (rev 49) +++ pkg/CHNOSZ/DESCRIPTION 2013-03-27 00:03:51 UTC (rev 50) @@ -1,6 +1,6 @@ -Date: 2013-03-24 +Date: 2013-03-27 Package: CHNOSZ -Version: 0.9-9.10 +Version: 0.9-9.11 Title: Chemical Thermodynamics and Activity Diagrams Author: Jeffrey M. Dick Maintainer: Jeffrey M. Dick Modified: pkg/CHNOSZ/R/wjd.R =================================================================== --- pkg/CHNOSZ/R/wjd.R 2013-03-24 07:04:53 UTC (rev 49) +++ pkg/CHNOSZ/R/wjd.R 2013-03-27 00:03:51 UTC (rev 50) @@ -249,7 +249,7 @@ 0,0,0,1,2,1,1,0,0,0, 0,0,1,0,0,0,1,1,2,1),ncol=3, dimnames=list(NULL,c("H","N","O"))), - B = c(2,1,1), method=c("central", "stoich"), minX=0.001, iguess=1, ic=NULL + B = c(2,1,1), method="stoich", minX=0.001, iguess=1, ic=NULL ){ # given the elemental stoichiometries of a set of species (A) # and the number of moles of elements (B) @@ -260,7 +260,7 @@ if(all(B==0)) stop("there are zero moles of all elements") # if method="central" get central solution using limSolve package 20120919 - if("central" %in% method) { + if(identical(method, "central")) { if(!"limSolve" %in% row.names(installed.packages())) { msgout("guess: skipping 'central' method as limSolve package is not available\n") } else { @@ -275,7 +275,7 @@ } } - if("stoich" %in% method) { + if(identical(method, "stoich")) { # if method="stoich" use a stoichiometric approach: 20111231 jmd # - select one of the (many) species combinations (ic) that # make a square, invertible stoichiometric matrix (the "variable" species) Modified: pkg/CHNOSZ/inst/CHECKLIST =================================================================== --- pkg/CHNOSZ/inst/CHECKLIST 2013-03-24 07:04:53 UTC (rev 49) +++ pkg/CHNOSZ/inst/CHECKLIST 2013-03-27 00:03:51 UTC (rev 50) @@ -38,5 +38,7 @@ - build the package on the source directory: R CMD build --compact-vignettes chnosz - (don't use --no-vignettes, that keeps the Rnw files from being copied to inst/doc, - causing vignettes to disappear from CRAN webpage) + don't use --no-vignettes, that keeps the Rnw files from being copied to inst/doc, + causing vignettes to disappear from CRAN webpage + don't use --compact-vignettes=both, that results in smaller PDFs (using ghostscript), + but erases some metadata Modified: pkg/CHNOSZ/inst/NEWS =================================================================== --- pkg/CHNOSZ/inst/NEWS 2013-03-24 07:04:53 UTC (rev 49) +++ pkg/CHNOSZ/inst/NEWS 2013-03-27 00:03:51 UTC (rev 50) @@ -1,4 +1,4 @@ -CHANGES IN CHNOSZ 0.9-9.10 (2013-03-24) +CHANGES IN CHNOSZ 0.9-9.11 (2013-03-26) --------------------------------------- MAJOR USER-VISIBLE CHANGE: @@ -73,7 +73,9 @@ - Remove read.supcrt() and write.supcrt(). +- guess() now defaults to "stoich" method, not "central". + CHANGES IN CHNOSZ 0.9-9 (2013-01-01) ------------------------------------ Modified: pkg/CHNOSZ/man/wjd.Rd =================================================================== --- pkg/CHNOSZ/man/wjd.Rd 2013-03-24 07:04:53 UTC (rev 49) +++ pkg/CHNOSZ/man/wjd.Rd 2013-03-27 00:03:51 UTC (rev 50) @@ -36,7 +36,7 @@ 0,0,0,1,2,1,1,0,0,0, 0,0,1,0,0,0,1,1,2,1),ncol=3, dimnames=list(NULL,c("H","N","O"))), - B = c(2,1,1), method=c("central", "stoich"), minX = 0.001, iguess = 1, ic = NULL + B = c(2,1,1), method="stoich", minX = 0.001, iguess = 1, ic = NULL ) run.wjd(ispecies, B = NULL, method = "stoich", Y = run.guess(ispecies, B, method), P=1, T=25, nlambda=101, imax = 10, Gfrac = 1e-7, tol = 0.01) Modified: pkg/CHNOSZ/vignettes/wjd.Rnw =================================================================== --- pkg/CHNOSZ/vignettes/wjd.Rnw 2013-03-24 07:04:53 UTC (rev 49) +++ pkg/CHNOSZ/vignettes/wjd.Rnw 2013-03-27 00:03:51 UTC (rev 50) @@ -424,14 +424,16 @@ @ -We triggered a single ``not near equilibrium'' message, but overall -it seems well behaved. And, as expected, it is similar to Fig. 2 of -\citet{DLE64}, with a major crossing of curves at about 28\% carbon, -together with an increase in aromatic compounds (e.g. naphthalene, -anthracene) going toward higher carbon content. Unlike the figure -in \citet{DLE64}, there appears to be a second major crossing of -curves at about 43\% carbon, corresponding to a rise in CO. (For a -higher resolution, try setting \texttt{xCs <- seq(8, 47, 1)}.) +We triggered some ``not near equilibrium'' messages, but overall +it seems well behaved (note that using the ``central'' method in +\texttt{guess()} is one way that leads to fewer of these messages). +And, as expected, it is similar to Fig. 2 of \citet{DLE64}, with +a major crossing of curves at about 28\% carbon, together with an +increase in aromatic compounds (e.g. naphthalene, anthracene) going +toward higher carbon content. Unlike the figure in \citet{DLE64}, +there appears to be a second major crossing of curves at about 43\% +carbon, corresponding to a rise in CO. (For a higher resolution, try +setting \texttt{xCs <- seq(8, 47, 1)}.) \section{Running Down: Using a Thermodynamic Database} Modified: pkg/CHNOSZ/vignettes/wjd.lyx =================================================================== --- pkg/CHNOSZ/vignettes/wjd.lyx 2013-03-24 07:04:53 UTC (rev 49) +++ pkg/CHNOSZ/vignettes/wjd.lyx 2013-03-27 00:03:51 UTC (rev 50) @@ -1895,7 +1895,7 @@ \end_layout \begin_layout Standard -We triggered a single +We triggered some \begin_inset Quotes eld \end_inset @@ -1903,7 +1903,19 @@ \begin_inset Quotes erd \end_inset - message, but overall it seems well behaved. + messages, but overall it seems well behaved (note that using the +\begin_inset Quotes eld +\end_inset + +central +\begin_inset Quotes erd +\end_inset + + method in +\family typewriter +guess() +\family default + is one way that leads to fewer of these messages). And, as expected, it is similar to Fig. 2 of \begin_inset CommandInset citation From noreply at r-forge.r-project.org Thu Mar 28 16:57:07 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 28 Mar 2013 16:57:07 +0100 (CET) Subject: [CHNOSZ-commits] r51 - in pkg/CHNOSZ: . R inst man Message-ID: <20130328155707.E5E1B184867@r-forge.r-project.org> Author: jedick Date: 2013-03-28 16:57:07 +0100 (Thu, 28 Mar 2013) New Revision: 51 Modified: pkg/CHNOSZ/.Rinstignore pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/R/util.blast.R pkg/CHNOSZ/inst/CHECKLIST pkg/CHNOSZ/inst/NEWS pkg/CHNOSZ/man/CHNOSZ-package.Rd Log: prepare version 1.0.0 for release on CRAN Modified: pkg/CHNOSZ/.Rinstignore =================================================================== --- pkg/CHNOSZ/.Rinstignore 2013-03-27 00:03:51 UTC (rev 50) +++ pkg/CHNOSZ/.Rinstignore 2013-03-28 15:57:07 UTC (rev 51) @@ -1,5 +1,2 @@ -chnosz_new.pdf -rxn_.*.pdf -EF-Tu_.*.pdf vig.bib .*.lyx Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2013-03-27 00:03:51 UTC (rev 50) +++ pkg/CHNOSZ/DESCRIPTION 2013-03-28 15:57:07 UTC (rev 51) @@ -1,6 +1,6 @@ -Date: 2013-03-27 +Date: 2013-03-28 Package: CHNOSZ -Version: 0.9-9.11 +Version: 1.0.0 Title: Chemical Thermodynamics and Activity Diagrams Author: Jeffrey M. Dick Maintainer: Jeffrey M. Dick Modified: pkg/CHNOSZ/R/util.blast.R =================================================================== --- pkg/CHNOSZ/R/util.blast.R 2013-03-27 00:03:51 UTC (rev 50) +++ pkg/CHNOSZ/R/util.blast.R 2013-03-28 15:57:07 UTC (rev 51) @@ -79,12 +79,12 @@ it <- which(nt/sum(nt) >= min.taxon) itt <- which(blast$taxid %in% names(nt)[it]) blast <- blast[itt,] - cat(paste(" min taxon abundance filtering leaves",length(unique(blast$query)), + cat(paste(" min taxon abundance filtering leaves",length(unique(blast$queryId)), "query sequences,",length(unique(blast$phylum)),"phyla,",length(unique(blast$taxid)),"taxa\n")) # only take phylum assignments that make up at least a certain # fraction ('amin') of hits to the query sequence - uquery <- unique(blast$query) - iquery <- match(uquery,blast$query) + uquery <- unique(blast$queryId) + iquery <- match(uquery,blast$queryId) # function to select the (highest) represented phylum for each query iqfun <- function(i) { if((i-1)%%1000==0) cat(paste(i,"")) Modified: pkg/CHNOSZ/inst/CHECKLIST =================================================================== --- pkg/CHNOSZ/inst/CHECKLIST 2013-03-27 00:03:51 UTC (rev 50) +++ pkg/CHNOSZ/inst/CHECKLIST 2013-03-28 15:57:07 UTC (rev 51) @@ -37,8 +37,6 @@ (CFLAGS=-ffloat-store ./configure --disable-long-double) - build the package on the source directory: - R CMD build --compact-vignettes chnosz + R CMD build --compact-vignettes chnosz/ don't use --no-vignettes, that keeps the Rnw files from being copied to inst/doc, causing vignettes to disappear from CRAN webpage - don't use --compact-vignettes=both, that results in smaller PDFs (using ghostscript), - but erases some metadata Modified: pkg/CHNOSZ/inst/NEWS =================================================================== --- pkg/CHNOSZ/inst/NEWS 2013-03-27 00:03:51 UTC (rev 50) +++ pkg/CHNOSZ/inst/NEWS 2013-03-28 15:57:07 UTC (rev 51) @@ -1,11 +1,12 @@ -CHANGES IN CHNOSZ 0.9-9.11 (2013-03-26) ---------------------------------------- +CHANGES IN CHNOSZ 1.0.0 (2013-03-28) +------------------------------------ MAJOR USER-VISIBLE CHANGE: - On attaching the package, the user is asked to load the 'thermo' - object using data(thermo). This is required because packages are not - permitted to alter the search path (but the user may). + object, containing thermodynamic data and system settings, using + data(thermo). This is required because packages are not permitted to + alter the search path (but the user may). OTHER CHANGES: @@ -59,9 +60,6 @@ - Simplify EOSplot() somewhat (don't group data by pressure ranges). -- [temporary] Deactivate code using 'central' method in guess() - (wjd.Rnw) as limSolve package on not available on R-Forge for windows. - - EOSlab() gets label from attribute (if present) of user-defined function. @@ -73,7 +71,8 @@ - Remove read.supcrt() and write.supcrt(). -- guess() now defaults to "stoich" method, not "central". +- guess() now defaults to "stoich" method, not "central". (Needed since + limSolve package is not found during R-Forge checks on Windows.) CHANGES IN CHNOSZ 0.9-9 (2013-01-01) Modified: pkg/CHNOSZ/man/CHNOSZ-package.Rd =================================================================== --- pkg/CHNOSZ/man/CHNOSZ-package.Rd 2013-03-27 00:03:51 UTC (rev 50) +++ pkg/CHNOSZ/man/CHNOSZ-package.Rd 2013-03-28 15:57:07 UTC (rev 51) @@ -74,7 +74,7 @@ \code{\link{subcrt}} does not correctly identify the stable polymorph of some minerals at high temperature. - \code{\link{diagram}} causes an error while plotting stability field boundaries if the x and y resolutions are not identical. (\code{diagram(..., plot.it=FALSE)} can still be used to retrieve the results of the equilibrium calculation.) + \code{\link{diagram}} causes an error while plotting stability field boundaries if the x and y resolutions are not identical. } \seealso{ @@ -82,8 +82,10 @@ } \examples{ -\dontshow{data(thermo)} ### Getting Started +## the 'thermo' object contains thermodynamic data and is also where +## user's settings (definition of chemical system) are stored +data(thermo) ## standard thermodynamic properties of species subcrt("H2O") @@ -122,9 +124,9 @@ subcrt(c("k-feldspar", "kaolinite"), c(-2, 1)) ## chemical affinities -# basis species and their activities or fugacities +# set basis species and their activities or fugacities basis(c("CO2", "H2O", "O2"), c(-3, 0, -80)) -# species of interest +# set species of interest species(c("CH4", "C2H4O2", "CO2")) # chemical affinities of formation reactions # take off $values for complete output