Different types of input data

Actel requires that you organise your input data in a specific fashion. Critically, you should have a file named biometrics.csv, one named spatial.csv, and one named deployments.csv (we will look into the file contents in detail soon). Finally, you also need a detections directory, containing all your detection files in .csv format.

To create a blank workspace ready to be used, run blankWorkspace(), and a template will be generated automatically in an "actel_workspace" directory. If you would like to, you can change the name of the target directory by using the argument dir. Remember to delete the example rows before including your data!

Note for advanced R users

You can run actel analyses using R objects as an input, rather than input files. Read more about it in this dedicated page.

Biometrics file

Your biometrics file should look similar to this:

Release.dateSignalSensor.unitLength.mmWeight.gGroupRelease.site...
2018-02-01 10:05:00501T15040WildSite A...
2018-02-01 10:15:00502|503T|D16060HatcherySite A...
2018-02-01 10:15:00504|505|506T|D|A17050WildSite B...

Although the column order is not important, it is essential that this table contains two columns:

Release.date: Corresponds to the date and time when the animal was released, and must be typed in yyyy-mm-dd hh:mm:ss format. Note that the timestamps must be in the local time zone of the study area, which you will later supply in the tz argument.

Signal: Corresponds to the code emitted by your tags. If you are unsure as to what signals are, you should ask the tag manufacturer more about the differences between code spaces and signals.

Note:

If you do not include a "Code.space" column, actel will pick the code space that appears in the detections. If you want to be really sure that you are really picking your transmitter (i.e. a given signal in a given code space), make sure to include the code space as well.

Code spaces may have different names for different manufacturers. Currently, actel will convert the following name spaces automatically, unless the preload() function is being used: "A69-1008" to "R256", "A69-1206" to "R94K", "A69-1105" to "S256" and "A69-1303" to "R64K". To deactivate this automatic conversion, set options(actel.auto.convert.codespaces = FALSE).

The Group and Release.site columns are also important but, if you only have one group or one release site, actel can generate these columns for you. If this happens, you will receive a message:


M: No Release site has been indicated in the biometrics file. Creating a 'Release.site' column to avoid script failure. Filling with 'unspecified'.
M: No 'Group' column found in the biometrics file. Assigning all animals to group 'All'.

Note:

You can append as many columns as you want to biometrics.csv. Importantly, if the biometrics have columns with keywords such as length, weight or mass, graphics showing the distribution of these parameters per animal group will be drawn for you in the report.

Spatial file

Your spatial file should look similar to this:

Station.nameLatitudeLongitudeSectionArrayType
River East8.41140.411RiverA1Hydrophone
River West8.52140.521RiverA1Hydrophone
Estuary8.40240.402RiverA3Hydrophone
Site A8.44240.442A1Release
Site B8.44240.442A2Release

In this file you should include both your station deployment sites and your release sites. It is essential that this table has the following columns:

Station.name: The name of the station will be used to match the receiver deployments.

Array:

- If you are listing a station: The array to which the station belongs.

- If you are listing a release site: The first array(s) that the animal is expected to cross after being released.

Section: The study area section to which the hydrophone station belongs. Leave empty for the release sites.

Type: The nature of the item you are listing. You must choose between "Hydrophone" or "Release".

Note:

The release sites must have exactly the same names in the biometrics table and in the spatial table. If there is a mismatch, actel will stop.

If the spatial table contains release site information, but the biometrics table does not, release site information will be discarded and the following warning is issued:


Warning: At least one release site has been indicated in the spatial file, but no release sites were specified in the biometrics file.
Discarding release site information to avoid script failure. Please doublecheck your data.

Learn more about how to fit your study area into a spatial.csv file.

Deployments file

The deployments file is where you will list the receivers you used in the study. Here is an example:

ReceiverStation.nameStartStop
11111River East2018-01-01 11:30:002018-05-03 09:30:00
22222River West2018-01-01 11:33:002018-05-04 08:33:00
33333Estuary2018-01-01 11:34:002018-05-05 12:00:00

Short description of the columns:

Receiver: The serial number of the receiver. If a receiver was retrieved and re-deployed, you should add extra rows for each deployment.

Station.name: The name of the station where the receiver was deployed. It must match one of the station names in the spatial file.

