Skip to content

Commit

Permalink
some updates and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
umutcaglar committed Mar 17, 2017
1 parent 9c953d3 commit 50ee454
Show file tree
Hide file tree
Showing 25 changed files with 901 additions and 15,137 deletions.
Binary file modified .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: sicegar
Type: Package
Title: Analysis of Single-Cell Viral Growth Curves
Version: 0.1
Version: 0.1.0.0000
Date: 2015-12-17
Authors@R: c( person("M. Umut", "Caglar", role = c("aut", "cre"), email =
"[email protected]"), person("Claus O.", "Wilke", role = c("aut"), email =
Expand Down
4 changes: 2 additions & 2 deletions R/categorize.R
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ categorize<-
parameterVectorDoubleSigmoidal,
threshold_line_slope_parameter=0.01,
threshold_intensity_interval=0.1,
threshold_minimum_for_intensity_maximum=0.4,
threshold_minimum_for_intensity_maximum=0.3,
threshold_difference_AIC=0,
threshold_lysis_finalAsymptoteIntensity=0.75,
threshold_AIC=-10)
Expand Down Expand Up @@ -376,7 +376,7 @@ categorize_nosignal<-
function(parameterVectorLinear,
threshold_line_slope_parameter=0.01,
threshold_intensity_interval=0.1,
threshold_minimum_for_intensity_maximum=0.4)
threshold_minimum_for_intensity_maximum=0.3)
{
#************************************************
# First Part Define NA
Expand Down
2 changes: 1 addition & 1 deletion R/doublesigmoidalFitFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ f_mid2_doublesigmoidal <- function(parameterDf){
B2=parameterDf$slope2_Estimate ,
L=parameterDf$midPointDistance_Estimate);

mid2x <- stats::uniroot(f0mid, interval=c(argumentt,max_x*(3)),
mid2x <- stats::uniroot(f0mid, interval=c(argumentt,max_x*(2)),
tol=0.0001,
B1=parameterDf$slope1_Estimate,
M1=parameterDf$midPoint1_Estimate,
Expand Down
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

Package for single-cell virology.

We need some more description here, small change v2.
the package aims to quantify time intensity data by using sigmoidal and double sigmoidal curves. It fits straight lines, sigmoidal and double sigmoidal curves on to time vs intensity data. The all the fits together used to make decision between sigmoidal, double sigmoidal, no signal or ambiguous. No signal means the intensity do not reach to a high enough point or do not change at all. Sigmoidal means intensity start from a small number than climb to a maximum. Double sigmoidal means intensity start from a small number, climb to a maximum then starts to decay. After the decision between those four options, algorithm gives sigmoidal (or double sigmoidal) associated parameter values that quantifies the time intensity curve.
4 changes: 2 additions & 2 deletions inst/doc/Introduction.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<meta name="author" content="Vignette Author" />

<meta name="date" content="2017-03-10" />
<meta name="date" content="2017-03-15" />

<title>Vignette Title</title>

Expand Down Expand Up @@ -70,7 +70,7 @@

<h1 class="title toc-ignore">Vignette Title</h1>
<h4 class="author"><em>Vignette Author</em></h4>
<h4 class="date"><em>2017-03-10</em></h4>
<h4 class="date"><em>2017-03-15</em></h4>



Expand Down
98 changes: 98 additions & 0 deletions inst/doc/double_sigmoidal_vignette.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
## ----setup, include=FALSE------------------------------------------------
knitr::opts_chunk$set(echo = TRUE)

## ----install packages, echo=FALSE, warning=FALSE, results='hide',message=FALSE----

###*****************************
# INITIAL COMMANDS TO RESET THE SYSTEM
rm(list = ls())
if (is.integer(dev.list())){dev.off()}
cat("\014")
seedNo=14159
set.seed(seedNo)
###*****************************

###*****************************
require("sicegar")
require("dplyr")
require("ggplot2")
###*****************************

## ----generate data-------------------------------------------------------
time=seq(3,24,0.5)

#simulate intensity data and add noise
noise_parameter=0.1
intensity_noise=stats::runif(n = length(time),min = 0,max = 1)*noise_parameter
intensity=doublesigmoidalFitFormula(time,
finalAsymptoteIntensity=.3,
maximum=4,
slope1=1,
midPoint1=7,
slope2=1,
midPointDistance=8)
intensity=intensity+intensity_noise

dataInput=data.frame(intensity=intensity,time=time)

## ----time normalization, eval=FALSE--------------------------------------
# timeRatio=max(timeData); timeData=timeData/timeRatio

## ----intensity normalization, eval=FALSE---------------------------------
# intensityMin = min(dataInput$intensity)
# intensityMax = max(dataInput$intensity)
# intensityRatio = intensityMax - intensityMin
#
# intensityData=dataInput$intensity-intensityMin
# intensityData=intensityData/intensityRatio

## ----normalize_data------------------------------------------------------
normalizedInput = sicegar::normalizeData(dataInput = dataInput,
dataInputName = "Sample001")

## ----normalized_data_output----------------------------------------------
head(normalizedInput$timeIntensityData) # the normalized time and intensity data
print(normalizedInput$dataScalingParameters) # the normalization parameters that is needed to go back to original scale
print(normalizedInput$dataInputName) # a useful feature to track the sample in all the process

## ----plot raw and normal data, echo=FALSE, fig.height=4, fig.width=8-----
dataInput %>% dplyr::mutate(process="raw")->dataInput2
normalizedInput$timeIntensityData %>%
dplyr::mutate(process="normalized")->timeIntensityData2
dplyr::bind_rows(dataInput2,timeIntensityData2) -> combined
combined$process <- factor(combined$process, levels = c("raw","normalized"))

ggplot2::ggplot(combined,aes(x=time, y=intensity))+
ggplot2::facet_wrap(~process, scales = "free")+
ggplot2::geom_point()

## ----doublesigmoidalfit_data---------------------------------------------
parameterVector<-sicegar::doublesigmoidalFitFunction(normalizedInput,tryCounter=2)

# Where tryCounter is a tool usually provided by sicegar::fitFunction when the sicegar::sigmoidalFitFunction is called from sicegar::fitFunction.

# If tryCounter==1 it took the start position given by sicegar::fitFunction
# If tryCounter!=1 it generates a random start position from given interval

## ----parameter vector----------------------------------------------------
print(t(parameterVector))

## ----plot raw data and fit, fig.height=4, fig.width=8--------------------
intensityTheoretical=
sicegar::doublesigmoidalFitFormula(
time,
finalAsymptoteIntensity=parameterVector$finalAsymptoteIntensity_Estimate,
maximum=parameterVector$maximum_Estimate,
slope1=parameterVector$slope1_Estimate,
midPoint1=parameterVector$midPoint1_Estimate,
slope2=parameterVector$slope2_Estimate,
midPointDistance=parameterVector$midPointDistance_Estimate)

comparisonData=cbind(dataInput,intensityTheoretical)

require(ggplot2)
ggplot2::ggplot(comparisonData)+
ggplot2::geom_point(aes(x=time, y=intensity))+
ggplot2::geom_line(aes(x=time,y=intensityTheoretical))+
ggplot2::expand_limits(x = 0, y = 0)

Loading

0 comments on commit 50ee454

Please sign in to comment.