Fathead Minnow (Pimephales promelas)
Male on the left and female on the right. Zachary S. Randall / FLMNH
Fathead minnows (Pimephales promelas) are common across much of North America, but they have an uncommon and complicated reproductive behavior. During the breeding season, male fathead minnows defend nesting areas (usually the undersides of rocks). After females lay eggs in a single layer on the spawning surface (a behavior called egg clustering), male fathead minnows care for their eggs until hatching. Paternal care includes removing deceased eggs from the clutch, defending the nest from predators, and rubbing the eggs with a “dorsal pad of mucus-secreting cells.” The rubbing behavior is thought to aerate the eggs and help prevent disease.
When choosing nest sites, male fathead minnows prefer sites that already have eggs present and will take care of eggs that they did not sire (called alloparental care). When choosing males, females prefer individuals that already have eggs at their nest site.
The photographs in this article are of specimens from the Florida Museum of Natural History. Fathead minnows are sexually dimorphic. Males are much larger than females and breeding males have a swollen black head, a large pad on their nape, and large tubercles on their snout.
This month's coding corner will introduce readers to R programming and utilizing the iDigBio Search API for querying specimen data. A PDF version of this lesson can be found here: fathead-minnow-r-may2015.pdf. Code examples that you can run in the R console will be formatted like this:
Code Example #1
And the output of the console will be formatted like this:
##  "Hello World!"
Code Example #1 Output
If you are a little lost at this point, you can learn more about using R here: http://idigbio.github.io/2015-03-09-workshop-field2db/intro-R.html
Let's jump right in!
We're going to need a little help installing iDigBio's R library, so let's start there:
Code Example #1
The console may output some message from code example #1, although it will not return an output. As long as we don't encounter any errors, now we can use the function "install_github" to install iDigBio's R library and then load it into memory:
Code Example #2
Let's take a look at this month's biodiversity spotlight, the fathead minnow, "Pimephales promelas", in iDigBio by creating a dataframe using the function "idig_search_records":
fatheadData <- idig_search_records(rq=list(scientificname="pimephales promelas")) str(fatheadData)
Code Example #3
## 'data.frame': 4463 obs. of 12 variables: ## $ uuid : chr "0008d42b-d35d-495a-8f1a-85da16a56f95" "001c0813-9193-4587-845c-b1fa36c3a3a4" "00290af7-469f-4c19-880b-49578a7d2abd" "0037b666-62ce-4686-9cb4-71548dc1fbcf" ... ## $ occurrenceid : chr "dca6d8ae-1ed3-11e3-bfac-90b11c41863e" "urn:lsid:biosci.ohio-state.edu:osuc_occurrences:osum__7449" "urn:occurrence:arctos:ucm:fish:7223:2540659" "http://biocoll.inhs.illinois.edu/fish/inhs832" ... ## $ catalognumber : chr "34424" "osum 7449" "7223" "832" ... ## $ family : chr "cyprinidae" "cyprinidae" "cyprinidae" "cyprinidae" ... ## $ genus : chr "pimephales" "pimephales" "pimephales" "pimephales" ... ## $ scientificname: chr "pimephales promelas" "pimephales promelas" "pimephales promelas" "pimephales promelas" ... ## $ country : chr "united states" "united states" "united states" "united states" ... ## $ stateprovince : chr "kansas" "ohio" "colorado" "illinois" ... ## $ geopoint.lat : chr "39.7361111" "41.5064" NA "41.48569" ... ## $ geopoint.lon : chr "-101.8788889" "-83.0577" NA "-87.60199" ... ## $ datecollected : chr "2003-06-03T00:00:00+00:00" NA NA "1969-11-07T00:00:00+00:00" ... ## $ collector : chr "kansas department of wildlife and parks" "daiber, f. c. (frank c.) & ryther, j. (john)" "collector(s): unknown" "p. vidal & j.w. sublett" ...
Code Example #3 Output
In the last block of code, we asked R to provide a glimpse of the structure of the dataframe. We can see that the iDigBio search API returned columns of data, and we can check their names with:
Code Example #4
##  "uuid" "occurrenceid" "catalognumber" "family" ##  "genus" "scientificname" "country" "stateprovince" ##  "geopoint.lat" "geopoint.lon" "datecollected" "collector"
Code Example #4 Output
Our goal for this coding corner is to make a basic map. For some sanity checking of the data, see what data are present in the "country" column:
Code Example #5
##  "united states" "mexico" "canada" "nicaragua" ##  NA
Code Example #5 Output
And we can create a plot of the latitude and longitude of these records:
Since we know all of our values must land within the US, Mexico, Nicaragua, and Canada, it appears like we may have an outlier. We can take a closer look:
outlier <- fatheadData[which(fatheadData$geopoint.lon >0),] outlier$country
Code Example #6
##  "united states"
Code Example #6 Output
Since we know that this outlier is an error in the data, we will create a new dataframe with this outlier omitted
cleanedData <- fatheadData[which(fatheadData$uuid != outlier$uuid),]
Code Example #7
Now we can output this data to a CSV file so we can work with it in other applications:
Code Example #8
As an exercise for the reader, can you recreate the following map with the concepts presented above?
Want to see all of our Species' Spotlights and receive iDigBio related news? Subscribe to our newsletter, The iDigBio Spotlight!
- Page, L.M. and Ceas, P.A. 1989. Egg attachment in Pimephales (Pisces: Cyprinidae). Copeia, 4: 1074-1077
- Unger, L.M. and Sargent, R.C. 1988. Allopaternal care in the fathead minnow, Pimephales promelas: females prefer males with eggs. Behavioral Ecology and Sociobiology, 23: 27-32
- Page, L.M. and Burr, B.M. 1991. A field guide to freshwater fishes of North America north of Mexico. Houghton Mifflin Company, Boston. 432 p. (Ref. 5723)