Start and Stop: The times when the receiver was deployed and when the receiver was retrieved, respectively. Must be in a yyyy-mm-dd hh:mm:ss format. Note that these timestamps must be in the local time zone of the study area, which you will later supply in the tz argument.

Detections

Including your detections is the easiest part. Copy the .csv files offloaded from your receivers to the detections folder that was created by the blankWorkspace() function and actel will know they are to be imported. Right now actel can upload files generated specifically for actel, or generated by Vemco/Innovasea and Thelma manufactured receivers*. If you have an receiver from a different manufacturer, or if you are using one of the supported manufacturers and get the warning displayed below, please contact me so we can solve the issue.


Warning: File 'filename' does not match to any of the supported hydrophone file formats! If your file corresponds to a hydrophone log and actel did not recognize it, please get in contact through www.github.com/hugomflavio/actel/issues/new

Note:

The detection timestamps must be in UTC. This is the default time zone used by the receivers, so as long as you did not edit the raw files, all should be ready to go

*Note on Lotek receiver logs:

As of actel 1.3.0.9008, the new function convertLotekCDMAFile() can be used to convert Lotek TXT logs to a format usable by actel. This function is still in its early days. If you run into trouble using it, let me know!

Standard detections file

If you are working with a large database, odds are your detection data is no longer in the format of any given manufacturer. To import this data into actel, please prepare a .csv file with the following format:

TimestampReceiverCodeSpaceSignalSensor.ValueSensor.Unit
2018-01-01 11:30:0011111A12-3456123410T
2018-01-01 11:33:0022222A12-345612355.3D
2018-01-01 11:34:0033333R64K20313.6T
Note:

Timestamp data can use a space separator or a "T" separator between the date and time, but should always be in UTC.

Only list the receiver's serial number in the receiver column (e.g. "13014" rather than "VR2W-13014", or "111" rather than "TBR-111").

The column order is irrelevant, but the column names should be an exact match to what is displayed.

Optional: Distances matrix

A distances matrix is a table that contains information on the distance (in metres) between every pair of spatial elements in your study area (i.e. your stations and your release sites). It looks like the table below:

St.1St.2St.3St.4St.5St.6Release
St.10136634176912886392722229
St.21366020515545749779063569
St.33417205103528547958885621
St.46912554535280196323729115
St.58863749754791963040811067
St.69272790658882372408011476
Release222935695621911511067114760

Learn more about creating distances matrices.

Optional: Spatial.txt file

If your study area has multiple branches, then you need to tell actel how your arrays connect with each other. This file is optional because, if omitted, actel will assume that your study area is composed by a single branch and that the array order is the one listed in the spatial.csv file.

The spatial.txt file is very simple; all you need to do is connect your arrays with either dashes or arrows (find out the difference below). You can connect your arrays in pairs or make longer strings. To decide whether or not two arrays should be connected, ask yourself the following: "Can the animals move from A to B without having to pass through any other array?" If the answer is yes, then the arrays should be connected. Let's have a look at some examples.

Note: readDot() and plotDot()

The functions readDot() and plotDot() can be used to check the contents of your spatial.txt file.

Read more about them by running ?readDot and ?plotDot.

One branch study area, fully covering arrays

This is the simplest case, e.g. your animals are migrating through a channel, and your arrays split this channel in sections. Like in the figure below:

drawing

For this specific case you do not need to include a spatial.txt file, as long as you order the arrays in the spatial.csv file. However, if you wanted to include a spatial.txt file, it would look like this:


A -- B -- C -- D -- E

Note that you could also specify only one connection per line. E.g.:


A -- B 
B -- C 
C -- D 
D -- E

One branch study area, partly-covering arrays

This case is similar to above, but some arrays do not cover the totality. For example, they may cover a specific area of a lake (e.g. a spawning ground), Like in the figure below:

drawing

In this case, the animals can move from B to D without passing through C. As such, a spatial.txt file is now required, and it would look like this:

A -- B -- D -- E
B -- C
C -- D

Note that now, B, C and D are all directly connected with each other.

Multi branch study areas

In this case, the water channel branches into multiple paths, which may then merge again or not, like in the figure below:

drawing

Things are getting a bit more complex now. To make sure you do not miss any connection, it can be useful to draw in a map the links between the arrays as you write them down, so you can check at the end if everything is done. Below, I have marked in purple the connections between all the arrays:

