Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
base repository: burgerga/mdftracks
Choose a Base Repository
Nothing to show
base: v0.2.0
head repository: burgerga/mdftracks
Choose a Head Repository
Nothing to show
compare: HEAD
  • 8 commits
  • 5 files changed
  • 0 comments
  • 1 contributor
Commits on Feb 07, 2017
Commits on Feb 27, 2017
Showing with 55 additions and 15 deletions.
  1. +4 −4 DESCRIPTION
  2. +2 −2 R/mdftracks.R
  3. +14 −4 README.Rmd
  4. +30 −5 README.md
  5. +5 −0 tests/testthat/testWriteMdf.R
@@ -1,8 +1,8 @@
Package: mdftracks
Type: Package
Title: Read and Write 'MTrackJ Data Files'
Version: 0.2.0
Authors@R: person("Gerhard", "Burger", email = "burger.ga@gmail.com", role = c("aut", "cre"))
Version: 0.2.0.9999
Authors@R: person("Gerhard", "Burger", email = "burger.ga@gmail.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0003-1062-5576"))
Description: 'MTrackJ' is an 'ImageJ' plugin for motion tracking and analysis (see
<https://imagescience.org/meijering/software/mtrackj/>). This package reads
and writes 'MTrackJ Data Files' ('.mdf', see
@@ -17,5 +17,5 @@ Imports: hellno
URL: https://github.com/burgerga/mdftracks
BugReports: https://github.com/burgerga/mdftracks/issues
Roxygen: list(markdown = TRUE)
RoxygenNote: 6.0.0
Suggests: testthat, tools
RoxygenNote: 6.0.1
Suggests: testthat, tools, tibble
@@ -68,7 +68,7 @@ read.mdf <- function(file, drop.Z = F, include.point.numbers = FALSE,
if(!grepl(sprintf(pkg.env$mtrackj.header, '[0-9]+(.[0-9]+)*'), mdf.lines)) {
stop("does not appear to be an MTrackJ Data File")
}
message(mdf.lines)
# message(mdf.lines) # Print mdf version info from file
mdf.lines <- c(mdf.lines, readLines(file))

cluster.bounds <- getClusterBounds(mdf.lines)
@@ -227,7 +227,7 @@ write.mdf <- function(x, file = "", cluster.column = NA, id.column = 1,
for(track in names(track.l)) {
writeLines(sprintf("Track %d", as.numeric(track)), file, sep = '\n')
track.data <- track.l[[track]]
track.data <- track.data[order(track.data[cn['t']]), ]
track.data <- track.data[order(track.data[[cn['t']]]), ]
if(generate.points) {
track.data[cn['p']] <- 1:nrow(track.data)
}
@@ -13,6 +13,7 @@ knitr::opts_chunk$set(
)
```

[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/mdftracks)](https://cran.r-project.org/package=mdftracks)
[![Build Status](https://travis-ci.org/burgerga/mdftracks.svg?branch=master)](https://travis-ci.org/burgerga/mdftracks)
[![codecov](https://codecov.io/gh/burgerga/mdftracks/branch/master/graph/badge.svg)](https://codecov.io/gh/burgerga/mdftracks)
[![License: GPL-3](https://img.shields.io/badge/license-GPL--3-blue.svg)](http://www.gnu.org/licenses/gpl-3.0)
@@ -28,22 +29,22 @@ First load the package with
library(mdftracks)
```

**Reading 3D data: **
**Reading 3D data**

```{r}
mdf.file <- system.file("extdata", "example.mdf", package = 'mdftracks')
data <- read.mdf(mdf.file)
head(data, 10)
```

**Dropping the z-coordinate for 2D data: **
**Dropping the z-coordinate for 2D data**

```{r}
data <- read.mdf(mdf.file, drop.Z = T)
head(data, 10)
```

**Writing data in `(id, t, x, y, z)` format (e.g., from [MotilityLab](https://github.com/jtextor/MotilityLab)): **
**Writing data in `(id, t, x, y, z)` format (e.g., from [MotilityLab](https://github.com/jtextor/MotilityLab))**

```{r}
library('MotilityLab')
@@ -55,7 +56,7 @@ head(tracks.df, 10)
write.mdf(head(tracks.df, 10))
```

**Writing data with cluster, channel, and point information: **
**Writing data with cluster, channel, and point information**

```{r, collapse=FALSE}
print(mdftracks.example.data)
@@ -71,3 +72,12 @@ For more information, consult the package documentation.
```{r, eval=F}
install.packages('mdftracks')
```

## How to cite?

Please use the R command `citation(package = "mdftracks")` to get the most up-to-date citation. Example for v0.2.0:

```{r}
citation(package = "mdftracks")
```

@@ -2,7 +2,7 @@ mdftracks
================

<!-- README.md is generated from README.Rmd. Please edit that file -->
[![Build Status](https://travis-ci.org/burgerga/mdftracks.svg?branch=master)](https://travis-ci.org/burgerga/mdftracks) [![codecov](https://codecov.io/gh/burgerga/mdftracks/branch/master/graph/badge.svg)](https://codecov.io/gh/burgerga/mdftracks) [![License: GPL-3](https://img.shields.io/badge/license-GPL--3-blue.svg)](http://www.gnu.org/licenses/gpl-3.0)
![](http://www.r-pkg.org/badges/version/mdftracks) [![Build Status](https://travis-ci.org/burgerga/mdftracks.svg?branch=master)](https://travis-ci.org/burgerga/mdftracks) [![codecov](https://codecov.io/gh/burgerga/mdftracks/branch/master/graph/badge.svg)](https://codecov.io/gh/burgerga/mdftracks) [![License: GPL-3](https://img.shields.io/badge/license-GPL--3-blue.svg)](http://www.gnu.org/licenses/gpl-3.0)

Reads and writes **[MTrackJ](https://imagescience.org/meijering/software/mtrackj/) Data Files** ([`.mdf`](https://imagescience.org/meijering/software/mtrackj/format/)). Supports clusters, 2D data, and channel information. If desired, generates unique track identifiers based on cluster and id data from the `.mdf` file.

@@ -15,7 +15,7 @@ First load the package with
library(mdftracks)
```

**Reading 3D data: **
**Reading 3D data**

``` r
mdf.file <- system.file("extdata", "example.mdf", package = 'mdftracks')
@@ -35,7 +35,7 @@ head(data, 10)
#> 1.1.10 1 1 10 823 125 1
```

**Dropping the z-coordinate for 2D data: **
**Dropping the z-coordinate for 2D data**

``` r
data <- read.mdf(mdf.file, drop.Z = T)
@@ -54,7 +54,7 @@ head(data, 10)
#> 1.1.10 1 1 10 823 125
```

**Writing data in `(id, t, x, y, z)` format (e.g., from [MotilityLab](https://github.com/jtextor/MotilityLab)): **
**Writing data in `(id, t, x, y, z)` format (e.g., from [MotilityLab](https://github.com/jtextor/MotilityLab))**

``` r
library('MotilityLab')
@@ -103,7 +103,7 @@ write.mdf(head(tracks.df, 10))
#> Point 10 131.7630004883 117.6630020142 6.25 249.8899993896 1
#> End of MTrackJ Data File

**Writing data with cluster, channel, and point information: **
**Writing data with cluster, channel, and point information**

``` r
print(mdftracks.example.data)
@@ -160,3 +160,28 @@ Installation
``` r
install.packages('mdftracks')
```

How to cite?
------------

Please use the R command `citation(package = "mdftracks")` to get the most up-to-date citation. Example for v0.2.0:

``` r
citation(package = "mdftracks")
#>
#> To cite package 'mdftracks' in publications use:
#>
#> Gerhard Burger (2017). mdftracks: Read and Write 'MTrackJ Data
#> Files'. R package version 0.2.0.
#> https://CRAN.R-project.org/package=mdftracks
#>
#> A BibTeX entry for LaTeX users is
#>
#> @Manual{,
#> title = {mdftracks: Read and Write 'MTrackJ Data Files'},
#> author = {Gerhard Burger},
#> year = {2017},
#> note = {R package version 0.2.0},
#> url = {https://CRAN.R-project.org/package=mdftracks},
#> }
```
@@ -35,6 +35,11 @@ test_that("Data frames with columns id, t, x, y, z (MotilyLab) can be exported
ref_expected_output)
})

test_that("Writing tibbles works", {
expect_output(write.mdf(tibble::as_tibble(test.df[,c('uid','t', 'x', 'y', 'z')])),
ref_expected_output)
})

test_that("Factor columns are converted to numeric", {
temp.df <- test.df[,c('uid','t', 'x', 'y', 'z')]
temp.df$uid <- as.factor(temp.df$uid)

No commit comments for this range

You can’t perform that action at this time.