Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

case management #41

Open
ctc3d opened this issue Feb 21, 2020 · 0 comments
Open

case management #41

ctc3d opened this issue Feb 21, 2020 · 0 comments

Comments

@ctc3d
Copy link

ctc3d commented Feb 21, 2020

Here's a non-bug issue that's been popping up for me just enough to be a drag. For knotted-up workflow reasons I do a round of resolve_sci_taxa() and then from a list of the non-hits treat replace_taxa() like this:

repl_list <- list(
	# 'Abies balsamea var phanerolepis' = 'Abies x phanerolepis',
	# 'Acer freemanii' = 'Acer x freemanii',
	'Acer x freemanii' = 'Acer x freemanii',
	'ACER PLATANOIDES SCHWEDLERI' = 'Acer platanoides',
	# 'Acer tataricum ginnala' = 'Acer tataricum',
	# 'Alnus rugosa' = 'Alnus incana',
	# 'Amelanchier grandifolia' = 'Amelanchier x grandiflora',
	'Amelanchier X grandiflora' = 'Amelanchier x grandiflora',
	'AMELANCHIER X GRANDIFLORA ROBIN HILL' = 'Amelanchier x grandiflora',
	'Carya tomentosa' = 'Carya alba',
	'Cladrastus lutea' = 'Cladrastis kentukea',
	'Gleditsia triacanthos inermis' = 'Gleditsia triacanthos',
	'Laburnum x watereri' = 'Laburnum x watereri'
	# 'Laburnum_x_watereri' = 'Laburnum x watereri',
)
map2(names(repl_list), repl_list, function(bad, good) {
		replace_taxa(path = map_path, input = bad, output = good)
		return()})

If it works map2() returns "[[#]] NULL" for each entry. A lot of the particulars here involve fighting with either ITIS or the next stage of vetting I have to do -- like the entries where I'm replacing a taxon with itself. Some are commented out because this list has been accumulating with irregular repeats from one data file to the next, so it's good to build this "dictionary". So most of the weirdness here is not TCR issues.

But a problem is that the matching in replace_taxa() is fairly picky, and so won't match "ACER" with "Acer", for instance. It might be helpful and safe (in all functions?) to treat every input taxon as though it were properly capitalized, like "Genus species" -- or at least to do case-insensitive matching.

For what I need I can handle this upstream with a conversion to proper case on reading the file -- but it's not always clear that I'm going to have to so I get halfway through, discover it and have to go back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant