diff --git a/DESCRIPTION b/DESCRIPTION
index f5deb5d..602bdc7 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -68,6 +68,7 @@ Collate:
'calc_rt_diff_class.R'
'lcms_table_class.R'
'cd_source_class.R'
+ 'chart_plot_doc.R'
'rest_api_parsers.R'
'rest_api_class.R'
'classyfire_lookup_class.R'
@@ -94,6 +95,7 @@ Collate:
'kegg_lookup_class.R'
'lipidmaps_lookup_class.R'
'ls_source_class.R'
+ 'model_apply_doc.R'
'mspurity_source_class.R'
'mwb_compound_lookup_class.R'
'mwb_refmet_database_class.R'
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index f288702..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,674 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. 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
-them 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 prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. 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.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey 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;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If 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 convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU 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 that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- 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.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-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.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- 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
-state 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 3 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, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- Copyright (C)
- This program 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, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-.
-
- The GNU 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. But first, please read
-.
diff --git a/NAMESPACE b/NAMESPACE
index 6c9c00b..480ac75 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -98,7 +98,6 @@ exportMethods(model_apply)
exportMethods(read_database)
exportMethods(read_source)
exportMethods(required_cols)
-exportMethods(show)
exportMethods(vertical_join)
exportMethods(write_database)
import(cowplot, except = theme_map)
@@ -110,6 +109,7 @@ import(methods)
import(rlang)
import(struct)
importFrom(scales,manual_pal)
+importFrom(stats,setNames)
importFrom(utils,URLencode)
importFrom(utils,capture.output)
importFrom(utils,modifyList)
diff --git a/R/AnnotationDb_database.R b/R/AnnotationDb_database.R
index 601aa8a..4cf7904 100644
--- a/R/AnnotationDb_database.R
+++ b/R/AnnotationDb_database.R
@@ -54,6 +54,7 @@ AnnotationDb_database <- function(
)
#' @export
+#' @rdname read_database
setMethod(
f = "read_database",
signature = c("AnnotationDb_database"), definition = function(obj) {
diff --git a/R/AnnotationDb_select_class.R b/R/AnnotationDb_select_class.R
index b159a78..f353714 100644
--- a/R/AnnotationDb_select_class.R
+++ b/R/AnnotationDb_select_class.R
@@ -116,8 +116,8 @@ AnnotationDb_select <- function(
)
-
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("AnnotationDb_select", "annotation_source"),
diff --git a/R/BiocFileCache_database_class.R b/R/BiocFileCache_database_class.R
index fe479e5..caa991b 100644
--- a/R/BiocFileCache_database_class.R
+++ b/R/BiocFileCache_database_class.R
@@ -111,6 +111,7 @@ BiocFileCache_database <- function(
)
#' @export
+#' @rdname read_database
setMethod(
f = "read_database",
signature = c("BiocFileCache_database"),
diff --git a/R/BiocFileCache_database_helpers.R b/R/BiocFileCache_database_helpers.R
index b3a1a94..12d26ff 100644
--- a/R/BiocFileCache_database_helpers.R
+++ b/R/BiocFileCache_database_helpers.R
@@ -23,7 +23,7 @@
#' @return TRUE if successful
#' @examples
#' M <- BiocFileCache_database(
-#' path = tempfile(),
+#' source = tempfile(),
#' resource_name = "example",
#' bfc_fun = .unzip
#' )
@@ -49,7 +49,7 @@
#' @return TRUE if successful
#' @examples
#' M <- BiocFileCache_database(
-#' path = tempfile(),
+#' source = tempfile(),
#' resource_name = "example",
#' bfc_fun = .cache_as_is
#' )
diff --git a/R/CompoundDb_source_class.R b/R/CompoundDb_source_class.R
index d7b9115..5c26967 100644
--- a/R/CompoundDb_source_class.R
+++ b/R/CompoundDb_source_class.R
@@ -28,6 +28,7 @@ CompoundDb_source <- function(
)
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("CompoundDb_source", "annotation_source"),
diff --git a/R/MTox700plus_database_class.R b/R/MTox700plus_database_class.R
index 861c21b..c27a9a5 100644
--- a/R/MTox700plus_database_class.R
+++ b/R/MTox700plus_database_class.R
@@ -57,9 +57,9 @@ MTox700plus_database <- function(
name = "MTox700+ version number",
description = paste0(
"The version number of the MTox700+ database to import. ",
- "Available versions are listed here: ",
- '[https://github.com/michabohealthscience/MTox700plus/',
- 'releases].',
+ "Available versions are listed ",
+ '\\href{https://github.com/michabohealthscience/MTox700plus/',
+ 'releases}{here}.',
' `version` should match the tag of the release e.g. `"v1.0"`.',
' For convenience `version = "latest"` will always retrieve ',
"the most recent release. To prevent unecessary downloads ",
@@ -84,6 +84,7 @@ MTox700plus_database <- function(
#' @export
+#' @rdname read_database
setMethod(
f = "read_database",
signature = c("MTox700plus_database"), definition = function(obj) {
diff --git a/R/MetMashR-package.R b/R/MetMashR-package.R
index 76cce7e..12f5dae 100644
--- a/R/MetMashR-package.R
+++ b/R/MetMashR-package.R
@@ -1,5 +1,6 @@
#' @import struct
#' @importFrom utils URLencode modifyList read.csv stack unzip
+#' @importFrom stats setNames
#' @keywords internal
"_PACKAGE"
diff --git a/R/PathBank_metabolite_database_class.R b/R/PathBank_metabolite_database_class.R
index 1d0a04f..f470968 100644
--- a/R/PathBank_metabolite_database_class.R
+++ b/R/PathBank_metabolite_database_class.R
@@ -40,7 +40,7 @@ PathBank_metabolite_database <- function(
" Hasan and Pon, Allison and Budinski, Zachary and ",
"Patron, ",
"Jonas and Lipton, Debra and Cao, Xuan and Oler, Eponine ",
- "and Li, Krissa and Paccoud, Maïlys and Hong, Chelsea and ",
+ "and Li, Krissa and Paccoud, Ma\u00EFlys and Hong, Chelsea and ",
"Guo, An C and Chan, Christopher and Wei, William and ",
"Ramirez-Gaona, Miguel"
)),
@@ -91,6 +91,7 @@ PathBank_metabolite_database <- function(
#' @export
+#' @rdname read_database
setMethod(
f = "read_database",
signature = c("PathBank_metabolite_database"), definition = function(obj) {
diff --git a/R/add_columns_class.R b/R/add_columns_class.R
index e16e0b6..9038eda 100644
--- a/R/add_columns_class.R
+++ b/R/add_columns_class.R
@@ -3,12 +3,18 @@
#' @include annotation_source_class.R
#' @seealso [dplyr::left_join()]
add_columns <- function(new_columns, by, ...) {
+
+ if (nrow(new_columns)==0 & ncol(new_columns)==0) {
+ new_columns = data.frame(id=NA)
+ colnames(new_columns)[1]=by[1]
+ }
+
check <- all(by %in% colnames(new_columns))
if (!check) {
stop('parameter "by" must be a column name of the "new_columns",
" data.frame')
}
-
+
out <- struct::new_struct(
"add_columns",
new_columns = new_columns,
@@ -53,7 +59,7 @@ add_columns <- function(new_columns, by, ...) {
"annotation table. Can also be an annotation_database."
),
type = c("data.frame", "annotation_database"),
- value = data.frame(id = NA)
+ value = data.frame(value = NA)
),
by = entity(
name = "By",
@@ -71,6 +77,7 @@ add_columns <- function(new_columns, by, ...) {
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("add_columns", "annotation_source"),
diff --git a/R/add_labels_class.R b/R/add_labels_class.R
index d606e5a..2da4a55 100644
--- a/R/add_labels_class.R
+++ b/R/add_labels_class.R
@@ -69,6 +69,7 @@ add_labels <- function(labels, replace = FALSE, ...) {
)
setValidity("add_labels", method = function(object) {
+ check = FALSE
if (length(object$labels) > 0) {
check <- is.null(names(object$labels))
}
@@ -81,6 +82,7 @@ setValidity("add_labels", method = function(object) {
})
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("add_labels", "annotation_source"),
diff --git a/R/annotation_bar_chart.R b/R/annotation_bar_chart.R
index 5712673..90e01b3 100644
--- a/R/annotation_bar_chart.R
+++ b/R/annotation_bar_chart.R
@@ -1,4 +1,4 @@
-#' @eval get_description('annotation_pie_chart')
+#' @eval get_description('annotation_bar_chart')
#' @include annotation_source_class.R
#' @export
annotation_bar_chart <- function(
@@ -103,6 +103,7 @@ annotation_bar_chart <- function(
)
#' @export
+#' @template chart_plot
setMethod(
f = "chart_plot",
signature = c("annotation_bar_chart", "annotation_source"),
diff --git a/R/annotation_database_class.R b/R/annotation_database_class.R
index da710fb..c5a2978 100644
--- a/R/annotation_database_class.R
+++ b/R/annotation_database_class.R
@@ -38,6 +38,7 @@ annotation_database <- function(
#' @export
+#' @rdname is_writable
setMethod(
f = "is_writable",
signature = c("annotation_database"),
@@ -47,6 +48,7 @@ setMethod(
)
#' @export
+#' @rdname read_source
setMethod(
f = "read_source",
signature = c("annotation_database"),
@@ -58,6 +60,8 @@ setMethod(
#' @export
+#' @rdname write_database
+#' @param df (data.frame) the data.frame to store in the database.
setMethod(
f = "write_database",
signature = c("annotation_database"), definition = function(obj, df) {
@@ -76,6 +80,8 @@ setMethod(
}
)
+#' @export
+#' @rdname read_database
setMethod(
f = "read_database",
signature = c("annotation_database"),
diff --git a/R/annotation_histogram2d_class.R b/R/annotation_histogram2d_class.R
index 554b0d4..0f3a59b 100644
--- a/R/annotation_histogram2d_class.R
+++ b/R/annotation_histogram2d_class.R
@@ -110,6 +110,7 @@ annotation_histogram2d <- function(
#' @export
+#' @template chart_plot
setMethod(
f = "chart_plot",
signature = c("annotation_histogram2d", "annotation_source"),
diff --git a/R/annotation_histogram_class.R b/R/annotation_histogram_class.R
index f62546a..b4cfd71 100644
--- a/R/annotation_histogram_class.R
+++ b/R/annotation_histogram_class.R
@@ -106,6 +106,7 @@ annotation_histogram <- function(
)
#' @export
+#' @template chart_plot
setMethod(
f = "chart_plot",
signature = c("annotation_histogram", "annotation_source"),
diff --git a/R/annotation_pie_chart.R b/R/annotation_pie_chart.R
index 1661294..be07c83 100644
--- a/R/annotation_pie_chart.R
+++ b/R/annotation_pie_chart.R
@@ -159,6 +159,7 @@ annotation_pie_chart <- function(
)
#' @export
+#' @template chart_plot
setMethod(
f = "chart_plot",
signature = c("annotation_pie_chart", "annotation_source"),
diff --git a/R/annotation_source_class.R b/R/annotation_source_class.R
index e6f76d2..b83153f 100644
--- a/R/annotation_source_class.R
+++ b/R/annotation_source_class.R
@@ -1,4 +1,4 @@
-#' @eval get_description("annotation_database")
+#' @eval get_description("annotation_source")
#' @include zzz.R generics.R
#' @family {annotation databases}
#' @export
@@ -67,6 +67,7 @@ annotation_source <- function(
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("model", "annotation_source"),
@@ -79,7 +80,7 @@ setMethod(
}
)
-#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("model", "list"),
@@ -92,7 +93,7 @@ setMethod(
}
)
-#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("model_seq", "list"),
@@ -105,7 +106,7 @@ setMethod(
}
)
-#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("model_seq", "annotation_source"),
@@ -142,7 +143,6 @@ setMethod(
}
)
-#' @export
setMethod(
f = "show",
signature = c("annotation_source"),
@@ -160,6 +160,7 @@ setMethod(
)
#' @export
+#' @rdname read_source
setMethod(
f = "read_source",
signature = c("annotation_source"),
@@ -173,6 +174,7 @@ setMethod(
)
#' @export
+#' @rdname check_for_columns
setMethod(
f = "check_for_columns",
signature = c("annotation_source"),
@@ -213,6 +215,18 @@ setMethod(
#' @export
+#' @param matching_columns (list) a named list of column names that all contain
+#' the same information. All columns named in the same list element will be
+#' merged into a single column with the same name as the list element.
+#' @param keep_cols (character) a list of column names to keep in the final
+#' joined table. All other columns will be dropped.
+#' @param source_col (character) the name of a new column that will contain the
+#' tags of the original source object for each row in the joined table.
+#' @param exclude_cols (character) the names of columns to exclude from the
+#' joined table.
+#' @param as (character) the type of object the joined table should be returned
+#' as e.g. "lcms_table".
+#' @rdname vertical_join
setMethod(
f = "vertical_join",
signature = c("annotation_source", "annotation_source"),
@@ -278,6 +292,7 @@ setMethod(
)
#' @export
+#' @rdname vertical_join
setMethod(
f = "vertical_join",
signature = c("list", "missing"),
@@ -345,7 +360,9 @@ setValidity(
}
)
+
#' @export
+#' @rdname required_cols
setMethod(
f = "required_cols",
signature = c("annotation_source"),
diff --git a/R/annotation_table_class.R b/R/annotation_table_class.R
index fd90695..ebe0f62 100644
--- a/R/annotation_table_class.R
+++ b/R/annotation_table_class.R
@@ -8,9 +8,28 @@ annotation_table <- function(
tag = "",
id_column = NULL,
...) {
+
+ # create id column if NULL
if (is.null(id_column)) {
- data$.MetMashR_id <- seq_len(nrow(data))
- id_column <- ".MetMashR_id"
+ id_column = '.MetMashR_id'
+ if (nrow(data)>0) {
+ data[[id_column]]=seq_len(nrow(data))
+ }
+ }
+
+ # create data if null
+ if (is.null(data)) {
+ data = data.frame()
+ }
+
+ # create id column if no rows or columns
+ if (nrow(data)==0 & ncol(data)==0) {
+ data <- data.frame(
+ id = character(0)
+ )
+ colnames(data) <- c(
+ id_column
+ )
}
# new object
diff --git a/R/annotation_upset_chart_class.R b/R/annotation_upset_chart_class.R
index a81201f..8dfa6f5 100644
--- a/R/annotation_upset_chart_class.R
+++ b/R/annotation_upset_chart_class.R
@@ -1,3 +1,4 @@
+#' @eval get_description('annotation_upset_chart')
#' @export
annotation_upset_chart <- function(
factor_name,
@@ -164,6 +165,7 @@ annotation_upset_chart <- function(
)
#' @export
+#' @template chart_plot
setMethod(
f = "chart_plot",
signature = c("annotation_upset_chart", "annotation_source"),
@@ -253,6 +255,7 @@ setMethod(
)
#' @export
+#' @template chart_plot
setMethod(
f = "chart_plot",
signature = c("annotation_upset_chart", "list"),
diff --git a/R/annotation_venn_chart.R b/R/annotation_venn_chart.R
index 0d6ad03..fb403bf 100644
--- a/R/annotation_venn_chart.R
+++ b/R/annotation_venn_chart.R
@@ -121,6 +121,7 @@ annotation_venn_chart <- function(
)
#' @export
+#' @template chart_plot
setMethod(
f = "chart_plot",
signature = c("annotation_venn_chart", "annotation_source"),
@@ -187,6 +188,7 @@ setMethod(
)
#' @export
+#' @template chart_plot
setMethod(
f = "chart_plot",
signature = c("annotation_venn_chart", "list"),
diff --git a/R/calc_ppm_diff_class.R b/R/calc_ppm_diff_class.R
index ffa8a8e..f0f35e6 100644
--- a/R/calc_ppm_diff_class.R
+++ b/R/calc_ppm_diff_class.R
@@ -100,6 +100,7 @@ calc_ppm_diff <- function(
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("calc_ppm_diff", "annotation_table"),
diff --git a/R/calc_rt_diff_class.R b/R/calc_rt_diff_class.R
index e7470b0..f65b36e 100644
--- a/R/calc_rt_diff_class.R
+++ b/R/calc_rt_diff_class.R
@@ -96,6 +96,7 @@ calc_rt_diff <- function(
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("calc_rt_diff", "annotation_table"),
diff --git a/R/cd_source_class.R b/R/cd_source_class.R
index 648d735..f3140f3 100644
--- a/R/cd_source_class.R
+++ b/R/cd_source_class.R
@@ -11,17 +11,36 @@ cd_source <- function(
mz_column = "mz",
rt_column = "rt",
id_column = "id",
+ data = NULL,
...) {
+
+ if (is.null(data)) {
+ data = data.frame()
+ }
+
+ if (nrow(data)==0 & ncol(data)==0) {
+ data <- data.frame(
+ id = character(0),
+ mz = numeric(0),
+ rt = numeric(0)
+ )
+ colnames(data) <- c(
+ id_column,
+ mz_column,
+ rt_column
+ )
+ }
+
# new object
out <- new_struct(
"cd_source",
source = source,
tag = tag,
- sheets = sheets,
mz_column = mz_column,
rt_column = rt_column,
id_column = id_column,
- .required = c(mz_column, rt_column, id_column),
+ .required = c(mz_column, id_column, rt_column),
+ data = data,
...
)
return(out)
@@ -83,7 +102,9 @@ cd_source <- function(
)
+
#' @export
+#' @rdname read_source
setMethod(
f = "read_source",
signature = c("cd_source"),
diff --git a/R/chart_plot_doc.R b/R/chart_plot_doc.R
new file mode 100644
index 0000000..b43fe56
--- /dev/null
+++ b/R/chart_plot_doc.R
@@ -0,0 +1,12 @@
+#' chart_plot method
+#'
+#' Plots a chart object
+#' @param obj a chart object
+#' @param dobj a struct object
+#' @param ... additiional inputs to chart_plot
+#' @return a plot object
+#' @examples
+#' C = example_chart()
+#' chart_plot(C,example_model())
+#' @name chart_plot
+NULL
\ No newline at end of file
diff --git a/R/combine_columns_class.R b/R/combine_columns_class.R
index 12663df..deb3f81 100644
--- a/R/combine_columns_class.R
+++ b/R/combine_columns_class.R
@@ -115,6 +115,7 @@ combine_columns <- function(
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("combine_columns", "annotation_source"),
diff --git a/R/combine_records_class.R b/R/combine_records_class.R
index 08ce698..2c7cb48 100644
--- a/R/combine_records_class.R
+++ b/R/combine_records_class.R
@@ -103,6 +103,7 @@ combine_records <- function(
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("combine_records", "annotation_source"),
@@ -374,7 +375,7 @@ NULL
#' # Select matching records
#' M <- combine_records(
#' group_by = "example",
-#' default_fcn = .select_match(
+#' default_fcn = .select_exact(
#' match_col = "match_column",
#' match = "find_me",
#' separator = ", ",
@@ -405,6 +406,7 @@ NULL
#' @param digits (numeric) the number of digits to use when converting numerical
#' values to characters when determining if values are unique.
#' @param sort (logical) sort the values before collapsing.
+#' @param drop_na (logical) exclude NA from the list of unique entires
#' @examples
#'
#' # Collapse unique values
diff --git a/R/combine_sources.R b/R/combine_sources.R
index 33d4d31..aedf3ee 100644
--- a/R/combine_sources.R
+++ b/R/combine_sources.R
@@ -150,6 +150,7 @@ combine_sources <- function(
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("combine_sources", "annotation_source"),
@@ -169,8 +170,8 @@ setMethod(
}
)
-
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("combine_sources", "list"),
diff --git a/R/compute_column_class.R b/R/compute_column_class.R
index 21e2a4b..9c6e2ba 100644
--- a/R/compute_column_class.R
+++ b/R/compute_column_class.R
@@ -72,6 +72,7 @@ compute_column <- function(
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("compute_column", "annotation_source"),
diff --git a/R/compute_record_class.R b/R/compute_record_class.R
index 36e29a7..7228448 100644
--- a/R/compute_record_class.R
+++ b/R/compute_record_class.R
@@ -50,6 +50,7 @@ compute_record <- function(
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("compute_record", "annotation_source"),
diff --git a/R/database_lookup_class.R b/R/database_lookup_class.R
index d7c9a77..01b85c4 100644
--- a/R/database_lookup_class.R
+++ b/R/database_lookup_class.R
@@ -118,6 +118,7 @@ database_lookup <- function(
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("database_lookup", "annotation_source"),
diff --git a/R/dictionaries.R b/R/dictionaries.R
index fd790b0..03271b0 100644
--- a/R/dictionaries.R
+++ b/R/dictionaries.R
@@ -8,7 +8,7 @@
#' M <- normalise_strings(
#' search_column = "example",
#' output_column = "result",
-#' dictionary = .amino_acid_dictionary
+#' dictionary = .tripeptide_dictionary
#' )
#'
#' @return A dictionary for use with [`normalise_strings()`]
@@ -81,7 +81,7 @@
list(pattern = "-(+)-", replace = "-", fixed = TRUE),
list(pattern = "^L(+)-", replace = "L-", fixed = TRUE),
list(pattern = "^D(-)-", replace = "D-", fixed = TRUE),
- list(pattern = "(±)", replace = "", fixed = TRUE)
+ list(pattern = "(\\x{00b1})", replace = "", fixed = TRUE)
)
diff --git a/R/excel_database_class.R b/R/excel_database_class.R
index cd0ec25..42332b0 100644
--- a/R/excel_database_class.R
+++ b/R/excel_database_class.R
@@ -74,6 +74,7 @@ excel_database <- function(
)
#' @export
+#' @rdname read_database
setMethod(
f = "read_database",
signature = c("excel_database"), definition = function(obj) {
diff --git a/R/expand_records_class.R b/R/expand_records_class.R
index 7fd89de..38019ee 100644
--- a/R/expand_records_class.R
+++ b/R/expand_records_class.R
@@ -80,6 +80,7 @@ split_records <- function(
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("split_records", "annotation_source"),
diff --git a/R/filter_labels_class.R b/R/filter_labels_class.R
index 11924a1..84365f7 100644
--- a/R/filter_labels_class.R
+++ b/R/filter_labels_class.R
@@ -132,6 +132,7 @@ filter_labels <- function(
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("filter_labels", "annotation_source"),
diff --git a/R/filter_na_class.R b/R/filter_na_class.R
index 07a6ba3..ab40c74 100644
--- a/R/filter_na_class.R
+++ b/R/filter_na_class.R
@@ -68,6 +68,7 @@ filter_na <- function(
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("filter_na", "annotation_source"),
diff --git a/R/filter_range_class.R b/R/filter_range_class.R
index bdb48b6..aefadbb 100644
--- a/R/filter_range_class.R
+++ b/R/filter_range_class.R
@@ -108,6 +108,7 @@ filter_range <- function(
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("filter_range", "annotation_source"),
diff --git a/R/filter_records_class.R b/R/filter_records_class.R
index 3de3cdb..dc35fcc 100644
--- a/R/filter_records_class.R
+++ b/R/filter_records_class.R
@@ -87,6 +87,7 @@ filter_records <- function(where = wherever(A > 0), ...) {
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("filter_records", "annotation_source"),
diff --git a/R/filter_venn_class.R b/R/filter_venn_class.R
index e12796c..3318a9b 100644
--- a/R/filter_venn_class.R
+++ b/R/filter_venn_class.R
@@ -146,6 +146,7 @@ filter_venn <- function(
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("filter_venn", "annotation_source"),
diff --git a/R/generics.R b/R/generics.R
index a9e7da4..d686990 100644
--- a/R/generics.R
+++ b/R/generics.R
@@ -7,7 +7,7 @@
#'
#' @param obj an [`annotation_source()`] object
#' @param ... not currently used
-#' @return an [`annotation_table()`], [`annotation_library()`] or
+#' @return an [`annotation_table()`] or
#' [`annotation_database()`] object
#' @examples
#' # prepare source
@@ -39,7 +39,7 @@ setGeneric(
#' requested.
#' @examples
#' # test if column present
-#' AT <- annotation_source(data.frame(id = character(0)))
+#' AT <- annotation_source(data=data.frame(id = character(0)))
#' check_for_columns(AT, "id") # TRUE
#' check_for_columns(AT, "cake") # FALSE
#'
@@ -55,6 +55,7 @@ setGeneric(
#'
#' Reads an annotation_database and returns the data.frame.
#' @param obj An `annotation_database` object
+#' @param ... additional database specific inputs
#' @return A data.frame
#' @examples
#' M <- rds_database(tempfile())
@@ -68,6 +69,7 @@ setGeneric(
#'
#' Writes a data.frame to a `annotation_database`.
#' @param obj A `annotation_database` object
+#' @param ... additional database specific inputs
#' @return Silently returns TRUE if successful, FALSE otherwise
#' @examples
#' M <- rds_database(tempfile())
@@ -83,13 +85,14 @@ setGeneric(
#' in read and write mode.
#'
#' @param obj A `annotation_database` object
+#' @param ... additional database specific inputs
#' @return TRUE if the database is writable; FALSE otherwise. This method
#' does not check file properties, only the intended usage of the object.
#'
#' @examples
#'
#' M <- annotation_database()
-#' is.writable(M)
+#' is_writable(M)
#'
setGeneric(
"is_writable",
@@ -104,13 +107,14 @@ setGeneric(
#'
#' @param x an `annotation_source` object
#' @param y an second `annotation_source` object to join with the first
+#' @param ... additional inputs (not currently used)
#' @return an `annotation_source` object
#'
#' @examples
#'
-#' M <- annotation_source()
-#' N <- annotation_source()
-#' O <- vertical_join(M, N)
+#' M <- annotation_source(data=data.frame(id=1,value='A'))
+#' N <- annotation_source(data=data.frame(id=2,value='B'))
+#' O <- vertical_join(M, N, keep_cols='.all')
#'
setGeneric(
"vertical_join",
@@ -127,7 +131,8 @@ setGeneric(
#' collect and return the names of slots containing required column names for
#' the object and all of its parent objects.
#'
-#' @param x an `annotation_source` object
+#' @param obj an `annotation_source` object
+#' @param ... additional source specific inputs
#' @return a character vector of slot names
#'
#' @examples
@@ -135,7 +140,7 @@ setGeneric(
#' M <- lcms_table(id_column = "id", mz_column = "mz", rt_column = "rt")
#'
#' #' # get values for required slots
-#' r <- required(M)
+#' r <- required_cols(M)
#'
#' # get slot names for required columns
#' names(r)
diff --git a/R/github_file_class.R b/R/github_file_class.R
index 045a305..9dfd6cf 100644
--- a/R/github_file_class.R
+++ b/R/github_file_class.R
@@ -76,6 +76,7 @@ github_file <- function(
#' @export
+#' @rdname read_database
setMethod(
f = "read_database",
signature = c("github_file"), definition = function(obj) {
diff --git a/R/id_count_class.R b/R/id_count_class.R
index 6bb407a..a693196 100644
--- a/R/id_count_class.R
+++ b/R/id_count_class.R
@@ -69,6 +69,7 @@ id_counts <- function(
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("id_counts", "annotation_source"),
diff --git a/R/import_source_class.R b/R/import_source_class.R
index 04987b1..e302ea4 100644
--- a/R/import_source_class.R
+++ b/R/import_source_class.R
@@ -36,6 +36,7 @@ import_source <- function(...) {
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("import_source", "annotation_source"),
diff --git a/R/kegg_lookup_class.R b/R/kegg_lookup_class.R
index bdcd45c..4478ab8 100644
--- a/R/kegg_lookup_class.R
+++ b/R/kegg_lookup_class.R
@@ -82,7 +82,7 @@ kegg_lookup <- function(
type = "character",
max_length = 1,
allowed = c("compound", "glycan", "drug", "chebi", "pubchem"),
- value = "compound"
+ value = "pubchem"
),
from = enum(
name = "From identifier",
@@ -124,6 +124,7 @@ kegg_lookup <- function(
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("kegg_lookup", "annotation_source"),
diff --git a/R/lcms_table_class.R b/R/lcms_table_class.R
index 5a48550..f369a2f 100644
--- a/R/lcms_table_class.R
+++ b/R/lcms_table_class.R
@@ -9,7 +9,12 @@ lcms_table <- function(
mz_column = "mz",
rt_column = "rt",
...) {
+
if (is.null(data)) {
+ data = data.frame()
+ }
+
+ if (nrow(data)==0 & ncol(data)==0) {
data <- data.frame(
id = character(0),
mz = numeric(0),
@@ -22,6 +27,8 @@ lcms_table <- function(
)
}
+
+
# new object
out <- new_struct(
"lcms_table",
diff --git a/R/ls_source_class.R b/R/ls_source_class.R
index 51a5de2..9696c5a 100644
--- a/R/ls_source_class.R
+++ b/R/ls_source_class.R
@@ -9,16 +9,36 @@ ls_source <- function(
mz_column = "mz",
rt_column = "rt",
id_column = "id",
+ data = NULL,
...) {
+
+ if (is.null(data)) {
+ data = data.frame()
+ }
+
+ if (nrow(data)==0 & ncol(data)==0) {
+ data <- data.frame(
+ id = character(0),
+ mz = numeric(0),
+ rt = numeric(0)
+ )
+ colnames(data) <- c(
+ id_column,
+ mz_column,
+ rt_column
+ )
+ }
+
# new object
out <- new_struct(
"ls_source",
source = source,
tag = tag,
- mz_column = "mz",
- rt_column = "rt",
- id_column = "id",
- .required = c(mz_column, rt_column, id_column),
+ mz_column = mz_column,
+ rt_column = rt_column,
+ id_column = id_column,
+ .required = c(mz_column, id_column, rt_column),
+ data = data,
...
)
return(out)
@@ -56,7 +76,9 @@ ls_source <- function(
)
)
+
#' @export
+#' @rdname read_source
setMethod(
f = "read_source",
signature = c("ls_source"),
diff --git a/R/model_apply_doc.R b/R/model_apply_doc.R
new file mode 100644
index 0000000..1dee28a
--- /dev/null
+++ b/R/model_apply_doc.R
@@ -0,0 +1,11 @@
+#' Apply method
+#'
+#' Applies method to the input DatasetExperiment
+#' @param M a method object
+#' @param D another object used by the first
+#' @return Returns a modified method object
+#' @examples
+#' M = example_model()
+#' M = model_apply(M,iris_DatasetExperiment())
+#' @name model_apply
+NULL
diff --git a/R/mspurity_source_class.R b/R/mspurity_source_class.R
index f78665d..3e8e042 100644
--- a/R/mspurity_source_class.R
+++ b/R/mspurity_source_class.R
@@ -33,6 +33,7 @@ mspurity_source <- function(
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("mspurity_source", "lcms_table"),
diff --git a/R/mwb_refmet_database_class.R b/R/mwb_refmet_database_class.R
index 6861609..2a834ec 100644
--- a/R/mwb_refmet_database_class.R
+++ b/R/mwb_refmet_database_class.R
@@ -37,7 +37,7 @@ mwb_refmet_database <- function(
"locally and prevent unnecessary downloads. If a path is ",
"provided then `BiocFileCache` will use this location. ",
"If NULL it will use the default location ",
- "(see [BiocFileCache()] for details)."
+ "(see [BiocFileCache::BiocFileCache] for details)."
),
type = c("character"),
value = NULL
@@ -47,6 +47,7 @@ mwb_refmet_database <- function(
#' @export
+#' @rdname read_database
setMethod(
f = "read_database",
signature = c("mwb_refmet_database"), definition = function(obj) {
diff --git a/R/mwb_structure_chart_class.R b/R/mwb_structure_chart_class.R
index 67ab953..6c81e2e 100644
--- a/R/mwb_structure_chart_class.R
+++ b/R/mwb_structure_chart_class.R
@@ -57,6 +57,7 @@ mwb_structure <- function(
)
#' @export
+#' @template chart_plot
setMethod(
f = "chart_plot",
signature = c("mwb_structure", "annotation_source"),
diff --git a/R/mz_match_class.R b/R/mz_match_class.R
index e1ba913..cb8409f 100644
--- a/R/mz_match_class.R
+++ b/R/mz_match_class.R
@@ -93,7 +93,8 @@ mz_match <- function(
"for each data table."
),
type = c("numeric", "integer"),
- max_length = 2
+ max_length = 2,
+ value = 5
),
id_column = entity(
name = "id column name",
@@ -108,6 +109,7 @@ mz_match <- function(
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("mz_match", "annotation_source"),
diff --git a/R/mzrt_match_class.R b/R/mzrt_match_class.R
index b18d889..ebd3bfd 100644
--- a/R/mzrt_match_class.R
+++ b/R/mzrt_match_class.R
@@ -114,7 +114,8 @@ mzrt_match <- function(
"for each data table."
),
type = c("numeric", "integer"),
- max_length = 2
+ max_length = 2,
+ value = 5
),
rt_column = entity(
name = "rt column name",
@@ -133,7 +134,8 @@ mzrt_match <- function(
"for each data table."
),
type = c("numeric", "integer"),
- max_length = 2
+ max_length = 2,
+ value=20
),
id_column = entity(
name = "id column name",
@@ -148,6 +150,7 @@ mzrt_match <- function(
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("mzrt_match", "lcms_table"),
diff --git a/R/normalise_lipids_class.R b/R/normalise_lipids_class.R
index 1e07d89..468533b 100644
--- a/R/normalise_lipids_class.R
+++ b/R/normalise_lipids_class.R
@@ -123,6 +123,7 @@ normalise_lipids <- function(
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("normalise_lipids", "annotation_source"),
diff --git a/R/normalise_strings_class.R b/R/normalise_strings_class.R
index cc8fba0..631a0c7 100644
--- a/R/normalise_strings_class.R
+++ b/R/normalise_strings_class.R
@@ -89,6 +89,7 @@ normalise_strings <- function(
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("normalise_strings", "annotation_source"),
diff --git a/R/openbabel_structure_chart.R b/R/openbabel_structure_chart.R
index 012552f..1f3c6b9 100644
--- a/R/openbabel_structure_chart.R
+++ b/R/openbabel_structure_chart.R
@@ -187,6 +187,7 @@ openbabel_structure <- function(
)
#' @export
+#' @template chart_plot
setMethod(
f = "chart_plot",
signature = c("openbabel_structure", "character"),
@@ -209,6 +210,7 @@ setMethod(
#' @export
+#' @template chart_plot
setMethod(
f = "chart_plot",
signature = c("openbabel_structure", "annotation_source"),
diff --git a/R/opsin_lookup_class.R b/R/opsin_lookup_class.R
index 8464b2e..25565b3 100644
--- a/R/opsin_lookup_class.R
+++ b/R/opsin_lookup_class.R
@@ -28,7 +28,7 @@ opsin_lookup <- function(
prototype = list(
name = "Compound ID lookup via OPSIN",
description = paste0(
- "Uses the OPSIN API [https://opsin.ch.cam.ac.uk/] to search for ",
+ "Uses the [OPSIN API](https://opsin.ch.cam.ac.uk/) to search for ",
"identifers based on the input annotation column."
),
type = "rest_api",
diff --git a/R/pivot_columns_class.R b/R/pivot_columns_class.R
index 2b74062..2bca174 100644
--- a/R/pivot_columns_class.R
+++ b/R/pivot_columns_class.R
@@ -65,6 +65,7 @@ pivot_columns <- function(
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("pivot_columns", "annotation_source"),
diff --git a/R/prioritise_columns_class.R b/R/prioritise_columns_class.R
index 6972c60..2d55881 100644
--- a/R/prioritise_columns_class.R
+++ b/R/prioritise_columns_class.R
@@ -104,6 +104,7 @@ prioritise_columns <- function(
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("prioritise_columns", "annotation_source"),
diff --git a/R/pubchem_structure_chart_class.R b/R/pubchem_structure_chart_class.R
index 177d451..3a27068 100644
--- a/R/pubchem_structure_chart_class.R
+++ b/R/pubchem_structure_chart_class.R
@@ -100,6 +100,7 @@ pubchem_structure <- function(
)
#' @export
+#' @template chart_plot
setMethod(
f = "chart_plot",
signature = c("pubchem_structure", "annotation_source"),
diff --git a/R/pubchem_widget.R b/R/pubchem_widget.R
index a0d3104..b060f42 100644
--- a/R/pubchem_widget.R
+++ b/R/pubchem_widget.R
@@ -119,6 +119,7 @@ pubchem_widget <- function(
)
#' @export
+#' @template chart_plot
setMethod(
f = "chart_plot",
signature = c("pubchem_widget", "annotation_source"),
diff --git a/R/rdata_database_class.R b/R/rdata_database_class.R
index 93f999d..fe6e570 100644
--- a/R/rdata_database_class.R
+++ b/R/rdata_database_class.R
@@ -8,7 +8,7 @@ rdata_database <- function(
...) {
# new object
out <- struct::new_struct(
- "rds_database",
+ "rdata_database",
source = source,
variable_name = variable_name,
...
@@ -27,6 +27,7 @@ rdata_database <- function(
description = "A data.frame stored as an RData file.",
type = "rdata_database",
.writable = TRUE,
+ .params=c('variable_name'),
variable_name = entity(
name = "Variable name",
description = paste0(
@@ -35,12 +36,14 @@ rdata_database <- function(
"provided to e.g. extract a data.frame from a list in the ",
"imported environment."
),
- type = c("character", "function")
+ type = c("character", "function"),
+ value = 'a data frame'
)
)
)
#' @export
+#' @rdname read_database
setMethod(
f = "read_database",
signature = c("rdata_database"), definition = function(obj) {
@@ -63,6 +66,7 @@ setMethod(
#' @export
+#' @rdname is_writable
setMethod(
f = "is_writable",
signature = c("rdata_database"),
diff --git a/R/rds_cache_class.R b/R/rds_cache_class.R
index a90a330..05051b7 100644
--- a/R/rds_cache_class.R
+++ b/R/rds_cache_class.R
@@ -8,6 +8,11 @@ rds_cache <- function(
.search = character(0)
),
...) {
+
+ if (nrow(data)==0 & ncol(data)==0) {
+ data = data.frame(.search=NA)
+ }
+
# new object
out <- struct::new_struct(
"rds_cache",
diff --git a/R/rds_database_class.R b/R/rds_database_class.R
index 2acd5c8..d6c9a54 100644
--- a/R/rds_database_class.R
+++ b/R/rds_database_class.R
@@ -26,6 +26,7 @@ rds_database <- function(
)
#' @export
+#' @rdname read_database
setMethod(
f = "read_database",
signature = c("rds_database"), definition = function(obj) {
@@ -44,6 +45,7 @@ setMethod(
)
#' @export
+#' @rdname write_database
setMethod(
f = "write_database",
signature = c("rds_database"), definition = function(obj, df) {
diff --git a/R/remove_columns_class.R b/R/remove_columns_class.R
index fdb8081..987ce48 100644
--- a/R/remove_columns_class.R
+++ b/R/remove_columns_class.R
@@ -58,6 +58,7 @@ remove_columns <- function(expression = everything(), ...) {
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("remove_columns", "annotation_source"),
diff --git a/R/rename_columns_class.R b/R/rename_columns_class.R
index cd6a951..8da7db0 100644
--- a/R/rename_columns_class.R
+++ b/R/rename_columns_class.R
@@ -57,6 +57,7 @@ rename_columns <- function(
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("rename_columns", "annotation_source"),
diff --git a/R/rest_api_class.R b/R/rest_api_class.R
index cec498c..2a605c4 100644
--- a/R/rest_api_class.R
+++ b/R/rest_api_class.R
@@ -146,6 +146,7 @@ rest_api <- function(
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("rest_api", "annotation_source"),
diff --git a/R/rt_match_class.R b/R/rt_match_class.R
index bcc8678..abab330 100644
--- a/R/rt_match_class.R
+++ b/R/rt_match_class.R
@@ -87,7 +87,8 @@ rt_match <- function(
"for each data table."
),
type = c("numeric", "integer"),
- max_length = 2
+ max_length = 2,
+ value = 20
),
id_column = entity(
name = "id column name",
@@ -102,6 +103,7 @@ rt_match <- function(
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("rt_match", "annotation_table"),
diff --git a/R/select_columns_class.R b/R/select_columns_class.R
index 04a737c..61b770f 100644
--- a/R/select_columns_class.R
+++ b/R/select_columns_class.R
@@ -59,6 +59,7 @@ select_columns <- function(expression = everything(), ...) {
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("select_columns", "annotation_source"),
diff --git a/R/split_column_class.R b/R/split_column_class.R
index 483820e..7f6ac47 100644
--- a/R/split_column_class.R
+++ b/R/split_column_class.R
@@ -103,6 +103,7 @@ split_column <- function(
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("split_column", "annotation_source"),
diff --git a/R/sqlite_database_class.R b/R/sqlite_database_class.R
index 978588d..617fc33 100644
--- a/R/sqlite_database_class.R
+++ b/R/sqlite_database_class.R
@@ -37,6 +37,7 @@ sqlite_database <- function(
#' @export
+#' @rdname read_database
setMethod(
f = "read_database",
signature = c("sqlite_database"), definition = function(obj) {
@@ -57,14 +58,15 @@ setMethod(
)
#' @export
+#' @rdname write_database
setMethod(
f = "write_database",
- signature = c("sqlite_database"), definition = function(obj, cache) {
+ signature = c("sqlite_database"), definition = function(obj, df) {
# connect to database; create if doesnt exist
conn <- RSQLite::dbConnect(RSQLite::SQLite(), obj$source)
# write df to database
- RSQLite::dbWriteTable(conn, obj$table, cache, overwrite = TRUE)
+ RSQLite::dbWriteTable(conn, obj$table, df, overwrite = TRUE)
# disconnect
RSQLite::dbDisconnect(conn)
diff --git a/R/trim_whitespace_class.R b/R/trim_whitespace_class.R
index c407eec..e9bf866 100644
--- a/R/trim_whitespace_class.R
+++ b/R/trim_whitespace_class.R
@@ -87,6 +87,7 @@ trim_whitespace <- function(
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("trim_whitespace", "annotation_source"),
diff --git a/R/unique_records_class.R b/R/unique_records_class.R
index 4cd0999..0b8d774 100644
--- a/R/unique_records_class.R
+++ b/R/unique_records_class.R
@@ -36,6 +36,7 @@ unique_records <- function(...) {
#' @export
+#' @template model_apply
setMethod(
f = "model_apply",
signature = c("unique_records", "annotation_source"),
diff --git a/R/zzz.R b/R/zzz.R
index 6d1a7d5..4d374e2 100644
--- a/R/zzz.R
+++ b/R/zzz.R
@@ -76,13 +76,21 @@ theme_Publication <- function(base_size = 14) { # , base_family="helvetica") {
get_description <- function(id) {
str <- struct::get_description(id)
- str <- gsub("[a annotation_source]", "annotation_source()", str,
- fixed = TRUE
- )
- str <- gsub("[a quosures]", "wherever(A>10)", str,
- fixed = TRUE
- )
+ str <- gsub("[a annotation_source]", "annotation_source()",str,fixed = TRUE)
+ str <- gsub("[a quosures]", "wherever(A>10)", str,fixed = TRUE)
+ str <- gsub("data.frame(id=NA)","data.frame()",str,fixed = TRUE)
+
str <- gsub('>>','->' ,str)
str <- strwrap(str,70)
return(str)
}
+
+utils::globalVariables(c(
+ 'Checked','orange_id','setNames', # read_cd_compounds_file
+ 'A', # filter_records
+ 'X','Y', # venn_this
+ 'rotate','wrap_plots','plot_spacer', # annotation_histogram2d
+ 'compoundVariables',
+ 'orig_db','blue_id','Ion','Name','Formula','mzCloud.Best.Match',
+ 'Charge','Area'
+))
diff --git a/man-roxygen/chart_plot.R b/man-roxygen/chart_plot.R
new file mode 100644
index 0000000..47c2d6e
--- /dev/null
+++ b/man-roxygen/chart_plot.R
@@ -0,0 +1 @@
+#' @rdname chart_plot
diff --git a/man-roxygen/model_apply.R b/man-roxygen/model_apply.R
new file mode 100644
index 0000000..e32ac52
--- /dev/null
+++ b/man-roxygen/model_apply.R
@@ -0,0 +1 @@
+#' @rdname model_apply
diff --git a/man/AnnotationDb_database.Rd b/man/AnnotationDb_database.Rd
index 7e07b0c..a709378 100644
--- a/man/AnnotationDb_database.Rd
+++ b/man/AnnotationDb_database.Rd
@@ -38,7 +38,7 @@ classes: \cr\cr
\examples{
M = AnnotationDb_database( table = character(0), tag = character(0),
-data = data.frame(id=NA), source = character(0))
+data = data.frame(), source = character(0))
}
\references{
diff --git a/man/BiocFileCache_database.Rd b/man/BiocFileCache_database.Rd
index 4f1677f..87e3e94 100644
--- a/man/BiocFileCache_database.Rd
+++ b/man/BiocFileCache_database.Rd
@@ -67,7 +67,7 @@ classes: \cr\cr
\examples{
M = BiocFileCache_database( bfc_path = NULL, resource_name = "bfc",
bfc_fun = function(){}, import_fun = function(){}, offline = FALSE,
-tag = character(0), data = data.frame(id=NA), source = "ANY")
+tag = character(0), data = data.frame(), source = "ANY")
}
\references{
diff --git a/man/CompoundDb_source.Rd b/man/CompoundDb_source.Rd
index 50e150e..9a3f26c 100644
--- a/man/CompoundDb_source.Rd
+++ b/man/CompoundDb_source.Rd
@@ -36,7 +36,7 @@ A \code{CompoundDb_source} object inherits the following \code{struct} classes:
}
\examples{
-M = CompoundDb_source( tag = character(0), data = data.frame(id=NA),
+M = CompoundDb_source( tag = character(0), data = data.frame(),
source = "ANY")
}
diff --git a/man/GO_database.Rd b/man/GO_database.Rd
index 7bef656..9a4f0b4 100644
--- a/man/GO_database.Rd
+++ b/man/GO_database.Rd
@@ -42,7 +42,7 @@ A \code{GO_database} object inherits the following \code{struct} classes:
\examples{
M = GO_database( table = "GOBPCHILDREN", tag = character(0), data =
-data.frame(id=NA), source = character(0))
+data.frame(), source = character(0))
}
\references{
diff --git a/man/MTox700plus_database.Rd b/man/MTox700plus_database.Rd
index b90fcc7..0c6880b 100644
--- a/man/MTox700plus_database.Rd
+++ b/man/MTox700plus_database.Rd
@@ -13,8 +13,8 @@ MTox700plus_database(
}
\arguments{
\item{version}{(character) The version number of the MTox700+
-database to import. Available versions are listed here:
-\link{https://github.com/michabohealthscience/MTox700plus/releases}.
+database to import. Available versions are listed
+\href{https://github.com/michabohealthscience/MTox700plus/releases}{here}.
\code{version} should match the tag of the release e.g. \code{"v1.0"}. For
convenience \code{version = "latest"} will always retrieve the most recent
release. To prevent unecessary downloads \code{BiocFileCache} is used to
@@ -59,7 +59,7 @@ classes: \cr\cr
M = MTox700plus_database( version = "v1.0", bfc_path = NULL,
resource_name = "bfc", bfc_fun = function(){}, import_fun =
function(){}, offline = FALSE, tag = character(0), data =
-data.frame(id=NA), source = "ANY")
+data.frame(), source = "ANY")
}
\references{
diff --git a/man/PathBank_metabolite_database.Rd b/man/PathBank_metabolite_database.Rd
index 8d99b4a..e1e09f6 100644
--- a/man/PathBank_metabolite_database.Rd
+++ b/man/PathBank_metabolite_database.Rd
@@ -57,7 +57,7 @@ A \code{PathBank_metabolite_database} object inherits the following
M = PathBank_metabolite_database( version = "primary", bfc_path =
NULL, resource_name = "bfc", bfc_fun = function(){}, import_fun =
function(){}, offline = FALSE, tag = character(0), data =
-data.frame(id=NA), source = "ANY")
+data.frame(), source = "ANY")
}
\references{
diff --git a/man/add_columns.Rd b/man/add_columns.Rd
index 184504c..f4937e7 100644
--- a/man/add_columns.Rd
+++ b/man/add_columns.Rd
@@ -41,7 +41,7 @@ A \code{add_columns} object inherits the following \code{struct} classes:
}
\examples{
-M = add_columns( new_columns = data.frame(id=NA), by = "id")
+M = add_columns( new_columns = data.frame(), by = "id")
}
\references{
diff --git a/man/annotation_bar_chart.Rd b/man/annotation_bar_chart.Rd
index cbd0367..3e42d71 100644
--- a/man/annotation_bar_chart.Rd
+++ b/man/annotation_bar_chart.Rd
@@ -2,7 +2,7 @@
% Please edit documentation in R/annotation_bar_chart.R
\name{annotation_bar_chart}
\alias{annotation_bar_chart}
-\title{Annotation pie chart}
+\title{Annotation bar chart}
\usage{
annotation_bar_chart(
factor_name,
@@ -15,7 +15,7 @@ annotation_bar_chart(
}
\arguments{
\item{factor_name}{(character) The name of the column in the
-\code{annotation_source} to generate a pie chart from.}
+\code{annotation_source} to generate a chart from.}
\item{label_rotation}{(logical) Rotate labels. Allowed values are
limited to the following: \itemize{ \item{\code{"TRUE"}: Rotate
@@ -24,8 +24,8 @@ labels.}} The default is \code{FALSE}.\cr}
\item{label_location}{(character) Label location. Allowed values are
limited to the following: \itemize{ \item{\code{"inside"}: Labels are
-displayed inside the segments.}\item{\code{"outside"}: Labels are
-displayed outside the segments.}} The default is \code{"inside"}.}
+displayed inside the bars.}\item{\code{"outside"}: Labels are
+displayed outside the bars.}} The default is \code{"inside"}.}
\item{label_type}{(character) Label type. Allowed values are limited
to the following: \itemize{ \item{\code{"percent"}: Labels will
@@ -40,32 +40,16 @@ using a legend.}\item{\code{"FALSE"}: Groups are indicated in the
labels.}} The default is \code{FALSE}.\cr}
\item{...}{Additional slots and values passed to \code{struct_class}.}
-
-\item{pie_rotation}{(numeric) The number of degrees to rotate the pie
-chart by, clockwise. The default is \code{0}.\cr}
-
-\item{centre_radius}{(numeric, integer) The radius of the centre
-circle. Used to make a "donut" plot. Should be a value between 0 and
-\enumerate{
-\item The default is \code{0}.\cr
-}}
-
-\item{centre_label}{(NULL, character) The text to display in the
-centre of the pie chart. Mostly used with donut plots where
-\code{centre_radius} is greater than 0. The default is \code{NULL}.}
-
-\item{count_na}{(logical) Include the number of missing values in the
-pie chart. The default is \code{FALSE}.\cr}
}
\value{
A \code{
-annotation_pie_chart
+annotation_bar_chart
} object. This object has no \code{output} slots.
See \code{\link[struct]{chart_plot}} in the \code{struct} package to
plot this chart object.
}
\description{
-Display a pie chart of labels in the specified column of
+Display a bar chart of labels in the specified column of
an annotation_source.
}
\details{
@@ -74,16 +58,15 @@ packages:\itemize{ \item{\code{ggplot2}}}
}
\section{Inheritance}{
-A \code{annotation_pie_chart} object inherits the following \code{struct}
+A \code{annotation_bar_chart} object inherits the following \code{struct}
classes: \cr\cr
-\verb{[annotation_pie_chart]} -> \verb{[chart]} -> \verb{[struct_class]}
+\verb{[annotation_bar_chart]} -> \verb{[chart]} -> \verb{[struct_class]}
}
\examples{
-M = annotation_pie_chart( factor_name = "V1", label_location =
-"inside", label_rotation = FALSE, legend = FALSE, pie_rotation = 0,
-label_type = "percent", centre_radius = 0, centre_label = NULL,
-count_na = FALSE)
+M = annotation_bar_chart( factor_name = "V1", label_location =
+"inside", label_rotation = FALSE, legend = FALSE, label_type =
+"percent")
}
\references{
diff --git a/man/annotation_database.Rd b/man/annotation_database.Rd
index ce2fc70..c9595a2 100644
--- a/man/annotation_database.Rd
+++ b/man/annotation_database.Rd
@@ -35,8 +35,8 @@ classes: \cr\cr
}
\examples{
-M = annotation_database( tag = character(0), data =
-data.frame(id=NA), source = "ANY")
+M = annotation_database( tag = character(0), data = data.frame(),
+source = "ANY")
}
\seealso{
diff --git a/man/annotation_source.Rd b/man/annotation_source.Rd
index c3eb8af..afd911a 100644
--- a/man/annotation_source.Rd
+++ b/man/annotation_source.Rd
@@ -2,11 +2,14 @@
% Please edit documentation in R/annotation_source_class.R
\name{annotation_source}
\alias{annotation_source}
-\title{An annotation database}
+\title{An annotation source}
\usage{
annotation_source(source = character(0), data = data.frame(), tag = "", ...)
}
\arguments{
+\item{source}{(ANY) The source of annotation data. The default is
+\code{character(0)}.}
+
\item{data}{(data.frame, NULL) A data.frame of annotation data. The
default is \code{data.frame()}.}
@@ -18,25 +21,23 @@ used in a workflow. The default is \code{""}.}
}
\value{
A \code{
-annotation_database
+annotation_source
} object. This object has no \code{output} slots.
}
\description{
-An \code{annotation_database} is an \code{\link[=annotation_source]{annotation_source()}}
-where the imported data.frame contains meta data for annotations. For
-example it might be a table of molecular identifiers, associated
-pathways etc.
+A base class defining an annotation source. This object
+is extended by MetmashR to define other objects.
}
\section{Inheritance}{
-A \code{annotation_database} object inherits the following \code{struct}
-classes: \cr\cr
-\verb{[annotation_database]} -> \verb{[annotation_source]} -> \verb{[struct_class]}
+A \code{annotation_source} object inherits the following \code{struct} classes:
+\cr\cr
+\verb{[annotation_source]} -> \verb{[struct_class]}
}
\examples{
-M = annotation_database( tag = character(0), data =
-data.frame(id=NA), source = "ANY")
+M = annotation_source( tag = character(0), data = data.frame(),
+source = "ANY")
}
\seealso{
diff --git a/man/annotation_table.Rd b/man/annotation_table.Rd
index 32df0aa..91efa8a 100644
--- a/man/annotation_table.Rd
+++ b/man/annotation_table.Rd
@@ -41,7 +41,7 @@ A \code{annotation_table} object inherits the following \code{struct} classes:
\examples{
M = annotation_table( id_column = "id", tag = character(0), data =
-data.frame(id=NA), source = "ANY")
+data.frame(), source = "ANY")
}
\seealso{
diff --git a/man/annotation_upset_chart.Rd b/man/annotation_upset_chart.Rd
new file mode 100644
index 0000000..e8d0455
--- /dev/null
+++ b/man/annotation_upset_chart.Rd
@@ -0,0 +1,104 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/annotation_upset_chart_class.R
+\name{annotation_upset_chart}
+\alias{annotation_upset_chart}
+\title{Annotation UpSet chart}
+\usage{
+annotation_upset_chart(
+ factor_name,
+ group_column = NULL,
+ width_ratio = 0.2,
+ xlabel = "group",
+ sort_intersections = "descending",
+ intersections = "observed",
+ n_intersections = NULL,
+ min_size = 0,
+ queries = list(),
+ keep_empty_groups = FALSE,
+ ...
+)
+}
+\arguments{
+\item{factor_name}{(character) The name of the column(s) in the
+\code{annotation_source}(s) to generate an UpSet chart from.}
+
+\item{group_column}{(character, NULL) The name of the column in the
+\code{annotation_source} to create groups from in the Venn diagram. This
+parameter is ignored if there are multiple input tables, as each
+table is considered to be a group. This parameter is also ignored if
+more than one \code{factor_name} is provided, as each column is considered
+a group. The default is \code{NULL}.}
+
+\item{width_ratio}{(numeric) Proportion of plot given to set size bar
+chart. The default is \code{0.2}.\cr}
+
+\item{xlabel}{(character) The label used for the x-axis. The default
+is \code{"group"}.}
+
+\item{sort_intersections}{(character) Sort intersections. Allowed
+values are limited to the following: \itemize{
+\item{\code{"ascending"}: Groups are sorted by increasing
+size.}\item{\code{"descending"}: Groups are sorted by decreasing
+size.}\item{\code{"none"}: Groups are not sorted.}} The default is
+\code{"descending"}.}
+
+\item{intersections}{(character, list) The intersections to include
+in the plot. The default is \code{"observed"}.}
+
+\item{n_intersections}{(numeric, integer, NULL) The number of
+intersections to include in the plot. The default is \code{NULL}.}
+
+\item{min_size}{(numeric, integer) The minimum size of an
+intersection for it to be included in the plot. The default is
+\code{0}.\cr}
+
+\item{queries}{(list) A list of upset queries. The default is
+\code{list()}.}
+
+\item{keep_empty_groups}{(logical) Whether empty sets should be kept
+(including sets which are only empty after filtering by size). The
+default is \code{FALSE}.\cr}
+
+\item{...}{Additional slots and values passed to \code{struct_class}.}
+}
+\value{
+A \code{
+annotation_upset_chart
+} object. This object has no \code{output} slots.
+See \code{\link[struct]{chart_plot}} in the \code{struct} package to
+plot this chart object.
+}
+\description{
+Display an UpSet chart of labels in the specified column
+of an annotation_source.
+}
+\details{
+This object makes use of functionality from the following
+packages:\itemize{ \item{\code{ComplexUpset}}}
+}
+\section{Inheritance}{
+
+A \code{annotation_upset_chart} object inherits the following \code{struct}
+classes: \cr\cr
+\verb{[annotation_upset_chart]} -> \verb{[chart]} -> \verb{[struct_class]}
+}
+
+\examples{
+M = annotation_upset_chart( factor_name = "V1", group_column = NULL,
+width_ratio = 0.2, xlabel = "group", sort_intersections =
+"descending", intersections = "observed", n_intersections = NULL,
+min_size = 0, queries = list(), keep_empty_groups = FALSE)
+
+}
+\references{
+Krassowski M (2020). "ComplexUpset."
+doi:10.5281/zenodo.3700590 \url{https://doi.org/10.5281/zenodo.3700590},
+\url{https://doi.org/10.5281/zenodo.3700590}.
+
+Lex A, Gehlenborg N, Strobelt H, Vuillemot R, Pfister H
+(2014). "UpSet: Visualization of Intersecting Sets,." \emph{IEEE
+Transactions on Visualization and Computer Graphics}, \emph{20}(12),
+1983–1992. doi:10.1109/TVCG.2014.2346248
+\url{https://doi.org/10.1109/TVCG.2014.2346248},
+\url{https://doi.org/10.1109/TVCG.2014.2346248}.
+}
diff --git a/man/cd_source.Rd b/man/cd_source.Rd
index df7cbda..b90a5a9 100644
--- a/man/cd_source.Rd
+++ b/man/cd_source.Rd
@@ -11,6 +11,7 @@ cd_source(
mz_column = "mz",
rt_column = "rt",
id_column = "id",
+ data = NULL,
...
)
}
@@ -38,6 +39,9 @@ data.frame containing retention time values. The default is
data.frame containing row identifers. If NULL This will be generated
automatically. The default is \code{"id"}.}
+\item{data}{(data.frame, NULL) A data.frame of annotation data. The
+default is \code{NULL}.}
+
\item{...}{Additional slots and values passed to \code{struct_class}.}
}
\value{
@@ -59,8 +63,8 @@ A \code{cd_source} object inherits the following \code{struct} classes: \cr\cr
\examples{
M = cd_source( sheets = c(2, 2), mz_column = "mz", rt_column = "rt",
-id_column = "id", tag = character(0), data = data.frame(id=NA),
-source = character(0))
+id_column = "id", tag = character(0), data = data.frame(), source =
+character(0))
}
\seealso{
diff --git a/man/chart_plot.Rd b/man/chart_plot.Rd
new file mode 100644
index 0000000..33cb3b2
--- /dev/null
+++ b/man/chart_plot.Rd
@@ -0,0 +1,67 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/annotation_bar_chart.R,
+% R/annotation_histogram_class.R, R/annotation_histogram2d_class.R,
+% R/annotation_pie_chart.R, R/annotation_upset_chart_class.R,
+% R/annotation_venn_chart.R, R/chart_plot_doc.R,
+% R/mwb_structure_chart_class.R, R/openbabel_structure_chart.R,
+% R/pubchem_structure_chart_class.R, R/pubchem_widget.R
+\name{chart_plot,annotation_bar_chart,annotation_source-method}
+\alias{chart_plot,annotation_bar_chart,annotation_source-method}
+\alias{chart_plot,annotation_histogram,annotation_source-method}
+\alias{chart_plot,annotation_histogram2d,annotation_source-method}
+\alias{chart_plot,annotation_pie_chart,annotation_source-method}
+\alias{chart_plot,annotation_upset_chart,annotation_source-method}
+\alias{chart_plot,annotation_upset_chart,list-method}
+\alias{chart_plot,annotation_venn_chart,annotation_source-method}
+\alias{chart_plot,annotation_venn_chart,list-method}
+\alias{chart_plot}
+\alias{chart_plot,mwb_structure,annotation_source-method}
+\alias{chart_plot,openbabel_structure,character-method}
+\alias{chart_plot,openbabel_structure,annotation_source-method}
+\alias{chart_plot,pubchem_structure,annotation_source-method}
+\alias{chart_plot,pubchem_widget,annotation_source-method}
+\title{chart_plot method}
+\usage{
+\S4method{chart_plot}{annotation_bar_chart,annotation_source}(obj, dobj)
+
+\S4method{chart_plot}{annotation_histogram,annotation_source}(obj, dobj)
+
+\S4method{chart_plot}{annotation_histogram2d,annotation_source}(obj, dobj)
+
+\S4method{chart_plot}{annotation_pie_chart,annotation_source}(obj, dobj)
+
+\S4method{chart_plot}{annotation_upset_chart,annotation_source}(obj, dobj, ...)
+
+\S4method{chart_plot}{annotation_upset_chart,list}(obj, dobj)
+
+\S4method{chart_plot}{annotation_venn_chart,annotation_source}(obj, dobj, ...)
+
+\S4method{chart_plot}{annotation_venn_chart,list}(obj, dobj)
+
+\S4method{chart_plot}{mwb_structure,annotation_source}(obj, dobj)
+
+\S4method{chart_plot}{openbabel_structure,character}(obj, dobj)
+
+\S4method{chart_plot}{openbabel_structure,annotation_source}(obj, dobj)
+
+\S4method{chart_plot}{pubchem_structure,annotation_source}(obj, dobj)
+
+\S4method{chart_plot}{pubchem_widget,annotation_source}(obj, dobj)
+}
+\arguments{
+\item{obj}{a chart object}
+
+\item{dobj}{a struct object}
+
+\item{...}{additiional inputs to chart_plot}
+}
+\value{
+a plot object
+}
+\description{
+Plots a chart object
+}
+\examples{
+C = example_chart()
+chart_plot(C,example_model())
+}
diff --git a/man/check_for_columns.Rd b/man/check_for_columns.Rd
index 26202c9..6f18c60 100644
--- a/man/check_for_columns.Rd
+++ b/man/check_for_columns.Rd
@@ -1,10 +1,13 @@
% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/generics.R
+% Please edit documentation in R/generics.R, R/annotation_source_class.R
\name{check_for_columns}
\alias{check_for_columns}
+\alias{check_for_columns,annotation_source-method}
\title{Check for columns in an \code{annotation_source}}
\usage{
check_for_columns(obj, ..., msg = FALSE)
+
+\S4method{check_for_columns}{annotation_source}(obj, ..., msg = FALSE)
}
\arguments{
\item{obj}{an \code{\link[=annotation_source]{annotation_source()}} object}
@@ -27,7 +30,7 @@ used by MetMashR to ensure validity of certain objects.
}
\examples{
# test if column present
-AT <- annotation_source(data.frame(id = character(0)))
+AT <- annotation_source(data=data.frame(id = character(0)))
check_for_columns(AT, "id") # TRUE
check_for_columns(AT, "cake") # FALSE
diff --git a/man/combine_records_helper_functions.Rd b/man/combine_records_helper_functions.Rd
index b021e60..bd68eca 100644
--- a/man/combine_records_helper_functions.Rd
+++ b/man/combine_records_helper_functions.Rd
@@ -72,6 +72,8 @@ locating values in the matching column.}
\item{digits}{(numeric) the number of digits to use when converting numerical
values to characters when determining if values are unique.}
+\item{drop_na}{(logical) exclude NA from the list of unique entires}
+
\item{sort}{(logical) sort the values before collapsing.}
\item{priority}{(character) a list of labels in priority order}
@@ -150,7 +152,7 @@ and the worst grade is "Z" or "z". Any non-exact matches to a character in
# Select matching records
M <- combine_records(
group_by = "example",
- default_fcn = .select_match(
+ default_fcn = .select_exact(
match_col = "match_column",
match = "find_me",
separator = ", ",
diff --git a/man/database_lookup.Rd b/man/database_lookup.Rd
index 7262b2d..0a93528 100644
--- a/man/database_lookup.Rd
+++ b/man/database_lookup.Rd
@@ -63,8 +63,8 @@ A \code{database_lookup} object inherits the following \code{struct} classes:
\examples{
M = database_lookup( query_column = "V1", database_column = "",
-database = data.frame(id=NA), include = NULL, suffix = NULL,
-not_found = NULL)
+database = data.frame(), include = NULL, suffix = NULL, not_found =
+NULL)
}
\references{
diff --git a/man/dot-cache_as_is.Rd b/man/dot-cache_as_is.Rd
index b5a1dec..4b97045 100644
--- a/man/dot-cache_as_is.Rd
+++ b/man/dot-cache_as_is.Rd
@@ -20,7 +20,7 @@ copy the file directly to the cache without making any changes.
}
\examples{
M <- BiocFileCache_database(
- path = tempfile(),
+ source = tempfile(),
resource_name = "example",
bfc_fun = .cache_as_is
)
diff --git a/man/dot-tripeptide_dictionary.Rd b/man/dot-tripeptide_dictionary.Rd
index d8e6736..bfc3dbd 100644
--- a/man/dot-tripeptide_dictionary.Rd
+++ b/man/dot-tripeptide_dictionary.Rd
@@ -22,7 +22,7 @@ e.g. INK becomes Ile-Asn-Lys
M <- normalise_strings(
search_column = "example",
output_column = "result",
- dictionary = .amino_acid_dictionary
+ dictionary = .tripeptide_dictionary
)
}
diff --git a/man/dot-unzip.Rd b/man/dot-unzip.Rd
index a08e0b8..6f76a08 100644
--- a/man/dot-unzip.Rd
+++ b/man/dot-unzip.Rd
@@ -22,7 +22,7 @@ temporary folder before storing it in the cache.
}
\examples{
M <- BiocFileCache_database(
- path = tempfile(),
+ source = tempfile(),
resource_name = "example",
bfc_fun = .unzip
)
diff --git a/man/excel_database.Rd b/man/excel_database.Rd
index 2d905ea..47fb7a9 100644
--- a/man/excel_database.Rd
+++ b/man/excel_database.Rd
@@ -54,7 +54,7 @@ A \code{excel_database} object inherits the following \code{struct} classes:
\examples{
M = excel_database( sheet = character(0), rowNames = FALSE, colNames
-= FALSE, startRow = 1, tag = character(0), data = data.frame(id=NA),
+= FALSE, startRow = 1, tag = character(0), data = data.frame(),
source = "ANY")
}
diff --git a/man/github_file.Rd b/man/github_file.Rd
index 6592ad5..e8829dc 100644
--- a/man/github_file.Rd
+++ b/man/github_file.Rd
@@ -62,7 +62,7 @@ M = github_file( username = character(0), repository_name =
character(0), file_path = character(0), bfc_path = NULL,
resource_name = "bfc", bfc_fun = function(){}, import_fun =
function(){}, offline = FALSE, tag = character(0), data =
-data.frame(id=NA), source = "ANY")
+data.frame(), source = "ANY")
}
\references{
diff --git a/man/is_writable.Rd b/man/is_writable.Rd
index 372cfd6..e26aa8e 100644
--- a/man/is_writable.Rd
+++ b/man/is_writable.Rd
@@ -1,13 +1,22 @@
% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/generics.R
+% Please edit documentation in R/generics.R, R/annotation_database_class.R,
+% R/rdata_database_class.R
\name{is_writable}
\alias{is_writable}
+\alias{is_writable,annotation_database-method}
+\alias{is_writable,rdata_database-method}
\title{Is database writable}
\usage{
is_writable(obj, ...)
+
+\S4method{is_writable}{annotation_database}(obj)
+
+\S4method{is_writable}{rdata_database}(obj)
}
\arguments{
\item{obj}{A \code{annotation_database} object}
+
+\item{...}{additional database specific inputs}
}
\value{
TRUE if the database is writable; FALSE otherwise. This method
@@ -20,6 +29,6 @@ in read and write mode.
\examples{
M <- annotation_database()
-is.writable(M)
+is_writable(M)
}
diff --git a/man/kegg_lookup.Rd b/man/kegg_lookup.Rd
index d96b0ba..7d0f9d7 100644
--- a/man/kegg_lookup.Rd
+++ b/man/kegg_lookup.Rd
@@ -63,7 +63,7 @@ A \code{kegg_lookup} object inherits the following \code{struct} classes:
}
\examples{
-M = kegg_lookup( get = "compound", from = "compound", query_column =
+M = kegg_lookup( get = "pubchem", from = "compound", query_column =
"V1", suffix = "_kegg")
}
diff --git a/man/lcms_table.Rd b/man/lcms_table.Rd
index f549db6..0e1d55f 100644
--- a/man/lcms_table.Rd
+++ b/man/lcms_table.Rd
@@ -53,7 +53,7 @@ A \code{lcms_table} object inherits the following \code{struct} classes: \cr\cr
\examples{
M = lcms_table( mz_column = "mz", rt_column = "rt", id_column = "id",
-tag = character(0), data = data.frame(id=NA), source = "ANY")
+tag = character(0), data = data.frame(), source = "ANY")
}
\concept{{annotation_tables}}
diff --git a/man/ls_source.Rd b/man/ls_source.Rd
index 0ecf682..9c2b5f7 100644
--- a/man/ls_source.Rd
+++ b/man/ls_source.Rd
@@ -10,6 +10,7 @@ ls_source(
mz_column = "mz",
rt_column = "rt",
id_column = "id",
+ data = NULL,
...
)
}
@@ -31,6 +32,9 @@ data.frame containing retention time values. The default is
data.frame containing row identifers. If NULL This will be generated
automatically. The default is \code{"id"}.}
+\item{data}{(data.frame, NULL) A data.frame of annotation data. The
+default is \code{NULL}.}
+
\item{...}{Additional slots and values passed to \code{struct_class}.}
}
\value{
@@ -52,7 +56,7 @@ A \code{ls_source} object inherits the following \code{struct} classes: \cr\cr
\examples{
M = ls_source( mz_column = "mz", rt_column = "rt", id_column = "id",
-tag = character(0), data = data.frame(id=NA), source = "ANY")
+tag = character(0), data = data.frame(), source = "ANY")
}
\seealso{
diff --git a/man/model_apply.Rd b/man/model_apply.Rd
new file mode 100644
index 0000000..7b57622
--- /dev/null
+++ b/man/model_apply.Rd
@@ -0,0 +1,158 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/annotation_source_class.R,
+% R/AnnotationDb_select_class.R, R/CompoundDb_source_class.R,
+% R/add_columns_class.R, R/add_labels_class.R, R/calc_ppm_diff_class.R,
+% R/calc_rt_diff_class.R, R/rest_api_class.R, R/combine_columns_class.R,
+% R/combine_records_class.R, R/combine_sources.R, R/compute_column_class.R,
+% R/compute_record_class.R, R/database_lookup_class.R,
+% R/expand_records_class.R, R/filter_labels_class.R,
+% R/filter_na_class.R, R/filter_range_class.R, R/filter_records_class.R,
+% R/filter_venn_class.R, R/id_count_class.R, R/import_source_class.R,
+% R/kegg_lookup_class.R, R/model_apply_doc.R, R/mspurity_source_class.R,
+% R/mz_match_class.R, R/mzrt_match_class.R, R/normalise_lipids_class.R,
+% R/normalise_strings_class.R, R/pivot_columns_class.R,
+% R/prioritise_columns_class.R, R/remove_columns_class.R,
+% R/rename_columns_class.R, R/rt_match_class.R, R/select_columns_class.R,
+% R/split_column_class.R, R/trim_whitespace_class.R, R/unique_records_class.R
+\name{model_apply,model,annotation_source-method}
+\alias{model_apply,model,annotation_source-method}
+\alias{model_apply,model,list-method}
+\alias{model_apply,model_seq,list-method}
+\alias{model_apply,model_seq,annotation_source-method}
+\alias{model_apply,AnnotationDb_select,annotation_source-method}
+\alias{model_apply,CompoundDb_source,annotation_source-method}
+\alias{model_apply,add_columns,annotation_source-method}
+\alias{model_apply,add_labels,annotation_source-method}
+\alias{model_apply,calc_ppm_diff,annotation_table-method}
+\alias{model_apply,calc_rt_diff,annotation_table-method}
+\alias{model_apply,rest_api,annotation_source-method}
+\alias{model_apply,combine_columns,annotation_source-method}
+\alias{model_apply,combine_records,annotation_source-method}
+\alias{model_apply,combine_sources,annotation_source-method}
+\alias{model_apply,combine_sources,list-method}
+\alias{model_apply,compute_column,annotation_source-method}
+\alias{model_apply,compute_record,annotation_source-method}
+\alias{model_apply,database_lookup,annotation_source-method}
+\alias{model_apply,split_records,annotation_source-method}
+\alias{model_apply,filter_labels,annotation_source-method}
+\alias{model_apply,filter_na,annotation_source-method}
+\alias{model_apply,filter_range,annotation_source-method}
+\alias{model_apply,filter_records,annotation_source-method}
+\alias{model_apply,filter_venn,annotation_source-method}
+\alias{model_apply,id_counts,annotation_source-method}
+\alias{model_apply,import_source,annotation_source-method}
+\alias{model_apply,kegg_lookup,annotation_source-method}
+\alias{model_apply}
+\alias{model_apply,mspurity_source,lcms_table-method}
+\alias{model_apply,mz_match,annotation_source-method}
+\alias{model_apply,mzrt_match,lcms_table-method}
+\alias{model_apply,normalise_lipids,annotation_source-method}
+\alias{model_apply,normalise_strings,annotation_source-method}
+\alias{model_apply,pivot_columns,annotation_source-method}
+\alias{model_apply,prioritise_columns,annotation_source-method}
+\alias{model_apply,remove_columns,annotation_source-method}
+\alias{model_apply,rename_columns,annotation_source-method}
+\alias{model_apply,rt_match,annotation_table-method}
+\alias{model_apply,select_columns,annotation_source-method}
+\alias{model_apply,split_column,annotation_source-method}
+\alias{model_apply,trim_whitespace,annotation_source-method}
+\alias{model_apply,unique_records,annotation_source-method}
+\title{Apply method}
+\usage{
+\S4method{model_apply}{model,annotation_source}(M, D)
+
+\S4method{model_apply}{model,list}(M, D)
+
+\S4method{model_apply}{model_seq,list}(M, D)
+
+\S4method{model_apply}{model_seq,annotation_source}(M, D)
+
+\S4method{model_apply}{AnnotationDb_select,annotation_source}(M, D)
+
+\S4method{model_apply}{CompoundDb_source,annotation_source}(M, D)
+
+\S4method{model_apply}{add_columns,annotation_source}(M, D)
+
+\S4method{model_apply}{add_labels,annotation_source}(M, D)
+
+\S4method{model_apply}{calc_ppm_diff,annotation_table}(M, D)
+
+\S4method{model_apply}{calc_rt_diff,annotation_table}(M, D)
+
+\S4method{model_apply}{rest_api,annotation_source}(M, D)
+
+\S4method{model_apply}{combine_columns,annotation_source}(M, D)
+
+\S4method{model_apply}{combine_records,annotation_source}(M, D)
+
+\S4method{model_apply}{combine_sources,annotation_source}(M, D)
+
+\S4method{model_apply}{combine_sources,list}(M, D)
+
+\S4method{model_apply}{compute_column,annotation_source}(M, D)
+
+\S4method{model_apply}{compute_record,annotation_source}(M, D)
+
+\S4method{model_apply}{database_lookup,annotation_source}(M, D)
+
+\S4method{model_apply}{split_records,annotation_source}(M, D)
+
+\S4method{model_apply}{filter_labels,annotation_source}(M, D)
+
+\S4method{model_apply}{filter_na,annotation_source}(M, D)
+
+\S4method{model_apply}{filter_range,annotation_source}(M, D)
+
+\S4method{model_apply}{filter_records,annotation_source}(M, D)
+
+\S4method{model_apply}{filter_venn,annotation_source}(M, D)
+
+\S4method{model_apply}{id_counts,annotation_source}(M, D)
+
+\S4method{model_apply}{import_source,annotation_source}(M, D)
+
+\S4method{model_apply}{kegg_lookup,annotation_source}(M, D)
+
+\S4method{model_apply}{mspurity_source,lcms_table}(M, D)
+
+\S4method{model_apply}{mz_match,annotation_source}(M, D)
+
+\S4method{model_apply}{mzrt_match,lcms_table}(M, D)
+
+\S4method{model_apply}{normalise_lipids,annotation_source}(M, D)
+
+\S4method{model_apply}{normalise_strings,annotation_source}(M, D)
+
+\S4method{model_apply}{pivot_columns,annotation_source}(M, D)
+
+\S4method{model_apply}{prioritise_columns,annotation_source}(M, D)
+
+\S4method{model_apply}{remove_columns,annotation_source}(M, D)
+
+\S4method{model_apply}{rename_columns,annotation_source}(M, D)
+
+\S4method{model_apply}{rt_match,annotation_table}(M, D)
+
+\S4method{model_apply}{select_columns,annotation_source}(M, D)
+
+\S4method{model_apply}{split_column,annotation_source}(M, D)
+
+\S4method{model_apply}{trim_whitespace,annotation_source}(M, D)
+
+\S4method{model_apply}{unique_records,annotation_source}(M, D)
+}
+\arguments{
+\item{M}{a method object}
+
+\item{D}{another object used by the first}
+}
+\value{
+Returns a modified method object
+}
+\description{
+Applies method to the input DatasetExperiment
+}
+\examples{
+M = example_model()
+M = model_apply(M,iris_DatasetExperiment())
+}
diff --git a/man/mspurity_source.Rd b/man/mspurity_source.Rd
index 7317cab..63aebc0 100644
--- a/man/mspurity_source.Rd
+++ b/man/mspurity_source.Rd
@@ -36,8 +36,8 @@ A \code{mspurity_source} object inherits the following \code{struct} classes:
}
\examples{
-M = mspurity_source( tag = character(0), data = data.frame(id=NA),
-source = "ANY")
+M = mspurity_source( tag = character(0), data = data.frame(), source
+= "ANY")
}
\references{
diff --git a/man/mwb_refmet_database.Rd b/man/mwb_refmet_database.Rd
index c6869ac..d66a447 100644
--- a/man/mwb_refmet_database.Rd
+++ b/man/mwb_refmet_database.Rd
@@ -10,8 +10,8 @@ mwb_refmet_database(bfc = NULL, ...)
\item{bfc}{(character) \code{BiocFileCache} is used to cache database
locally and prevent unnecessary downloads. If a path is provided then
\code{BiocFileCache} will use this location. If NULL it will use the
-default location (see \code{\link[=BiocFileCache]{BiocFileCache()}} for details). The default is
-\code{NULL}.}
+default location (see \link[BiocFileCache:BiocFileCache-class]{BiocFileCache::BiocFileCache} for details).
+The default is \code{NULL}.}
\item{...}{Additional slots and values passed to \code{struct_class}.}
}
@@ -38,7 +38,7 @@ classes: \cr\cr
\examples{
M = mwb_refmet_database( bfc = character(0), tag = character(0), data
-= data.frame(id=NA), source = "ANY")
+= data.frame(), source = "ANY")
}
\references{
diff --git a/man/mz_match.Rd b/man/mz_match.Rd
index b4e7f74..6c90baa 100644
--- a/man/mz_match.Rd
+++ b/man/mz_match.Rd
@@ -44,7 +44,7 @@ A \code{mz_match} object inherits the following \code{struct} classes: \cr\cr
}
\examples{
-M = mz_match( variable_meta = data.frame(id=NA), mz_column =
-character(0), ppm_window = numeric(0), id_column = character(0))
+M = mz_match( variable_meta = data.frame(), mz_column = character(0),
+ppm_window = 5, id_column = character(0))
}
diff --git a/man/mzrt_match.Rd b/man/mzrt_match.Rd
index caaf198..f5329ec 100644
--- a/man/mzrt_match.Rd
+++ b/man/mzrt_match.Rd
@@ -61,8 +61,8 @@ A \code{mzrt_match} object inherits the following \code{struct} classes: \cr\cr
}
\examples{
-M = mzrt_match( variable_meta = data.frame(id=NA), mz_column =
-character(0), ppm_window = numeric(0), id_column = character(0),
-rt_column = character(0), rt_window = numeric(0))
+M = mzrt_match( variable_meta = data.frame(), mz_column =
+character(0), ppm_window = 5, id_column = character(0), rt_column =
+character(0), rt_window = 20)
}
diff --git a/man/opsin_lookup.Rd b/man/opsin_lookup.Rd
index 16ad23e..5904d15 100644
--- a/man/opsin_lookup.Rd
+++ b/man/opsin_lookup.Rd
@@ -28,7 +28,7 @@ adding data returned by the API. \cr
}
}
\description{
-Uses the OPSIN API \link{https://opsin.ch.cam.ac.uk/} to
+Uses the \href{https://opsin.ch.cam.ac.uk/}{OPSIN API} to
search for identifers based on the input annotation column.
}
\section{Inheritance}{
diff --git a/man/rdata_database.Rd b/man/rdata_database.Rd
index fc37fde..a3f2f28 100644
--- a/man/rdata_database.Rd
+++ b/man/rdata_database.Rd
@@ -34,8 +34,8 @@ A \code{rdata_database} object inherits the following \code{struct} classes:
}
\examples{
-M = rdata_database( tag = character(0), data = data.frame(id=NA),
-source = "ANY")
+M = rdata_database( variable_name = "a data frame", tag =
+character(0), data = data.frame(), source = "ANY")
}
\seealso{
diff --git a/man/rds_cache.Rd b/man/rds_cache.Rd
index 81456a5..a8ba851 100644
--- a/man/rds_cache.Rd
+++ b/man/rds_cache.Rd
@@ -38,7 +38,7 @@ A \code{rds_cache} object inherits the following \code{struct} classes: \cr\cr
}
\examples{
-M = rds_cache( tag = character(0), data = data.frame(id=NA), source =
+M = rds_cache( tag = character(0), data = data.frame(), source =
"ANY")
}
diff --git a/man/rds_database.Rd b/man/rds_database.Rd
index cc5797a..de992a9 100644
--- a/man/rds_database.Rd
+++ b/man/rds_database.Rd
@@ -29,8 +29,8 @@ A \code{rds_database} object inherits the following \code{struct} classes:
}
\examples{
-M = rds_database( tag = character(0), data = data.frame(id=NA),
-source = "ANY")
+M = rds_database( tag = character(0), data = data.frame(), source =
+"ANY")
}
\seealso{
diff --git a/man/read_database.Rd b/man/read_database.Rd
index 128a6f5..921ba34 100644
--- a/man/read_database.Rd
+++ b/man/read_database.Rd
@@ -1,13 +1,53 @@
% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/generics.R
+% Please edit documentation in R/generics.R, R/annotation_database_class.R,
+% R/AnnotationDb_database.R, R/BiocFileCache_database_class.R,
+% R/MTox700plus_database_class.R, R/PathBank_metabolite_database_class.R,
+% R/excel_database_class.R, R/github_file_class.R,
+% R/mwb_refmet_database_class.R, R/rdata_database_class.R,
+% R/rds_database_class.R, R/sqlite_database_class.R
\name{read_database}
\alias{read_database}
+\alias{read_database,annotation_database-method}
+\alias{read_database,AnnotationDb_database-method}
+\alias{read_database,BiocFileCache_database-method}
+\alias{read_database,MTox700plus_database-method}
+\alias{read_database,PathBank_metabolite_database-method}
+\alias{read_database,excel_database-method}
+\alias{read_database,github_file-method}
+\alias{read_database,mwb_refmet_database-method}
+\alias{read_database,rdata_database-method}
+\alias{read_database,rds_database-method}
+\alias{read_database,sqlite_database-method}
\title{Read a database}
\usage{
read_database(obj, ...)
+
+\S4method{read_database}{annotation_database}(obj)
+
+\S4method{read_database}{AnnotationDb_database}(obj)
+
+\S4method{read_database}{BiocFileCache_database}(obj)
+
+\S4method{read_database}{MTox700plus_database}(obj)
+
+\S4method{read_database}{PathBank_metabolite_database}(obj)
+
+\S4method{read_database}{excel_database}(obj)
+
+\S4method{read_database}{github_file}(obj)
+
+\S4method{read_database}{mwb_refmet_database}(obj)
+
+\S4method{read_database}{rdata_database}(obj)
+
+\S4method{read_database}{rds_database}(obj)
+
+\S4method{read_database}{sqlite_database}(obj)
}
\arguments{
\item{obj}{An \code{annotation_database} object}
+
+\item{...}{additional database specific inputs}
}
\value{
A data.frame
diff --git a/man/read_source.Rd b/man/read_source.Rd
index dbeede4..9ae0ff6 100644
--- a/man/read_source.Rd
+++ b/man/read_source.Rd
@@ -1,10 +1,23 @@
% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/generics.R
+% Please edit documentation in R/generics.R, R/annotation_source_class.R,
+% R/annotation_database_class.R, R/cd_source_class.R, R/ls_source_class.R
\name{read_source}
\alias{read_source}
+\alias{read_source,annotation_source-method}
+\alias{read_source,annotation_database-method}
+\alias{read_source,cd_source-method}
+\alias{read_source,ls_source-method}
\title{Import annotation source}
\usage{
read_source(obj, ...)
+
+\S4method{read_source}{annotation_source}(obj)
+
+\S4method{read_source}{annotation_database}(obj)
+
+\S4method{read_source}{cd_source}(obj)
+
+\S4method{read_source}{ls_source}(obj)
}
\arguments{
\item{obj}{an \code{\link[=annotation_source]{annotation_source()}} object}
@@ -12,7 +25,7 @@ read_source(obj, ...)
\item{...}{not currently used}
}
\value{
-an \code{\link[=annotation_table]{annotation_table()}}, \code{\link[=annotation_library]{annotation_library()}} or
+an \code{\link[=annotation_table]{annotation_table()}} or
\code{\link[=annotation_database]{annotation_database()}} object
}
\description{
diff --git a/man/required_cols.Rd b/man/required_cols.Rd
index 8a37c82..0cf9b96 100644
--- a/man/required_cols.Rd
+++ b/man/required_cols.Rd
@@ -1,13 +1,18 @@
% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/generics.R
+% Please edit documentation in R/generics.R, R/annotation_source_class.R
\name{required_cols}
\alias{required_cols}
+\alias{required_cols,annotation_source-method}
\title{Required columns in an annotation source}
\usage{
required_cols(obj, ...)
+
+\S4method{required_cols}{annotation_source}(obj)
}
\arguments{
-\item{x}{an \code{annotation_source} object}
+\item{obj}{an \code{annotation_source} object}
+
+\item{...}{additional source specific inputs}
}
\value{
a character vector of slot names
@@ -25,7 +30,7 @@ the object and all of its parent objects.
M <- lcms_table(id_column = "id", mz_column = "mz", rt_column = "rt")
#' # get values for required slots
-r <- required(M)
+r <- required_cols(M)
# get slot names for required columns
names(r)
diff --git a/man/rt_match.Rd b/man/rt_match.Rd
index 1156e1f..5c5ef09 100644
--- a/man/rt_match.Rd
+++ b/man/rt_match.Rd
@@ -44,7 +44,7 @@ A \code{rt_match} object inherits the following \code{struct} classes: \cr\cr
}
\examples{
-M = rt_match( variable_meta = data.frame(id=NA), rt_column =
-character(0), rt_window = numeric(0), id_column = character(0))
+M = rt_match( variable_meta = data.frame(), rt_column = character(0),
+rt_window = 20, id_column = character(0))
}
diff --git a/man/sqlite_database.Rd b/man/sqlite_database.Rd
index 5321be9..992b3b4 100644
--- a/man/sqlite_database.Rd
+++ b/man/sqlite_database.Rd
@@ -36,12 +36,12 @@ A \code{sqlite_database} object inherits the following \code{struct} classes:
\examples{
M = sqlite_database( table = character(0), tag = character(0), data =
-data.frame(id=NA), source = "ANY")
+data.frame(), source = "ANY")
}
\references{
Müller K, Wickham H, James DA, Falcon S (2024). \emph{RSQLite:
-SQLite Interface for R}. R package version 2.3.6,
+SQLite Interface for R}. R package version 2.3.7,
\url{https://CRAN.R-project.org/package=RSQLite}.
}
\seealso{
diff --git a/man/vertical_join.Rd b/man/vertical_join.Rd
index 29b88ab..4f1909f 100644
--- a/man/vertical_join.Rd
+++ b/man/vertical_join.Rd
@@ -1,15 +1,55 @@
% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/generics.R
+% Please edit documentation in R/generics.R, R/annotation_source_class.R
\name{vertical_join}
\alias{vertical_join}
+\alias{vertical_join,annotation_source,annotation_source-method}
+\alias{vertical_join,list,missing-method}
\title{Join sources vertically}
\usage{
vertical_join(x, y, ...)
+
+\S4method{vertical_join}{annotation_source,annotation_source}(
+ x,
+ y,
+ matching_columns = NULL,
+ keep_cols = NULL,
+ source_col = "annotation_source",
+ exclude_cols = NULL,
+ as = annotation_source()
+)
+
+\S4method{vertical_join}{list,missing}(
+ x,
+ y,
+ matching_columns = NULL,
+ keep_cols = NULL,
+ source_col = "annotation_source",
+ exclude_cols = NULL,
+ as = annotation_source()
+)
}
\arguments{
\item{x}{an \code{annotation_source} object}
\item{y}{an second \code{annotation_source} object to join with the first}
+
+\item{...}{additional inputs (not currently used)}
+
+\item{matching_columns}{(list) a named list of column names that all contain
+the same information. All columns named in the same list element will be
+merged into a single column with the same name as the list element.}
+
+\item{keep_cols}{(character) a list of column names to keep in the final
+joined table. All other columns will be dropped.}
+
+\item{source_col}{(character) the name of a new column that will contain the
+tags of the original source object for each row in the joined table.}
+
+\item{exclude_cols}{(character) the names of columns to exclude from the
+joined table.}
+
+\item{as}{(character) the type of object the joined table should be returned
+as e.g. "lcms_table".}
}
\value{
an \code{annotation_source} object
@@ -21,8 +61,8 @@ create a single new data.frame with data and records from multiple sources.
}
\examples{
-M <- annotation_source()
-N <- annotation_source()
-O <- vertical_join(M, N)
+M <- annotation_source(data=data.frame(id=1,value='A'))
+N <- annotation_source(data=data.frame(id=2,value='B'))
+O <- vertical_join(M, N, keep_cols='.all')
}
diff --git a/man/write_database.Rd b/man/write_database.Rd
index 3831c8d..94f22c2 100644
--- a/man/write_database.Rd
+++ b/man/write_database.Rd
@@ -1,13 +1,27 @@
% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/generics.R
+% Please edit documentation in R/generics.R, R/annotation_database_class.R,
+% R/rds_database_class.R, R/sqlite_database_class.R
\name{write_database}
\alias{write_database}
+\alias{write_database,annotation_database-method}
+\alias{write_database,rds_database-method}
+\alias{write_database,sqlite_database-method}
\title{Write to a database}
\usage{
write_database(obj, ...)
+
+\S4method{write_database}{annotation_database}(obj, df)
+
+\S4method{write_database}{rds_database}(obj, df)
+
+\S4method{write_database}{sqlite_database}(obj, df)
}
\arguments{
\item{obj}{A \code{annotation_database} object}
+
+\item{...}{additional database specific inputs}
+
+\item{df}{(data.frame) the data.frame to store in the database.}
}
\value{
Silently returns TRUE if successful, FALSE otherwise
diff --git a/vignettes/daphnia_example.Rmd b/vignettes/daphnia_example.Rmd
deleted file mode 100644
index 4c8191a..0000000
--- a/vignettes/daphnia_example.Rmd
+++ /dev/null
@@ -1,643 +0,0 @@
----
-title: "Processing Annotations for LCMS of Daphnia samples"
-output:
- BiocStyle::html_document:
- toc: yes
- toc_depth: 2
- number_sections: yes
- toc_float: yes
-vignette: >
- %\VignetteIndexEntry{Processing Annotations for LCMS of Daphnia samples}
- %\VignetteEngine{knitr::rmarkdown}
- %\VignetteEncoding{UTF-8}
----
-
-```{r, include = FALSE}
-knitr::opts_chunk$set(
- collapse = TRUE,
- comment = "#>",
- fig.align = "center"
-)
-library(BiocStyle)
-```
-
-# Getting Started
-The latest versions of `r Biocpkg("struct")` and `MetMashR` that are compatible
-with your
-current R version can be installed using BiocManager.
-
-```{r,eval = FALSE, include = TRUE}
-# install BiocManager if not present
-if (!requireNamespace("BiocManager", quietly = TRUE)) {
- install.packages("BiocManager")
-}
-
-# install MetMashR and dependencies
-BiocManager::install("MetMashR")
-```
-
-Once installed you can activate the packages in the usual way:
-
-```{r, eval=TRUE, include=FALSE}
-suppressWarnings({
- suppressPackageStartupMessages({
- # load the packages
- library(struct)
- library(MetMashR)
- library(metabolomicsWorkbenchR)
- library(ggplot2)
- library(patchwork)
- library(tidyr)
- })
-})
-```
-
-```{r, eval=FALSE, include=TRUE}
-# load the packages
-library(struct)
-library(MetMashR)
-library(metabolomicsWorkbenchR)
-library(ggplot2)
-library(patchwork)
-```
-
-
-
-# Import Daphina data
-This study consists of LCMS peak tables of HILIC_POS and LIPIDS_POS assays collected from samples of *Daphnia magna*. In this section we import the tables of data for the MS1 peaks recorded for each sample. We will use this data in a workflows to align the MS2 annotations with the MS1 peaks. In practice there might be accompanying statistics e.g. t-test p-values indicating the importance of a features for a study. For brevity in this vignette we only import peak quality information, in the form of Relative Standard Deviations (RSD).
-
-Here, we import the MS1 level feature meta data for each assay and store it as a data.frame that we use later on in the workflow.
-```{r}
-# import HILIC_POS
-HP <- openxlsx::read.xlsx(
- system.file("extdata/daphnia/daphnia_example.xlsx",
- package = "MetMashR"
- ),
- sheet = "HILIC_POS",
- rowNames = FALSE,
- colNames = TRUE
-)
-# rename columns
-colnames(HP)[1] <- "id"
-# append assay to feature id
-HP$id <- paste0("HILIC_POS_", HP$id)
-# convert some columns to numeric
-HP$rsd_qc <- as.numeric(HP$rsd_qc)
-HP$rsd_sample <- as.numeric(HP$rsd_sample)
-
-# import LIPIDS_POS
-LP <- openxlsx::read.xlsx(
- system.file("extdata/daphnia/daphnia_example.xlsx",
- package = "MetMashR"
- ),
- sheet = "LIPIDS_POS",
- rowNames = FALSE,
- colNames = TRUE
-)
-# rename columns
-colnames(LP)[1] <- "id"
-# append assay to feature id
-LP$id <- paste0("LIPIDS_POS_", LP$id)
-# convert some columns to numeric
-LP$rsd_qc <- as.numeric(LP$rsd_qc)
-LP$rsd_sample <- as.numeric(LP$rsd_sample)
-```
-
-
-
-# Import and clean Compound Discoverer annotations
-Here we implement a workflow to process the Compound Discoverer outputs for
-each assay. Labels are added to aid with filtering in later steps. For duplicate
-annotations we select the annotation with the highest mzCloud match score. We
-retain annotations with a Full Match and disregard the rest. Finally we match the
-MS2 peaks to the MS1 peaks.
-
-```{r}
-cd_workflow <-
- # import source
- import_source() +
-
- # add useful labels
- add_labels(
- labels = list(
- source_name = "CD",
- assay = "placeholder"
- )
- ) + # placeholder replaced later
-
- # filter low quality
- filter_labels(
- column_name = "compound_match",
- labels = "Full match",
- mode = "include"
- ) +
-
- # resolve duplicates
- combine_records(
- group_by = c("compound", "ion"),
- default_fcn = .select_max(
- max_col = "mzcloud_score",
- keep_NA = FALSE,
- use_abs = TRUE
- )
- ) +
-
- # match MS1 to MS2
- mzrt_match(
- variable_meta = HP,
- mz_column = "mz",
- rt_column = "rt",
- ppm_window = 5,
- rt_window = 20,
- id_column = "id"
- ) +
-
- # ppm difference MS1 vs library
- calc_ppm_diff(
- obs_mz_column = "mz_match",
- ref_mz_column = "theoretical_mz",
- out_column = "ms1_lib_ppm_diff"
- )
-```
-
-We need to apply this workflow to each assay. For convenience we store the sources
-for each assay in a list.
-
-```{r}
-# prepare sources
-cd_sources <- list(
- HILIC_POS = cd_source(
- source = c(
- system.file(
- "extdata/daphnia/HILIC_POS_EL_CD.xlsx",
- package = "MetMashR"
- ),
- system.file(
- "extdata/daphnia/HILIC_POS_EL_CD_comp.xlsx",
- package = "MetMashR"
- )
- ),
- sheets = c("Compounds", "Compounds")
- ),
- LIPIDS_POS = cd_source(
- source = c(
- system.file(
- "extdata/daphnia/LIPIDS_POS_EL_CD.xlsx",
- package = "MetMashR"
- ),
- system.file(
- "extdata/daphnia/LIPIDS_POS_EL_CD_comp.xlsx",
- package = "MetMashR"
- )
- ),
- sheets = c("Compounds", "Compounds")
- )
-)
-```
-
-Now we are ready to apply the workflow to the sources. Note that because the
-labels we are adding are specific to the assay we need to update this input
-parameter of the workflow before apply it to the source. Again we store the
-applied workflow in a list for convenience.
-
-```{r}
-# place to store results
-CD <- list()
-
-# set labels
-cd_workflow[2]$labels$assay <- "HILIC_POS"
-# apply workflow
-CD$HILIC_POS <- model_apply(cd_workflow, cd_sources$HILIC_POS)
-
-# set labels
-cd_workflow[2]$labels$assay <- "LIPIDS_POS"
-# apply workflow
-CD$LIPIDS_POS <- model_apply(cd_workflow, cd_sources$LIPIDS_POS)
-```
-
-
-
-### CD Quality Assurance
-In the CD workflow we computed ppm and retention time differences
-between the
-mzCloud library used by Compound Discoverer and the MS2 experimental data.
-
-If the peak of the distribution is off centre this can be indicative of e.g. retention
-time or m/z drift.
-
-If there are a lot of annotations with a large difference vs the library then
-these can be excluded by adding e.g. a `filter_range` workflow step.
-
-```{r}
-# MS2 vs library
-C <- annotation_histogram(
- factor_name = "library_ppm_diff",
- vline = c(-5, 5)
-)
-g1 <- chart_plot(C, predicted(CD$HILIC_POS)) + ggtitle("MS2 vs library")
-
-# MS1 vs library
-C <- annotation_histogram(
- factor_name = "ms1_lib_ppm_diff",
- vline = c(-5, 5)
-)
-g2 <- chart_plot(C, predicted(CD$HILIC_POS)) + ggtitle("MS1 vs library")
-
-# layout
-cowplot::plot_grid(g1, g2, nrow = 1)
-```
-
-The ppm and retention time differences between the MS1 and MS2 features (peaks)
-can also be indicative of analytical problems.
-
-```{r,fig.width=6,fig.height=5.5}
-# prepare chart
-C <- annotation_histogram2d(
- factor_name = c("ppm_match_diff_an", "rt_match_diff"),
- bins = 30
-)
-chart_plot(C, predicted(CD$HILIC_POS))
-```
-
-The LIPID_POS assay (not shown) only has 2 matches, so the chart is not informative for
-that assay.
-
-
-
-## Import and clean LipidSearch annotations
-Similarly to the CD sources, here we implement a workflow to process the
-LipidSearch outputs for
-each assay. Labels are added to aid with filtering in later steps. For duplicate
-annotations we select the annotation with the lowest ppm difference vs the library. We
-retain only LS annotations with Grades A and B.
-
-```{r}
-# prepare workflow
-ls_workflow <-
- # import raw file
- import_source() +
-
- # add labels
- add_labels(
- labels = c(
- assay = "placeholder", # will be replaced later
- source_name = "LS"
- )
- ) +
-
- # filter by grade
- filter_labels(
- column_name = "Grade",
- labels = c("A", "B"),
- mode = "include"
- ) +
-
- # resolve duplicates
- combine_records(
- group_by = c("LipidIon"),
- default_fcn = .select_min(
- min_col = "library_ppm_diff",
- keep_NA = FALSE,
- use_abs = TRUE
- )
- ) +
-
- # match MS1 to MS2
- mzrt_match(
- variable_meta = HP,
- mz_column = "mz",
- rt_column = "rt",
- ppm_window = 5,
- rt_window = 20,
- id_column = "id"
- ) +
-
- # ppm difference MS1 vs library
- calc_ppm_diff(
- obs_mz_column = "mz_match",
- ref_mz_column = "theor_mass",
- out_column = "ms1_lib_ppm_diff"
- )
-```
-
-Next we prepare the LipidSearch source objects:
-
-```{r}
-# prepare sources
-ls_sources <- list(
- HILIC_POS = ls_source(
- source =
- system.file(
- "extdata/daphnia/HILIC_POS_EL_LS.txt",
- package = "MetMashR"
- )
- ),
- LIPIDS_POS = ls_source(
- source =
- system.file(
- "extdata/daphnia/LIPIDS_POS_EL_LS.txt",
- package = "MetMashR"
- )
- )
-)
-```
-
-Now we can apply the LipidSearch workflow to the LipidSearch sources:
-
-```{r}
-# place to store results
-LS <- list()
-
-# set labels
-ls_workflow[2]$labels$assay <- "HILIC_POS"
-# apply workflow
-LS$HILIC_POS <- model_apply(ls_workflow, ls_sources$HILIC_POS)
-
-# set labels
-ls_workflow[2]$labels$assay <- "LIPIDS_POS"
-# apply workflow
-LS$LIPIDS_POS <- model_apply(ls_workflow, ls_sources$LIPIDS_POS)
-```
-
-
-
-### LS Quality Assurance
-We can assess drift in m/z and/or retention time using histograms of ppm and
-differences vs the library like we did
-before.
-
-```{r}
-# MS2 vs library
-C <- annotation_histogram(
- factor_name = "library_ppm_diff",
- vline = c(-5, 5)
-)
-g1 <- chart_plot(C, predicted(LS$HILIC_POS)) + ggtitle("MS2 vs library")
-
-# MS1 vs library
-C <- annotation_histogram(
- factor_name = "ms1_lib_ppm_diff",
- vline = c(-5, 5)
-)
-g2 <- chart_plot(C, predicted(LS$HILIC_POS)) + ggtitle("MS1 vs library")
-
-# layout
-cowplot::plot_grid(g1, g2, nrow = 1)
-```
-
-We can also check for analytical issue by comparing the MS1 and MS2 ppm and
-retention time differences.
-
-```{r,fig.width=6,fig.height=5.5}
-# prepare chart
-C <- annotation_histogram2d(
- factor_name = c("ppm_match_diff_an", "rt_match_diff"),
- bins = 30
-)
-chart_plot(C, predicted(LS$HILIC_POS))
-```
-
-
-
-# Mashing all sources / assays
-
-Now that we have imported and cleaned the individual sources we can combine
-them into a single annotation_table. This table can the be further cleaned and
-augmented with additional information as required.
-
-Here, we use the `normalise_strings` object to clean and tidy metabolite names to
-improve matches when searching for inchikey's using PubChem and LipidMaps APIs.
-
-We then use the inchikey's to obtain pathway information from the PathBank metabolite database.
-
-Imported statistics for the MS1 peaks are joined with the annotation table and used to quality filter the MS1 peaks based on an assessment of quality (RSD of the QC samples < 30).
-
-Finally, we collapse the table such that each MS1 peak has a list of
-possible annotations.
-
-For the vignette we used cached results, which we prepare now.
-
-```{r}
-cache1 <- rds_database(
- source = file.path(
- system.file("cached", package = "MetMashR"), "cache1.rds"
- )
-)
-cache2 <- rds_database(
- source = file.path(
- system.file("cached", package = "MetMashR"), "cache2.rds"
- )
-)
-cache3 <- rds_database(
- source = file.path(
- system.file("cached", package = "MetMashR"), "cache3.rds"
- )
-)
-cache4 <- rds_database(
- source = file.path(
- system.file("cached", package = "MetMashR"), "cache4.rds"
- )
-)
-```
-
-Next we prepare the workflow and then apply it.
-
-```{r}
-WF <-
- combine_sources(
- list(
- predicted(CD$LIPIDS_POS),
- predicted(LS$HILIC_POS),
- predicted(LS$LIPIDS_POS)
- ),
- source_col = "annotation_source",
- keep_cols = ".all",
- matching_columns = c(
- Compound = "compound",
- Compound = "LipidName",
- Ion = "ion",
- Ion = "LipidIon",
- theoretical_mz = "theor_mass",
- LipidClass = "Class"
- )
- ) +
- normalise_strings(
- search_column = "Compound",
- output_column = "normalised_compound",
- dictionary = c(
- # custom dictionary
- list(
- # replace "NP" with "Compound NP"
- list(
- pattern = "^NP-",
- replace = "Compound NP-"
- ),
- # remove terms in trailing brackets e.g." (ATP)"
- list(
- pattern = "\\ \\([^\\)]*\\)$",
- replace = ""
- ),
- # replace known abbreviations
- list(
- pattern = "3-Fluoro NNEI",
- replace = "3-Fluoro-nnei",
- fixed = TRUE
- ),
- list(
- pattern = "Υ-L-Glutamyl-L-glutamic acid",
- replace = "Tyr-Glu-Glu"
- ),
- list(
- pattern = "AcCa",
- replace = "CAR"
- )
- ),
- # update tripeptides
- .tripeptide_dictionary,
- # remove racemic information
- .racemic_dictionary,
- # replace greek characters
- .greek_dictionary
- )
- ) +
- pubchem_property_lookup(
- query_column = "normalised_compound",
- search_by = "name",
- property = "InChIKey",
- suffix = "_pubchem",
- cache = cache1
- ) +
- lipidmaps_lookup(
- query_column = "normalised_compound",
- context = "compound",
- context_item = "abbrev",
- output_item = "inchi_key",
- suffix = "_abbrev",
- cache = cache2
- ) +
- lipidmaps_lookup(
- query_column = "normalised_compound",
- context = "compound",
- context_item = "abbrev_chains",
- output_item = "inchi_key",
- suffix = "_abbrevchains",
- cache = cache3
- ) +
- prioritise_columns(
- column_names = c("InChIKey_pubchem", "inchi_key_abbrev",
- "inchi_key_abbrevchains"),
- output_name = "inchikey",
- source_name = "inchikey_src",
- source_tags = c("pubchem", "lm_abbrev", "lm_chains"),
- clean = TRUE
- ) +
- classyfire_lookup(
- query_column = "inchikey",
- output_items = ".all",
- output_fields = ".all", suffix = "_cf",
- cache = cache4,
- delay = 5
- ) +
- database_lookup(
- query_column = "inchikey",
- database_column = "InChI.Key",
- database = PathBank_metabolite_database(),
- include = c("Pathway.Name", "Pathway.Subject", "Species"),
- suffix = "",
- not_found = NA
- ) +
- add_columns(
- new_columns = rbind(HP, LP),
- by = c("mzrt_match_id" = "id")
- ) +
- filter_na(
- column_name = "inchikey"
- ) +
- combine_records(
- group_by = "mzrt_match_id",
- default_fcn = .unique(
- separator = " || "
- )
- ) +
- filter_labels(
- column_name = "rsd_qc",
- labels = "NA",
- mode = "exclude"
- ) +
- filter_range(
- column_name = "rsd_qc",
- upper_limit = 20,
- lower_limit = -Inf,
- equal_to = FALSE
- )
-WF <- model_apply(WF, predicted(CD$HILIC_POS))
-```
-
-We can explore the contents of the table. Here we generate plots to visualise
-the number of annotations from each source.
-
-```{r,warning=FALSE,message=FALSE,fig.width=4}
-# pie chart of the sources of annotations
-C <- annotation_pie_chart(
- factor_name = "source_name",
- label_location = "outside"
-)
-chart_plot(C, predicted(WF)) + ggtitle("Annotations per source")
-```
-
-Next we plot a histogram of the QC-RSD values before filtering,
-by indexing the relevant step of the workflow.
-
-```{r}
-# histogram of the rsd-qc for annotated features (before filtering)
-C <- annotation_histogram(
- factor_name = "rsd_qc",
- bins = 30,
- vline = 20
-)
-chart_plot(C, predicted(WF[12])) +
- ggtitle("MS1 peak QC-RSD",
- "Features with QC-RSD<20 were removed by the workflow.")
-```
-
-In this plot we present a bar chart of the different molecular classes present in
-the final table.
-
-```{r}
-# bar chart of the superclasses
-C <- annotation_bar_chart(
- factor_name = "superclass.name_cf",
- legend = TRUE, label_type = "none"
-)
-chart_plot(C, predicted(WF[10])) + ggtitle("Superclasses")
-```
-
-Finally we use the PubChem API to generate an image of the molecular structure
-for one of the metabolites.
-
-```{r}
-# display one of the metabolite structures
-C <- pubchem_widget(
- query_column = "normalised_compound",
- row_index = 1,
- record_type = "3D-Conformer",
- display = FALSE,
- hide_title = FALSE,
- height = "820px"
-)
-
-chart_plot(C, predicted(WF))
-```
-
-
-
-
-
-# Session Info
-```{r}
-sessionInfo()
-```
-
-
-
-