Tuesday, June 18, 2013

Molecular number and noises using coefficient of variation -> diploid cells are more robust than haploid cells

Diploid cells are more robust than haploid cells.

Diploid cells are generally considered more robust than haploid cells. If we use binomial distribution to model the stochastic variation in the n number of molecules as a source gene expression noises, the coefficient of variation (CV) can be calculated from standard deviation divided by mean: 
                sqrt(np(1-p)) / np  = 1/ sqrt(np/(1-p) ~ 1/sqrt(n)
Hence, doubling the numbers of molecules in diploid cells will reduce CV by sqrt(2). Because small CV indicate less noisy and more robustness, diploid cells are sqrt(2) more robust than haploid cells. Similar argument was put by Schroedinger in 1944.

For binomial distribution, mean = np. Variance = np(1-p). Standard deviation = sqrt(np(1-p)). So, 
  CV = stddev / mean 

CV is basically the inverse of the signal-to-noise ration. 



References:
http://www.mathsisfun.com/data/standard-deviation.html
http://en.wikipedia.org/wiki/Standard_deviation
http://en.wikipedia.org/wiki/Coefficient_of_variation

Monday, June 17, 2013

gsub and strplit on vector of names

#I want to remove '_alpha' in this list
myInput = c( "afg3_alpha", "alg12_alpha", "dbp3_alpha",  "elp4_alpha",  "fob1_alpha",  "gpr1_alpha")

#my current solution

tmpsplit = strsplit(myInput, '_')
tmp = NA
for (item in tmpsplit){
  tmp = c(tmp, item[1])
}
results1  = tmp[-1];   
#this is what I need, but I want a better solution. 

#Here is what I come up with, but it is pretty awkward

tmp3 = lapply(myInput, FUN=function(x){strsplit(x, '_')[[1]][1]})
results2 = unlist(tmp3)

#gsub is the best solution
gsub("_.*", "", myInput)


R plot in bold font


tiff("lnR-G-diploid-20130617.tif",width=480,heigh=480)
par(font=2)
plot( log(tb$a) ~ tb$b, pch=19, col='blue', xlim=c(0.05, 0.22),ylim=c(-8,-3.5),xlab="G",ylab="lnR") 
text( tb$b*1.02, log(tb$a*1.1), as.character(tb$strain ) )
dev.off()


Github, Qin06EXG data, using a Snow Leopard laptop


First I created a repository on Gibhut https://github.com/hongqin/Qin06EXGData

Then I cloned the repository to laptop: /Users/hongqin/github/Qin06EXGData-master

$mv ../qinexg06data.local/* .
$ ll
total 8
drwxr-xr-x  20 hongqin  staff   680B Dec 16  2011 101S
drwxr-xr-x  20 hongqin  staff   680B Dec 16  2011 BY4743
drwxr-xr-x  18 hongqin  staff   612B Dec 16  2011 M1-2
drwxr-xr-x  19 hongqin  staff   646B Dec 16  2011 M13
drwxr-xr-x  18 hongqin  staff   612B Dec 16  2011 M14
drwxr-xr-x  19 hongqin  staff   646B Dec 16  2011 M2-8
drwxr-xr-x  18 hongqin  staff   612B Dec 16  2011 M22
drwxr-xr-x  18 hongqin  staff   612B Dec 16  2011 M32
drwxr-xr-x  18 hongqin  staff   612B Dec 16  2011 M34
drwxr-xr-x  27 hongqin  staff   918B Dec 16  2011 M5
drwxr-xr-x  20 hongqin  staff   680B Dec 16  2011 M8
drwxr-xr-x  16 hongqin  staff   544B Dec 16  2011 PSY316
-rw-r--r--@  1 hongqin  staff    78B Jun 17 12:09 README.md
drwxr-xr-x  22 hongqin  staff   748B Dec 16  2011 RM112N
drwxr-xr-x  22 hongqin  staff   748B Dec 16  2011 SGU57
drwxr-xr-x  18 hongqin  staff   612B Dec 16  2011 SK1
drwxr-xr-x  18 hongqin  staff   612B Dec 16  2011 W303
drwxr-xr-x  18 hongqin  staff   612B Dec 16  2011 YPS128
drwxr-xr-x  23 hongqin  staff   782B Dec 16  2011 YPS163

$git init

$ git remote add origin https://github.com/hongqin/Qin06EXGData.git

$ git add *
$ git commit -m "qin06exg"
# A lot of things showed up on the screen, including subdirectory files. 
$$ git commit -m "qin06exg"
[master (root-commit) f11f5a4] qin06exg
 345 files changed, 84504 insertions(+)
 create mode 100755 101S/.RData
 create mode 100755 101S/.Rhistory
 create mode 100755 101S/060805.101S.rls.tab
 create mode 100755 101S/091904.101S.rls.tab
 create mode 100755 101S/101S.boot.dat

 create mode 100755 101S/101S.merged
 ... .... ...

$ git push --force origin master 
Counting objects: 251, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (247/247), done.
Writing objects: 100% (251/251), 638.97 KiB, done.
Total 251 (delta 15), reused 0 (delta 0)
To https://github.com/hongqin/Qin06EXGData.git

 + d37a505...f11f5a4 master -> master (forced update)


Thursday, June 13, 2013

Survivor function for binomial mortality function

June 20, 2013, This is actually wrong. I cannot believe that I made a mistake in the basic calculus.  

Notes, intro to modeling, Nimbios REU, day 2

S<-->I is introduced using matrix.

S(t+1) = 0.9 S + 0.2 I
I(t+1) = 0.1S + 0.8 I

[S(t+1), I(t+1)]^T = [(0.9, 0.1)^T, (0.2, 0.8)^T] [S, I]

X = A X for equilibrium, and eigen value will be found.


Leslie matrix model is introduced using locust with  3 stages: egg, nymph, adult. This simple case actually oscillates.

----------
Differential equations

dx/dt = r x ( 1 - x/K)    logistic growth

dx/dt = r x (K-x) ( x-b)     Allee effect


Two interacting populations (predator prey model)
 dx/dt = a x - bxy
 dy/dt = cxy - dy

More on disease models:
  S-I-R model
I can be infected or immune
R can be recovered (immue) or removed.

Discussion focused on SIR without demographics (no birth or death).

R0 basic reproduction ratio is introduced.


SIR with waning immunity
  dS/dT = - beta SI + gamma R
  dI/dt = beta SI- v I
  dR/dt = vI - gamma R

SEIR (E for exposed, latent, not able to transmit disease)


Student group exercise is to model 3 population:
 pop1: logistic growth
 pop2: gowth with Allee effect
 pop3: exponential growht
 pop1 and pop2 compete with each other. Pop 3 cooperate with the other two populations.








Wednesday, June 12, 2013

Modeling positive and negative gene interactions in network reliability model

In Costanzo10's paper, there are positive and negative genetic interactions that indicate antagonizing and cooperative functions of the two genes involved, respectively. The extreme case negative gene interaction is synthetic lethality.  Synthetic lethality can be modeled by parallel configuration. Positive/Antagonizing interactions may be modeled by state vectors of the nodes involved. In fact, state vector is a general way for network modeling.

Bibtex, reliability and network (in progress)


Title: Network Reliability
Authors: Ball, Michael O.
Colbourn, Charles J.
Provan, J.S.
Department/Program: ISR
Type: Technical Report
Keywords: algorithms, combinatorics, computational complexity, graph theory, reliability, network reliability, networks, Systems Integration
Issue Date: 1992
Series/Report no.: ISR; TR 1992-74
Abstract: This paper provides a detailed review of the state of the art in the field of network reliability analysis. The primary model treated is a stochastic network in which arcs fail randomly and independently with known failure probabilities. The inputs to the basic network reliability analysis problem consist of the network and a failure probability for each are in the network. The output is some measure of the reliability of the network. The reliability measures treated most extensively in this paper are: the two terminal measure, the probability that there exists a path between two specified nodes; the all-terminal measure the probability that the network is connected and the k-terminal measure, the probability that a specified node subset, K, is connected. In all cases the results concerning each problem's computational complexity, exact algorithms, analytic bounds and Monte Carlo methods are covered. The paper also treats more complex reliability measures including performability measures and stochastic shortest path, max flow and PERT problems. A discussion is provided on applications and using the techniques covered in practice.
URI: http://hdl.handle.net/1903/5255
Appears in Collections:Institute for Systems Research Technical Reports

@ARTICLE{4335422,
author={Ball, M.O.},
journal={Reliability, IEEE Transactions on},
title={Computational Complexity of Network Reliability Analysis: An Overview},
year={1986},
volume={35},
number={3},
pages={230-239},
abstract={This paper presents an overview of results related to the computational complexity of network reliability analysis problems. Network reliability analysis problems deal with the determination of reliability measures for stochastic networks. We show how these problems are related to the more familiar computational network problems of recognizing certain subnetworks, finding optimal subnetworks, and counting certain subnetworks. We use these relationships to show that the k-terminal, the 2-terminal, and the all-terminal network reliability analysis problems are at least as hard as the renowned set of computationally difficult problems, NP-Complete. Finally, we discuss the impact of these results on how one should approach problem solving in this area.},
keywords={Algorithm design and analysis;Computational complexity;Computer network reliability;Computer networks;Educational institutions;Graph theory;Problem-solving;Reliability theory;Seismic measurements;Stochastic processes},
doi={10.1109/TR.1986.4335422},
ISSN={0018-9529},}



@INPROCEEDINGS{12999,
author={Ray, G. A. and Dunsmore, J. J.},
booktitle={INFOCOM '88. Networks: Evolution or Revolution, Proceedings. Seventh Annual Joint Conference of the IEEE Computer and Communcations Societies, IEEE},
title={Reliability of network topologies},
year={1988},
pages={842-850},
abstract={The authors present some analytical results which can be used to compute network reliability. Some simple techniques to make asymptotic approximations based on parameters of the network topology are derived. Explicit reliability formulae are computed for four network topologies, including the star and counterrotating ring. Actual manufacturer's data and failure models for laser diodes and LEDs are used to compare the effects of transmitter reliability on the whole network.<>},
keywords={computer networks;graph theory;network topology;reliability;LAN;LEDs;asymptotic approximations;counterrotating ring;failure models;laser diodes;network reliability;network topologies;network topology;reliability formulae;star topology;transmitter reliability;Communication networks;Computer aided manufacturing;Computer network reliability;Computer networks;Light emitting diodes;Network topology;Optical transmitters;Reliability theory;Telecommunication network reliability;Virtual manufacturing},
doi={10.1109/INFCOM.1988.12999},}


@ARTICLE{5220476,
author={Abraham, J.A.},
journal={Reliability, IEEE Transactions on},
title={An Improved Algorithm for Network Reliability},
year={1979},
volume={R-28},
number={1},
pages={58-61},
abstract={Boolean algebra has been used to find the probability of communication between a pair of nodes in a network by starting with a Boolean product corresponding to simple paths between the pair of nodes and making them disjoint (mutually exclusive). A theorem is given, the use of which enables the disjoint products to be found much faster than by existing methods. An algorithm and results of its implementation on a computer are given. Comparisons with existing methods show the usefulness of the algorithm for large networks.},
keywords={Algorithm design and analysis;Boolean algebra;Computer network reliability;Computer networks;Ducts;Fault trees;Telecommunication network reliability;Boolean expressions;Disjoint products;Reliability algorithm;Terminalpair reliability},
doi={10.1109/TR.1979.5220476},
ISSN={0018-9529},}




Reliability network equivalent approach to distribution systems reliability evaluation, R. Billongton, P. Wong

Reliability network equivalent approach to distribution systems reliability evaluation,
R. Billongton, P. Wong
IEE, Proc. Gener. Transm. Distrib. Vol 145, No2, March 1998

This paper grouped subnetwork into large blocks, which is similar to the way that I am modeling the interacting loci for QTL study.


Reliability model with repairs






Akinpelo's slides

Interacting loci and QTL in network model of aging



Complex system configuration can be addressed by state vectors.

See PPT slides of J. Akipelu.





Synthetical lethal pairs is equivalent to parallel components

The network survivor function S(t) is based on network structure function (see Leemis09, example 3.9 figure 3.9 on page72). Mortality rate (hazard rate) can be found by definition:  h(t) = -S' / dS .

$S_a$ and $S_b$ follow the Weibull model in earlier aging based on GG01.







System mortality rate for serial components

This explains that product of survivor function leads to summation of mortality rate (hazard function).

Basic rules in differential calculus


http://en.wikipedia.org/wiki/Category:Differentiation_rules

http://en.wikipedia.org/wiki/Chain_rule

http://en.wikipedia.org/wiki/Product_rule

http://en.wikipedia.org/wiki/Quotient_rule

Notes, discrete time modeling, NimbioS REU course, day 1

Dr. Suzanne Lenhart focused on discrete time model. 


She started with the population growth of Florida sandhill cranes. She stared with  a exponential growth in discrete steps. 


She emphasized that order of events is crucial in discrete models. 

She modifed the model to x(n+1) = 0.97 (x(n) + 5)
She explained stable models and equilibrium. 



She added logistical growth:
  x(n+1) = x(n) + R x(n) (1-x(n)/K)
where R is intrinsic growth rate.  Here a student explained the carrying capacity K. 
She then found the equilibrium population X_bar. 
She then asked students what are the unrealistic assumptions for logistical growth and discuss way to improve them. She suggested R and K can be time dependent. 


She gave another growth model (Allee model?)

x(n+1) = X(n) + R x(n) (1-x(n)/K)(x(n)-a),   0<a<K.
where $a$ is the critical mass. 


Lenhart gave a example of 'augmentation'. 
x_k+1 = x_k + r x_k (1- x_k / K1)    threatened population
y_k+1 = y_k + s y_k (1 - y_k /K2)    captive breed population

She asked students to work in groups to modify the model to "move a percentage of pop $y$ to $x$ 'instantly' at each time step. 
After about 5 minutes of discussion, Lenhart worked out solutions on the board. She used 'diagrams' to illustrate two ways to approach the problem: growth + then augment, augment + then growth. 

After 50 minutes, Lenhart started another example, vehicular stopping distance. 
This case asks students to estimate the distance in feet that car can travel in 2 second with speed at miles per hour.  One mile = 5280 feet and one hour = 3600 seconds. 
The final form for stop_distance consist of a reactive_distance (c1 * v) and a brake distance (c2 * v^2).  The brake distance is reasoned out by using force, moment, and physic principles.

Lenhart concluded the lecture with introducing gender to a population model.