Git Product home page Git Product logo

gphys's Introduction

gphys

Build Status Docs DOI

This R package provides relatively specialised routines for analysing electrophysiological data determined by the research in our lab using whole cell patch clamp techniques to analyse olfactory processing in the fly. Nevertheless it is possible that others, especially anyone using Jason Rothman's Neuromatic data analysis and acquisition package for Igor Pro, may find some functionality useful. It can also be used to reproduce some of the analysis / figures in our published work e.g. in the package frulhns.

For further details see the R DESCRIPTION file.

Installation

Currently there isn't a released version on CRAN.You can use the devtools package to install either the latest release or development version:

# install devtools if required
install.packages("devtools")

library(devtools)
# latest release (recommended)
install_github("jefferis/gphys")

# develop branch may occasionally have changes that have not been merged to master
install_github("jefferis/gphys@develop")

Note: Windows users need Rtools and devtools to install this way.

Acknowledgements

This tool naturally depends on a number of other R packages including my own package IgorR. However the most sophisticated and domain-specific dependency is the STAR package of Christophe Pouzat โ€“ this offers a great deal of exciting functionality that we hope to use in future.

gphys's People

Contributors

ajdm avatar jdmanton avatar jefferis avatar scachero avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gphys's Issues

Allow subset.spiketimes to remove duplicate odours

Currently if you specify an odour subset that includes a duplicate odour (e.g. the blank) it errors out suggesting you might like to subset by channel numbers. But there is a special case when CO2 is being delivered and the same channel number is associated with another odour. For this case it is better just to subset by odour name, but remove any duplicate waves for odours that we have requested.

merge.spiketimes should handle duplicated channels

If the same numbered channel is used with two different labels in an ODD config, merge.spiketimes will try to merge all data from that numbered channel but then confuses the channel labels.

  1. warn/error when there are duplicated channel numbers
  2. use number+label to uniquely identify channels.

Note that 2. could break some cells somewhere unless we only use label when number alone is insufficient to identify. We might recognise this e.g. by checking that every row of data has the same number of stimulations.

as.repeatedTrain needs to cope with trains missing spikes

> as.repeatedTrain(Spikes2[[200]],xlim-c(0,3000))
$OilBl
Error in plot.window(...) : need finite 'xlim' values
In addition: Warning messages:
1: In FUN(X[[4L]], ...) : no non-missing arguments to max; returning -Inf
2: In FUN(X[[4L]], ...) : no non-missing arguments to max; returning -Inf
3: In FUN(X[[4L]], ...) : no non-missing arguments to max; returning -Inf
4: In FUN(X[[4L]], ...) : no non-missing arguments to max; returning -Inf

Fundamentally, this may involve some changes to the STAR package to incorporate a notion of the time window over which spikes were mesasured (even if there were no spikes).

teach lifetime_sparseness to handle NAs

lifetime_sparseness
function (x, minodours = 0.75) 
{
    if (is.data.frame(x)) 
        x = as.matrix(x)
    if (!is.matrix(x)) {
        if (is.vector(x)) 
            x <- matrix(x, nrow = 1)
        else stop("Unknown data format. I like matrices, dataframes and vectors.")
    }
    if (any(x < 0, na.rm = T)) {
        nxlt0 = sum(x < 0, na.rm = T)
        x[x < 0] = 0
        warning("Zeroing ", nxlt0, " responses < 0")
    }
    N <- ncol(x)
    S = 1/(1 - 1/N) * (1 - (rowSums(x/N, na.rm = T)^2)/(rowSums(x^2/N, 
        na.rm = T)))
    nodours_percell = rowSums(is.finite(x))
    badcell = nodours_percell < minodours
    if (any(badcell)) {
        warning("Returning NA for ", sum(badcell, na.rm = T), 
            " cells that have too few odours")
        S[badcell] = NA
    }
    S
}

Record the file number from which spikes were read

This will make it easier to attach other information such as the analogue voltage traces later on. The place to do this is in CollectSpikesFromSweeps but we will need to make sure that this propagates through e.g. merge and divide.spiketimes.

The main motivation for this is to deal with Shahar's data collection with shuffled odour presentations. At the moment this works for spikes (see #13) but not for the average voltage traces which are therefore averages of the wrong sweeps. Previously we have been using Igor to generate those average waves. Now we will need to do it in R.

Fix scale.ts definition to match generic

This will be essential to prepare for an eventual CRAN release.

This one is easy in principle (with some change of interface).

scale:
  function(x, center, scale)
scale.ts:
  function(waves, yrange)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.