drawing

And here is the respective spatial.txt:


A -- B 
A -- E
A -- F
B -- E
B -- F
E -- F
B -- C
C -- D
C -- E
E -- D
F -- G

Or, in the shortened version:


A -- B -- C -- D
A -- E -- D
A -- F -- G
B -- E -- F
B -- F
C -- E

Again, remember that you can use the functions readDot() and plotDot() to read and check your spatial.txt file before starting the analysis and see if everything checks out. E.g.:

# Start by loading the spatial.txt file 
dot <- readDot(input = "spatial.txt")

# then plot it:
plotDot(dot)

# You can load in your spatial.csv file as well with loadSpatial() to 
# colour the dot plot and position the arrays in the map proportionally 
# to their coordinates. See ?plotDot
Note:

This file can be called either "spatial.dot" or "spatial.txt", and you can create it using a simple text editor such as notepad, kate, VIM, etc.

Array direction

In the migration analysis, array direction is relevant. That means that writing A -- B is not the same as writing B -- A. In the first case, array B comes after array A (i.e. the animals are expected to reach A before reaching B), while in the second case the situation is reversed. This has implications for array efficiency calculations, so be sure to encode your study area carefully.

If you intend to run an explore or residency analysis, array direction is irrelevant.

explore()/residency() vs migration()

An optimal spatial.txt may differ depending on whether you want to run a migration or an explore/residency analysis. This is because actel interprets the spatial.txt file differently depending on the analysis:

In an explore/residency analyses, A -- B should be read as: It is possible to move from array A to array B and vice-versa.

In a migration analysis, A -- B should be read as: It is possible to move from array A to array B and vice-versa, AND the animals are expected to pass through array A before reaching array B.

Let's have a look at this example.

drawing

In this case, the spatial.txt for a residency analysis would look like this:


A -- B -- C -- G
A -- D -- E -- G
D -- F -- G
D -- B
C -- E
C -- F
E -- F

But a spatial.txt for a migration analysis would look like this:


A -- B -- C -- G
A -- D -- E -- G
D -- F -- G
D -- B -- D
C -- E -- C
C -- F -- C
E -- F -- E

The difference here is that, in the spatial.txt for migration, actel expects arrays to connected in a directional way. That means that connecting D -- B and B -- D does not mean the same thing, and it is important that you explicitly state that the animals are as likely to reach B coming from D as they are to reach D coming from B. In other words, you are saying that neither of the movements would be an explicit backwards movement. This will inform actel that D and B are parallel arrays, and that special rules should apply to them. The same goes for C, E and F.

Barriers

Sometimes it is possible for your animals to go from A to B, but not from B to A. In actel, you can include this information to further refine the analysis. In total, there are three symbols you can use to connect your arrays: --, -> or <-.

If the animals can move from A to B and vice-versa, use A -- B.

If the animals can only move from A to B, use either A -> B or B <- A.

If an animal then actually moves from B to A, actel will try to find an alternative route that the animal could have taken. If there are no alternative routes from B to A, actel will call this situation to your attention.

This has implications for array efficiency calculations, so be sure to encode your study area carefully.

You can find more information about impassable barriers here.

Running the analysis

Now that you have prepared your workspace, it is time to start the analysis. The first thing you need to do is decide which analysis you want to run: explore(), migration() or residency(). Here is some more information on them:

explore()

explore() allows you to quickly get a summary of your data. You can use explore() to get a general feel for the study results, and check if the input files are behaving as expected. It is also a good candidate if you just want to validate your detections for later use in other analyses.

Learn more about the explore() function.

migration()

The migration() analysis runs the same initial checks as explore(), but on top of it, it analyses the animal behaviour. By selecting the arrays that lead to success, you can define whether or not your animals survived the migration. Additional plots help you find out if some animal/tag has been acting odd. Multiple options allow you to tweak the analysis to fit your study perfectly.

Learn more about the migration() function.

residency()

The residency() analysis runs the same initial checks as explore(), but, similarly to migration, explores particular points of the animal behaviour. If you want to know where your animals were in each day of the study, how many animals were in each section each day, and other residency-focused variables, this is the analysis you are looking for!

Learn more about the residency() function.