Title: | Generate Color Tag Sequences |
---|---|
Description: | Implement a coherent and flexible protocol for animal color tagging. 'GenTag' provides a simple computational routine with low CPU usage to create color sequences for animal tag. First, a single-color tag sequence is created from an algorithm selected by the user, followed by verification of the combination uniqueness. Three methods to produce color tag sequences are provided. Users can modify the main function core to allow a wide range of applications. |
Authors: | Carlos Biagolini-Jr. |
Maintainer: | Carlos Biagolini-Jr.<[email protected]> |
License: | GPL (>= 2) |
Version: | 1.01 |
Built: | 2024-11-25 05:24:55 UTC |
Source: | https://github.com/biagolini/gentag |
Create combinations with equal sample probability to all colors.
allequal(ntag, colorsname, nspecial = 0, name1 = "Metal", name2 = "EMPTY", location1 = 1, location2 = 2, nspecial1 = 1, nspecial2 = 1)
allequal(ntag, colorsname, nspecial = 0, name1 = "Metal", name2 = "EMPTY", location1 = 1, location2 = 2, nspecial1 = 1, nspecial2 = 1)
ntag |
Number of tag to be used in each animal. |
colorsname |
Names/Code of color tags to be sample. |
nspecial |
Number of special tags/codes, such as metallic, 'EMPTY', or flag (min 0, max 2). |
name1 |
Name of special tag 1. |
name2 |
Name of special tag 2. |
location1 |
Position (or group of positions) to special band 1. |
location2 |
Position (or group of positions) to special band 2. |
nspecial1 |
Number of special tag 1 that will be present in all sequences genetated. |
nspecial2 |
Number of special tag 2 that will be present in all sequences genetated. |
A sequencie of tags
# Create an object contain the name/code of tag colors tcol<-c('Black','Blue','Brown','Gray','Green','Pink','Purple','Red','White','Yellow') # Generate color tag combination without especial tags genseq(30, 4, colorsname= tcol) # Generate color tag combination with especial color (ex metallic tag for numeric identification) genseq(30, 4, tcol, nspecial=1, name1='Metal',location1=c(2,4)) # For ongoing works, use the argument usedcombinations to informe the previus used combinations data(pre_used) # Data example genseq(100, 4, tcol, usedcombinations=pre_used[,1:4])
# Create an object contain the name/code of tag colors tcol<-c('Black','Blue','Brown','Gray','Green','Pink','Purple','Red','White','Yellow') # Generate color tag combination without especial tags genseq(30, 4, colorsname= tcol) # Generate color tag combination with especial color (ex metallic tag for numeric identification) genseq(30, 4, tcol, nspecial=1, name1='Metal',location1=c(2,4)) # For ongoing works, use the argument usedcombinations to informe the previus used combinations data(pre_used) # Data example genseq(100, 4, tcol, usedcombinations=pre_used[,1:4])
Estimates number of remaining color tags in the field
erc(usedcombinations, yearusedcombinations, currentyear = NA, yearsurvival = NA, lifespan = NA, hide_color = NA)
erc(usedcombinations, yearusedcombinations, currentyear = NA, yearsurvival = NA, lifespan = NA, hide_color = NA)
usedcombinations |
Pre used combinations. |
yearusedcombinations |
The year in which the combination was used. |
currentyear |
Current year. |
yearsurvival |
An estimation of the proportion of animals that survive between years. |
lifespan |
Combinations older the lifespan will be automatically disregard. |
hide_color |
Color(s) to be hide in the estimation of remain colors tags present in nature. |
A estimation of the number of remaining color tags in the field.
## The function is currently defined as data(pre_used) # Data example erc(pre_used[,1:4],pre_used[,5],2019,0.85, hide_color='EMPTY')
## The function is currently defined as data(pre_used) # Data example erc(pre_used[,1:4],pre_used[,5],2019,0.85, hide_color='EMPTY')
Find synonyms in a group of colors with code for empty tag.
escode(row_under_review, emptyname = NA, columns_set = NA)
escode(row_under_review, emptyname = NA, columns_set = NA)
row_under_review |
Color sequence to be analyzed. |
emptyname |
Code used to define empty code. |
columns_set |
Range of codes which belong to the same tag region. |
Matrix with all synonym
# Example of a full sequence combination<- c('EMPTY','Red','Yellow','Red','Blue','Green') # See synonym for the code group 1 to 3 escode(combination,'EMPTY',columns_set=1:3)
# Example of a full sequence combination<- c('EMPTY','Red','Yellow','Red','Blue','Green') # See synonym for the code group 1 to 3 escode(combination,'EMPTY',columns_set=1:3)
Find synonyms of a sequence with code for empty tag.
escombination(row_under_review, emptyname, g1 = NA, g2 = NA, g3 = NA, g4 = NA, g5 = NA, g6 = NA)
escombination(row_under_review, emptyname, g1 = NA, g2 = NA, g3 = NA, g4 = NA, g5 = NA, g6 = NA)
row_under_review |
Color sequence to be analyzed. |
emptyname |
Code used to define empty code. |
g1 |
Group of tags from group 1. For example, in a code of 6 colors for bird tag, tags from 1 to 3 belongs to the left leg, and tags from 1 to 3 belongs to the right. g1 must to address the left leg, and g2 must to address right leg. Thus: 'g1=1:3' and 'g2=4:6'. |
g2 |
Group of tags from group 2. For example, in a code of 6 colors for bird tag, tags from 1 to 3 belongs to the left leg, and tags from 1 to 3 belongs to the right. g1 must to address the left leg, and g2 must to address right leg. Thus: 'g1=1:3' and 'g2=4:6'. |
g3 |
Group of tags from group 3. |
g4 |
Group of tags from group 4. |
g5 |
Group of tags from group 5. |
g6 |
Group of tags from group 6. |
Matrix with all synonyms
# Example of a full sequence combination<- c('EMPTY','Red','Yellow','Red','Blue','Green') # See synonym for the full sequence escombination(combination,'EMPTY',g1=1:3,g2=4:6)
# Example of a full sequence combination<- c('EMPTY','Red','Yellow','Red','Blue','Green') # See synonym for the full sequence escombination(combination,'EMPTY',g1=1:3,g2=4:6)
Find synonyms in a dataset contain combination with code for empty tag.
esdataset(tag_sheet, emptyname, g1 = NA, g2 = NA, g3 = NA, g4 = NA, g5 = NA, g6 = NA)
esdataset(tag_sheet, emptyname, g1 = NA, g2 = NA, g3 = NA, g4 = NA, g5 = NA, g6 = NA)
tag_sheet |
Dataset contain sequences to be analyzed. |
emptyname |
Code used to define empty code. |
g1 |
Group of tags from group 1. For example, in a code of 6 colors for bird tag, tags from 1 to 3 belongs to the left leg, and tags from 1 to 3 belongs to the right. g1 must to address the left leg, and g2 must to address right leg. Thus: 'g1=1:3' and 'g2=4:6'. |
g2 |
Group of tags from group 2. For example, in a code of 6 colors for bird tag, tags from 1 to 3 belongs to the left leg, and tags from 1 to 3 belongs to the right. g1 must to address the left leg, and g2 must to address right leg. Thus: 'g1=1:3' and 'g2=4:6'. |
g3 |
Group of tags from group 3. |
g4 |
Group of tags from group 4. |
g5 |
Group of tags from group 5. |
g6 |
Group of tags from group 6. |
Matrix with all synonyms for from entire dataset
(combination<- matrix(c('EMPTY','Red','Blue','Green'),4,6,TRUE)) # Example of a dataset esdataset(combination,'EMPTY',g1=1:3,g2=4:6)
(combination<- matrix(c('EMPTY','Red','Blue','Green'),4,6,TRUE)) # Example of a dataset esdataset(combination,'EMPTY',g1=1:3,g2=4:6)
Create combinations with equal sample probability to all colors.
genseq(ncombinations = 100, ntag = 4, colorsname, gen_method = "allequal", usedcombinations = NA, colorsf = NA, nspecial = 0, name1 = "Metal", name2 = "EMPTY", location1 = 1, location2 = 2, nspecial1 = 1, nspecial2 = 1, emptyused = FALSE, emptyname = "EMPTY", currentyear = NA, yearsurvival = 1, lifespan = NA, iotf = FALSE, yearusedcombinations = NA, speed = 1, ignorecolor = NA, g1 = NA, g2 = NA, g3 = NA, g4 = NA, g5 = NA, g6 = NA, parameterslist = NA)
genseq(ncombinations = 100, ntag = 4, colorsname, gen_method = "allequal", usedcombinations = NA, colorsf = NA, nspecial = 0, name1 = "Metal", name2 = "EMPTY", location1 = 1, location2 = 2, nspecial1 = 1, nspecial2 = 1, emptyused = FALSE, emptyname = "EMPTY", currentyear = NA, yearsurvival = 1, lifespan = NA, iotf = FALSE, yearusedcombinations = NA, speed = 1, ignorecolor = NA, g1 = NA, g2 = NA, g3 = NA, g4 = NA, g5 = NA, g6 = NA, parameterslist = NA)
ncombinations |
Number of combinations to be generated. |
ntag |
Number of tag to be used in each animal. |
colorsname |
Names/Code of color tags to be sample. |
gen_method |
method used for sample colors for tag sequence. |
usedcombinations |
Pre used combinations. |
colorsf |
Frequencies/ratio for color sample. |
nspecial |
Number of special tags/codes, such as metallic, 'EMPTY', or flag (min 0, max 2). |
name1 |
Name of special tag 1. |
name2 |
Name of special tag 2. |
location1 |
Position (or group of positions) to special band 1. |
location2 |
Position (or group of positions) to special band 2. |
nspecial1 |
Number of special tag 1 that will be present in all sequences genetated. |
nspecial2 |
Number of special tag 2 that will be present in all sequences genetated. |
emptyused |
If pre-used combination has code for empty set as TRUE, otherwise FALSE |
emptyname |
Code used to define empty code. |
currentyear |
Current year. |
yearsurvival |
An estimation of the proportion of animals that survive between years. |
lifespan |
Combinations older the lifespan will be automatically disregard. |
iotf |
Ignore older than lifespan. If TRUE ignore pre-used combinations older than lifespan |
yearusedcombinations |
The year in which the combination was used. |
speed |
Speed for color frequency adjustment. |
ignorecolor |
Color to be ignored on lifexp. |
g1 |
Group of tags from group 1. For example, in a code of 6 colors for bird tag, tags from 1 to 3 belongs to the left leg, and tags from 1 to 3 belongs to the right. g1 must to address the left leg, and g2 must to address right leg. Thus: 'g1=1:3' and 'g2=4:6'. |
g2 |
Group of tags from group 2. For example, in a code of 6 colors for bird tag, tags from 1 to 3 belongs to the left leg, and tags from 1 to 3 belongs to the right. g1 must to address the left leg, and g2 must to address right leg. Thus: 'g1=1:3' and 'g2=4:6'. |
g3 |
Group of tags from group 3. |
g4 |
Group of tags from group 4. |
g5 |
Group of tags from group 5. |
g6 |
Group of tags from group 6. |
parameterslist |
parameters for methods not provide by 'GenTag' |
A list of combinations
# Create an object contain the name/code of tag colors tcol<-c('Black','Blue','Brown','Gray','Green','Pink','Purple','Red','White','Yellow') # Generate color tag combination without especial tags genseq(30, 4, colorsname= tcol) # Generate color tag combination with especial color (ex metallic tag for numeric identification) genseq(30, 4, tcol, nspecial=1, name1='Metal', location1=c(2,4)) # For ongoing works, use the argument usedcombinations to informe the previus used combinations data(pre_used) # Data example genseq(30, 4, colorsname= tcol, usedcombinations=pre_used[,1:4]) combinations<-genseq(100, 4, tcol) # save combinations into an object
# Create an object contain the name/code of tag colors tcol<-c('Black','Blue','Brown','Gray','Green','Pink','Purple','Red','White','Yellow') # Generate color tag combination without especial tags genseq(30, 4, colorsname= tcol) # Generate color tag combination with especial color (ex metallic tag for numeric identification) genseq(30, 4, tcol, nspecial=1, name1='Metal', location1=c(2,4)) # For ongoing works, use the argument usedcombinations to informe the previus used combinations data(pre_used) # Data example genseq(30, 4, colorsname= tcol, usedcombinations=pre_used[,1:4]) combinations<-genseq(100, 4, tcol) # save combinations into an object
Create combinations with variable sample probability.
lifexp(ntag, colorsname, nspecial = 0, name1 = "Metal", name2 = "EMPTY", location1 = 1, location2 = 2, nspecial1 = 1, nspecial2 = 1, currentyear = NA, yearsurvival = 1, lifespan = NA, yearusedcombinations, usedcombinations, speed = 1, ignorecolor = NA)
lifexp(ntag, colorsname, nspecial = 0, name1 = "Metal", name2 = "EMPTY", location1 = 1, location2 = 2, nspecial1 = 1, nspecial2 = 1, currentyear = NA, yearsurvival = 1, lifespan = NA, yearusedcombinations, usedcombinations, speed = 1, ignorecolor = NA)
ntag |
Number of tag to be used in each animal. |
colorsname |
Names/Code of color tags to be sample. |
nspecial |
Number of special tags/codes, such as metallic, 'EMPTY', or flag (min 0, max 2). |
name1 |
Name of special tag 1. |
name2 |
Name of special tag 2. |
location1 |
Position (or group of positions) to special band 1. |
location2 |
Position (or group of positions) to special band 2. |
nspecial1 |
Number of special tag 1 that will be present in all sequences genetated. |
nspecial2 |
Number of special tag 2 that will be present in all sequences genetated. |
currentyear |
Current year. |
yearsurvival |
An estimation of the proportion of animals that survive between years. |
lifespan |
Combinations older the lifespan will be automatically disregard. |
yearusedcombinations |
The year in which the combination was used. |
usedcombinations |
Pre used combinations. |
speed |
Speed for color frequency adjustment. |
ignorecolor |
Color to be ignored on lifexp. |
A sequencie of tags
data(pre_used) # Data example # Create an object contain the name/code of tag colors tcol<-c('Black','Blue','Brown','Gray','Green','Pink','Purple','Red','White','Yellow') genseq(30, 4,tcol, 'lifexp', pre_used[,1:4], yearusedcombinations=pre_used[,5], yearsurvival= 0.8, lifespan=5, currentyear=2019)
data(pre_used) # Data example # Create an object contain the name/code of tag colors tcol<-c('Black','Blue','Brown','Gray','Green','Pink','Purple','Red','White','Yellow') genseq(30, 4,tcol, 'lifexp', pre_used[,1:4], yearusedcombinations=pre_used[,5], yearsurvival= 0.8, lifespan=5, currentyear=2019)
Pre-used combinations combinations
data(pre_used)
data(pre_used)
A data frame with 1200 observations on the following 5 variables.
Tag_1
a factor with levels Black
Brown
Dark_Blue
EMPTY
Gray
Green
Light_Blue
Orange
Pink
Red
White
Yellow
Tag_2
a factor with levels Black
Brown
Dark_Blue
Gray
Green
Light_Blue
Metal
Orange
Pink
Red
White
Yellow
Tag_3
a factor with levels Black
Brown
Dark_Blue
EMPTY
Gray
Green
Light_Blue
Orange
Pink
Red
White
Yellow
Tag_4
a factor with levels Black
Brown
Dark_Blue
Gray
Green
Light_Blue
Metal
Orange
Pink
Red
White
Yellow
Year
a numeric vector
Simulated database to example of registers of color tag sequences usage. Columns 1, 2 ,3 and 4 represent the tag code, and column 5 is the date of tagging.
Simulated database
Summary the number of each color tag used per year.
scy(usedcombinations, yearusedcombinations, hide_color = NA)
scy(usedcombinations, yearusedcombinations, hide_color = NA)
usedcombinations |
Pre used combinations. |
yearusedcombinations |
The year in which the combination was used. |
hide_color |
Color(s) to be hide in the estimation of remain colors tags present in nature. |
A summary of the numeber of tag colors used by year
data(pre_used) # Data example scy(pre_used[,1:4],pre_used[,5], hide_color='EMPTY')
data(pre_used) # Data example scy(pre_used[,1:4],pre_used[,5], hide_color='EMPTY')
Create combinations with defined sample probability to each colors.
vfrequency(ntag, colorsname, colorsf, nspecial = 0, name1 = "Metal", name2 = "EMPTY", location1 = 1, location2 = 2, nspecial1 = 1, nspecial2 = 1)
vfrequency(ntag, colorsname, colorsf, nspecial = 0, name1 = "Metal", name2 = "EMPTY", location1 = 1, location2 = 2, nspecial1 = 1, nspecial2 = 1)
ntag |
Number of tag to be used in each animal. |
colorsname |
Names/Code of color tags to be sample. |
colorsf |
Frequencies/ratio for color sample. |
nspecial |
Number of special tags/codes, such as metallic, 'EMPTY', or flag (min 0, max 2). |
name1 |
Name of special tag 1. |
name2 |
Name of special tag 2. |
location1 |
Position (or group of positions) to special band 1. |
location2 |
Position (or group of positions) to special band 2. |
nspecial1 |
Number of special tag 1 that will be present in all sequences genetated. |
nspecial2 |
Number of special tag 2 that will be present in all sequences genetated. |
A sequencie of tags
tcol<-c('Black','Blue','Brown','Gray','Green','Pink','Purple','Red','White','Yellow') p<-c(1,2,5,1,2,2,4,5,8,5) genseq(30, 4, tcol, gen_method='vfrequency', colorsf=p)
tcol<-c('Black','Blue','Brown','Gray','Green','Pink','Purple','Red','White','Yellow') p<-c(1,2,5,1,2,2,4,5,8,5) genseq(30, 4, tcol, gen_method='vfrequency', colorsf=p)