mirror of
				https://github.com/msberends/AMR.git
				synced 2025-10-31 02:08:20 +01:00 
			
		
		
		
	guess_ab()
This commit is contained in:
		
							
								
								
									
										70
									
								
								DESCRIPTION
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										70
									
								
								DESCRIPTION
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							| @@ -0,0 +1,70 @@ | ||||
| Package: AMR | ||||
| Version: 0.5.0.9009 | ||||
| Date: 2019-01-06 | ||||
| Title: Antimicrobial Resistance Analysis | ||||
| Authors@R: c( | ||||
|     person( | ||||
|         given = c("Matthijs", "S."), | ||||
|         family = "Berends", | ||||
|         email = "m.s.berends@umcg.nl", | ||||
|         role = c("aut", "cre"), | ||||
|         comment = c(ORCID = "0000-0001-7620-1800")), | ||||
|     person( | ||||
|         given = c("Christian", "F."), | ||||
|         family = "Luz", | ||||
|         email = "c.f.luz@umcg.nl", | ||||
|         role = c("aut", "rev"), | ||||
|         comment = c(ORCID = "0000-0001-5809-5995")), | ||||
|     person( | ||||
|         given = c("Erwin", "E.", "A."), | ||||
|         family = "Hassing", | ||||
|         email = "e.hassing@certe.nl", | ||||
|         role = "ctb"), | ||||
|     person( | ||||
|         given = "Corinna", | ||||
|         family = "Glasner", | ||||
|         email = "c.glasner@umcg.nl", | ||||
|         role = c("aut", "ths"), | ||||
|         comment = c(ORCID = "0000-0003-1241-1328")), | ||||
|     person( | ||||
|         given = c("Alex", "W."), | ||||
|         family = "Friedrich", | ||||
|         email = "alex.friedrich@umcg.nl", | ||||
|         role = c("aut", "ths"), | ||||
|         comment = c(ORCID = "0000-0003-4881-038X")), | ||||
|     person( | ||||
|         given = c("Bhanu", "N.", "M."), | ||||
|         family = "Sinha", | ||||
|         email = "b.sinha@umcg.nl", | ||||
|         role = c("aut", "ths"), | ||||
|         comment = c(ORCID = "0000-0003-1634-0010"))) | ||||
| Description: Functions to simplify the analysis and prediction of Antimicrobial  | ||||
|     Resistance (AMR) and to work with microbial and antimicrobial properties by | ||||
|     using evidence-based methods. | ||||
| Depends: | ||||
|     R (>= 3.1.0) | ||||
| Imports: | ||||
|     backports, | ||||
|     curl, | ||||
|     crayon (>= 1.3.0), | ||||
|     data.table (>= 1.9.0), | ||||
|     dplyr (>= 0.7.0), | ||||
|     hms, | ||||
|     knitr (>= 1.0.0), | ||||
|     rlang (>= 0.2.0), | ||||
|     rvest (>= 0.3.2), | ||||
|     tidyr (>= 0.7.0), | ||||
|     xml2 (>= 1.0.0) | ||||
| Suggests: | ||||
|     covr (>= 3.0.1), | ||||
|     ggplot2, | ||||
|     rmarkdown, | ||||
|     rstudioapi, | ||||
|     testthat (>= 1.0.2) | ||||
| VignetteBuilder: knitr | ||||
| URL: https://msberends.gitlab.io/AMR, https://gitlab.com/msberends/AMR | ||||
| BugReports: https://gitlab.com/msberends/AMR/issues | ||||
| License: GPL-2 | file LICENSE | ||||
| Encoding: UTF-8 | ||||
| LazyData: true | ||||
| RoxygenNote: 6.1.1 | ||||
|   | ||||
| @@ -48,7 +48,7 @@ ratio <- function(x, ratio) { | ||||
| } | ||||
|  | ||||
| #' @rdname AMR-deprecated | ||||
| #' @exported | ||||
| #' @export | ||||
| guess_mo <- function(...) { | ||||
|   .Deprecated(new = "as.mo", package = "AMR") | ||||
|   as.mo(...) | ||||
|   | ||||
| @@ -75,8 +75,8 @@ reference: | ||||
|   desc: > | ||||
|     Some pages about our package and its external sources. | ||||
|   contents: | ||||
|   - 'AMR' | ||||
|   - itis | ||||
|   - '`AMR`' | ||||
|   - '`itis`' | ||||
| - title: Cleaning your data | ||||
|   desc: > | ||||
|     Functions for cleaning and optimising your data, to be able | ||||
|   | ||||
| @@ -240,6 +240,7 @@ | ||||
| <h4 class="hasAnchor"> | ||||
| <a href="#changed" class="anchor"></a>Changed</h4> | ||||
| <ul> | ||||
| <li>Function <code><a href="../reference/AMR-deprecated.html">guess_mo()</a></code> is now deprecated in favour of <code><a href="../reference/as.mo.html">as.mo()</a></code> and will be remover in future versions</li> | ||||
| <li>Fixed a critical bug in <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> where some rules that depend on previous applied rules would not be applied adequately</li> | ||||
| <li>Improvements for <code><a href="../reference/as.mo.html">as.mo()</a></code>:</li> | ||||
| <li>Finds better results when input is in other languages</li> | ||||
|   | ||||
| @@ -220,7 +220,9 @@ | ||||
|      | ||||
|     </div> | ||||
|  | ||||
|     <pre class="usage"><span class='fu'>ratio</span>(<span class='no'>x</span>, <span class='no'>ratio</span>)</pre> | ||||
|     <pre class="usage"><span class='fu'>ratio</span>(<span class='no'>x</span>, <span class='no'>ratio</span>) | ||||
|  | ||||
| <span class='fu'>guess_mo</span>(<span class='no'>...</span>)</pre> | ||||
|          | ||||
|     <h2 class="hasAnchor" id="read-more-on-our-website-"><a class="anchor" href="#read-more-on-our-website-"></a>Read more on our website!</h2> | ||||
|  | ||||
|   | ||||
| @@ -223,10 +223,7 @@ | ||||
|     <pre class="usage"><span class='fu'>as.mo</span>(<span class='no'>x</span>, <span class='kw'>Becker</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>, <span class='kw'>Lancefield</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>, <span class='kw'>allow_uncertain</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, | ||||
|   <span class='kw'>reference_df</span> <span class='kw'>=</span> <span class='kw'>NULL</span>) | ||||
|  | ||||
| <span class='fu'>is.mo</span>(<span class='no'>x</span>) | ||||
|  | ||||
| <span class='fu'>guess_mo</span>(<span class='no'>x</span>, <span class='kw'>Becker</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>, <span class='kw'>Lancefield</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>, | ||||
|   <span class='kw'>allow_uncertain</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>reference_df</span> <span class='kw'>=</span> <span class='kw'>NULL</span>)</pre> | ||||
| <span class='fu'>is.mo</span>(<span class='no'>x</span>)</pre> | ||||
|      | ||||
|     <h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2> | ||||
|     <table class="ref-arguments"> | ||||
| @@ -292,7 +289,6 @@ | ||||
| <li><p><code>"S. aureus - please mind: MRSA"</code>. The last word will be stripped, after which the function will try to find a match. If it does not, the second last word will be stripped, etc. Again, a warning will be thrown that the result <em>Staphylococcus aureus</em> (<code>B_STPHY_AUR</code>) needs review.</p></li> | ||||
| <li><p><code>"D. spartina"</code>. This is the abbreviation of an old taxonomic name: <em>Didymosphaeria spartinae</em> (the last "e" was missing from the input). This fungus was renamed to <em>Leptosphaeria obiones</em>, so a warning will be thrown that this result (<code>F_LPTSP_OBI</code>) needs review.</p></li> | ||||
| </ul> | ||||
|     <p><code>guess_mo</code> is an alias of <code>as.mo</code>.</p> | ||||
|      | ||||
|     <h2 class="hasAnchor" id="source"><a class="anchor" href="#source"></a>Source</h2> | ||||
|  | ||||
| @@ -341,12 +337,11 @@ The <code><a href='mo_property.html'>mo_property</a></code> functions (like <cod | ||||
| <span class='fu'>as.mo</span>(<span class='st'>"GAS"</span>) <span class='co'># Group A Streptococci</span> | ||||
| <span class='fu'>as.mo</span>(<span class='st'>"GBS"</span>) <span class='co'># Group B Streptococci</span> | ||||
|  | ||||
| <span class='co'># guess_mo is an alias of as.mo and works the same</span> | ||||
| <span class='fu'>guess_mo</span>(<span class='st'>"S. epidermidis"</span>)                 <span class='co'># will remain species: B_STPHY_EPI</span> | ||||
| <span class='fu'>guess_mo</span>(<span class='st'>"S. epidermidis"</span>, <span class='kw'>Becker</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)  <span class='co'># will not remain species: B_STPHY_CNS</span> | ||||
| <span class='fu'>as.mo</span>(<span class='st'>"S. epidermidis"</span>)                 <span class='co'># will remain species: B_STPHY_EPI</span> | ||||
| <span class='fu'>as.mo</span>(<span class='st'>"S. epidermidis"</span>, <span class='kw'>Becker</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)  <span class='co'># will not remain species: B_STPHY_CNS</span> | ||||
|  | ||||
| <span class='fu'>guess_mo</span>(<span class='st'>"S. pyogenes"</span>)                    <span class='co'># will remain species: B_STRPTC_PYO</span> | ||||
| <span class='fu'>guess_mo</span>(<span class='st'>"S. pyogenes"</span>, <span class='kw'>Lancefield</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>) <span class='co'># will not remain species: B_STRPTC_GRA</span> | ||||
| <span class='fu'>as.mo</span>(<span class='st'>"S. pyogenes"</span>)                    <span class='co'># will remain species: B_STRPTC_PYO</span> | ||||
| <span class='fu'>as.mo</span>(<span class='st'>"S. pyogenes"</span>, <span class='kw'>Lancefield</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>) <span class='co'># will not remain species: B_STRPTC_GRA</span> | ||||
|  | ||||
| <span class='co'># Use mo_* functions to get a specific property based on `mo`</span> | ||||
| <span class='no'>Ecoli</span> <span class='kw'><-</span> <span class='fu'>as.mo</span>(<span class='st'>"E. coli"</span>)     <span class='co'># returns `B_ESCHR_COL`</span> | ||||
| @@ -362,16 +357,16 @@ The <code><a href='mo_property.html'>mo_property</a></code> functions (like <cod | ||||
| <span class='co'># the select function of tidyverse is also supported:</span> | ||||
| <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>) | ||||
| <span class='no'>df</span>$<span class='no'>mo</span> <span class='kw'><-</span> <span class='no'>df</span> <span class='kw'>%>%</span> | ||||
|   <span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>microorganism_name</span>) <span class='kw'>%>%</span> | ||||
|   <span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>microorganism_name</span>) <span class='kw'>%>%</span> | ||||
|   <span class='fu'>as.mo</span>() | ||||
|  | ||||
| <span class='co'># and can even contain 2 columns, which is convenient for genus/species combinations:</span> | ||||
| <span class='no'>df</span>$<span class='no'>mo</span> <span class='kw'><-</span> <span class='no'>df</span> <span class='kw'>%>%</span> | ||||
|   <span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>genus</span>, <span class='no'>species</span>) <span class='kw'>%>%</span> | ||||
|   <span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>genus</span>, <span class='no'>species</span>) <span class='kw'>%>%</span> | ||||
|   <span class='fu'>as.mo</span>() | ||||
| <span class='co'># although this works easier and does the same:</span> | ||||
| <span class='no'>df</span> <span class='kw'><-</span> <span class='no'>df</span> <span class='kw'>%>%</span> | ||||
|   <span class='fu'><a href='http://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>mo</span> <span class='kw'>=</span> <span class='fu'>as.mo</span>(<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/paste'>paste</a></span>(<span class='no'>genus</span>, <span class='no'>species</span>))) | ||||
|   <span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>mo</span> <span class='kw'>=</span> <span class='fu'>as.mo</span>(<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/paste'>paste</a></span>(<span class='no'>genus</span>, <span class='no'>species</span>))) | ||||
| <span class='co'># }</span></pre> | ||||
|   </div> | ||||
|   <div class="col-md-3 hidden-xs hidden-sm" id="sidebar"> | ||||
|   | ||||
| @@ -219,6 +219,26 @@ | ||||
|     </colgroup> | ||||
|  | ||||
|     <tbody> | ||||
|       <tr> | ||||
|         <th colspan="2"> | ||||
|           <h2 id="section-backround-information" class="hasAnchor"><a href="#section-backround-information" class="anchor"></a>Backround information</h2> | ||||
|           <p class="section-desc"><p>Some pages about our package and its external sources.</p></p> | ||||
|         </th> | ||||
|       </tr> | ||||
|       <tr> | ||||
|          | ||||
|         <td> | ||||
|           <p><code><a href="AMR.html">AMR</a></code> </p> | ||||
|         </td> | ||||
|         <td><p>The <code>AMR</code> Package</p></td> | ||||
|       </tr><tr> | ||||
|          | ||||
|         <td> | ||||
|           <p><code><a href="itis.html">itis</a></code> </p> | ||||
|         </td> | ||||
|         <td><p>ITIS: Integrated Taxonomic Information System</p></td> | ||||
|       </tr> | ||||
|     </tbody><tbody> | ||||
|       <tr> | ||||
|         <th colspan="2"> | ||||
|           <h2 id="section-cleaning-your-data" class="hasAnchor"><a href="#section-cleaning-your-data" class="anchor"></a>Cleaning your data</h2> | ||||
| @@ -240,7 +260,7 @@ | ||||
|       </tr><tr> | ||||
|          | ||||
|         <td> | ||||
|           <p><code><a href="as.mo.html">as.mo()</a></code> <code><a href="as.mo.html">is.mo()</a></code> <code><a href="as.mo.html">guess_mo()</a></code> </p> | ||||
|           <p><code><a href="as.mo.html">as.mo()</a></code> <code><a href="as.mo.html">is.mo()</a></code> </p> | ||||
|         </td> | ||||
|         <td><p>Transform to microorganism ID</p></td> | ||||
|       </tr><tr> | ||||
| @@ -257,6 +277,12 @@ | ||||
|         <td><p>EUCAST rules</p></td> | ||||
|       </tr><tr> | ||||
|          | ||||
|         <td> | ||||
|           <p><code><a href="guess_ab.html">guess_ab()</a></code> </p> | ||||
|         </td> | ||||
|         <td><p>Guess antibiotic column</p></td> | ||||
|       </tr><tr> | ||||
|          | ||||
|         <td> | ||||
|           <p><code><a href="read.4D.html">read.4D()</a></code> </p> | ||||
|         </td> | ||||
| @@ -487,6 +513,7 @@ | ||||
|   <div class="col-md-3 hidden-xs hidden-sm" id="sidebar"> | ||||
|     <h2>Contents</h2> | ||||
|     <ul class="nav nav-pills nav-stacked"> | ||||
|       <li><a href="#section-backround-information">Backround information</a></li> | ||||
|       <li><a href="#section-cleaning-your-data">Cleaning your data</a></li> | ||||
|       <li><a href="#section-adding-variables-to-your-data">Adding variables to your data</a></li> | ||||
|       <li><a href="#section-analysing-your-data">Analysing your data</a></li> | ||||
|   | ||||
| @@ -324,8 +324,8 @@ On our website <a href='https://msberends.gitlab.io/AMR'>https://msberends.gitla | ||||
| <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>) | ||||
| <span class='co'># set key antibiotics to a new variable</span> | ||||
| <span class='no'>my_patients</span> <span class='kw'><-</span> <span class='no'>septic_patients</span> <span class='kw'>%>%</span> | ||||
|   <span class='fu'><a href='http://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>keyab</span> <span class='kw'>=</span> <span class='fu'>key_antibiotics</span>(<span class='no'>.</span>)) <span class='kw'>%>%</span> | ||||
|   <span class='fu'><a href='http://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>( | ||||
|   <span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>keyab</span> <span class='kw'>=</span> <span class='fu'>key_antibiotics</span>(<span class='no'>.</span>)) <span class='kw'>%>%</span> | ||||
|   <span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>( | ||||
|     <span class='co'># now calculate first isolates</span> | ||||
|     <span class='kw'>first_regular</span> <span class='kw'>=</span> <span class='fu'><a href='first_isolate.html'>first_isolate</a></span>(<span class='no'>.</span>, <span class='kw'>col_keyantibiotics</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>), | ||||
|     <span class='co'># and first WEIGHTED isolates</span> | ||||
|   | ||||
| @@ -601,7 +601,7 @@ On our website <a href='https://msberends.gitlab.io/AMR'>https://msberends.gitla | ||||
| <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>) | ||||
|  | ||||
| <span class='no'>septic_patients</span> <span class='kw'>%>%</span> | ||||
|   <span class='fu'><a href='http://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>EUCAST</span> <span class='kw'>=</span> <span class='fu'>mdro</span>(<span class='no'>.</span>), | ||||
|   <span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>EUCAST</span> <span class='kw'>=</span> <span class='fu'>mdro</span>(<span class='no'>.</span>), | ||||
|          <span class='kw'>BRMO</span> <span class='kw'>=</span> <span class='fu'>brmo</span>(<span class='no'>.</span>)) | ||||
| <span class='co'># }</span></pre> | ||||
|   </div> | ||||
|   | ||||
| @@ -3,9 +3,12 @@ | ||||
| \name{AMR-deprecated} | ||||
| \alias{AMR-deprecated} | ||||
| \alias{ratio} | ||||
| \alias{guess_mo} | ||||
| \title{Deprecated functions} | ||||
| \usage{ | ||||
| ratio(x, ratio) | ||||
|  | ||||
| guess_mo(...) | ||||
| } | ||||
| \description{ | ||||
| These functions are \link{Deprecated}. They will be removed in a future release. Using the functions will give a warning with the name of the function it has been replaced by. | ||||
|   | ||||
							
								
								
									
										15
									
								
								man/as.mo.Rd
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								man/as.mo.Rd
									
									
									
									
									
								
							| @@ -4,16 +4,12 @@ | ||||
| \alias{as.mo} | ||||
| \alias{mo} | ||||
| \alias{is.mo} | ||||
| \alias{guess_mo} | ||||
| \title{Transform to microorganism ID} | ||||
| \usage{ | ||||
| as.mo(x, Becker = FALSE, Lancefield = FALSE, allow_uncertain = TRUE, | ||||
|   reference_df = NULL) | ||||
|  | ||||
| is.mo(x) | ||||
|  | ||||
| guess_mo(x, Becker = FALSE, Lancefield = FALSE, | ||||
|   allow_uncertain = TRUE, reference_df = NULL) | ||||
| } | ||||
| \arguments{ | ||||
| \item{x}{a character vector or a \code{data.frame} with one or two columns} | ||||
| @@ -77,8 +73,6 @@ When using \code{allow_uncertain = TRUE} (which is the default setting), it will | ||||
|   \item{\code{"S. aureus - please mind: MRSA"}. The last word will be stripped, after which the function will try to find a match. If it does not, the second last word will be stripped, etc. Again, a warning will be thrown that the result \emph{Staphylococcus aureus} (\code{B_STPHY_AUR}) needs review.} | ||||
|   \item{\code{"D. spartina"}. This is the abbreviation of an old taxonomic name: \emph{Didymosphaeria spartinae} (the last "e" was missing from the input). This fungus was renamed to \emph{Leptosphaeria obiones}, so a warning will be thrown that this result (\code{F_LPTSP_OBI}) needs review.} | ||||
| } | ||||
|  | ||||
| \code{guess_mo} is an alias of \code{as.mo}. | ||||
| } | ||||
| \section{Source}{ | ||||
|  | ||||
| @@ -124,12 +118,11 @@ as.mo("Streptococcus group A") | ||||
| as.mo("GAS") # Group A Streptococci | ||||
| as.mo("GBS") # Group B Streptococci | ||||
|  | ||||
| # guess_mo is an alias of as.mo and works the same | ||||
| guess_mo("S. epidermidis")                 # will remain species: B_STPHY_EPI | ||||
| guess_mo("S. epidermidis", Becker = TRUE)  # will not remain species: B_STPHY_CNS | ||||
| as.mo("S. epidermidis")                 # will remain species: B_STPHY_EPI | ||||
| as.mo("S. epidermidis", Becker = TRUE)  # will not remain species: B_STPHY_CNS | ||||
|  | ||||
| guess_mo("S. pyogenes")                    # will remain species: B_STRPTC_PYO | ||||
| guess_mo("S. pyogenes", Lancefield = TRUE) # will not remain species: B_STRPTC_GRA | ||||
| as.mo("S. pyogenes")                    # will remain species: B_STRPTC_PYO | ||||
| as.mo("S. pyogenes", Lancefield = TRUE) # will not remain species: B_STRPTC_GRA | ||||
|  | ||||
| # Use mo_* functions to get a specific property based on `mo` | ||||
| Ecoli <- as.mo("E. coli")     # returns `B_ESCHR_COL` | ||||
|   | ||||
		Reference in New Issue
	
	Block a user