-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from EcoJulia/feature/vernacular
✨ vernacular names
- Loading branch information
Showing
5 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "NCBITaxonomy" | ||
uuid = "f88b31d2-eb98-4433-b52d-2dd32bc6efce" | ||
authors = ["Timothée Poisot <[email protected]>"] | ||
version = "0.0.5" | ||
version = "0.0.6" | ||
|
||
[deps] | ||
Arrow = "69666777-d1a9-59fb-9406-91d4454c9d45" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
""" | ||
vernacular(t::NCBITaxon) | ||
This function will return `nothing` if no vernacular name is known, and an array | ||
of names if found. It searches the "common name" and "genbank common name" | ||
category of the NCBI taxonomy name table. | ||
""" | ||
function vernacular(t::NCBITaxon) | ||
names_from_tax = filter(r -> r.tax_id == t.id, NCBITaxonomy.names_table) | ||
common_names = filter(r -> r.class == NCBITaxonomy.class_common_name, names_from_tax) | ||
genbank_names = filter(r -> r.class == NCBITaxonomy.class_genbank_common_name, names_from_tax) | ||
all_names = vcat(common_names.name, genbank_names.name) | ||
length(all_names) == 0 && return nothing | ||
return unique(all_names) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0859f41
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
0859f41
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/26366
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: