This site is to serve as my note-book and to effectively communicate with my students and collaborators. Every now and then, a blog may be of interest to other researchers or teachers. Views in this blog are my own. All rights of research results and findings on this blog are reserved. See also http://youtube.com/c/hongqin @hongqin
Wednesday, September 25, 2013
BY diploid with the same mating factors (in progress)
Kaeberlein and Kennedy has a RLS paper using BY diploid with the same mating factor. Which paper is that?
Tuesday, September 24, 2013
ifelse logical mistake
The following codes has a logical mistake, and will not assign color by categories. The ifelse should be nested.
# tbomegaH2C1S1$color[i] = ifelse( tbomegaH2C1S1$CoatLocation[i]=="OuterCoat", 'red', tbomegaH2C1S1$color[i] )
# tbomegaH2C1S1$color[i] = ifelse( tbomegaH2C1S1$CoatLocation[i]=="InnerCoat", 'blue', tbomegaH2C1S1$color[i] )
tbomegaH2C1S1$color[i] = ifelse( tbomegaH2C1S1$coatflag[i]=="coat", 'red', tbomegaH2C1S1$color[i] )
tbomegaH2C1S1$color[i] = ifelse( tbomegaH2C1S1$essenflag[i]=="essential", 'black', tbomegaH2C1S1$color[i] )
# tbomegaH2C1S1$color[i] = ifelse( tbomegaH2C1S1$CoatLocation[i]=="OuterCoat", 'red', tbomegaH2C1S1$color[i] )
# tbomegaH2C1S1$color[i] = ifelse( tbomegaH2C1S1$CoatLocation[i]=="InnerCoat", 'blue', tbomegaH2C1S1$color[i] )
tbomegaH2C1S1$color[i] = ifelse( tbomegaH2C1S1$coatflag[i]=="coat", 'red', tbomegaH2C1S1$color[i] )
tbomegaH2C1S1$color[i] = ifelse( tbomegaH2C1S1$essenflag[i]=="essential", 'black', tbomegaH2C1S1$color[i] )
Survival probability of computer viruses is exponential
Romualdo Pastor-Satorras, Alessandro Vespianai, Physical Review Letters, 2001, Epidemic spreading in scale-free networks.
Saturday, September 21, 2013
GDP per capital by country, case study
Countries with small populations will have large sample variances, whereas countries with large population will have much smaller sample variances. There is a Ted talk on this, but I had not found the original video. I only remember it is from a population geneticist.
SEM = sigma / sqrt(sample_size)
R code for demo
world = rnorm(7.1E3) #world population 7.1 billion
china = sample(world, 1.1E3) #china 1.1 billion
c1 = sample(world, 20) #20 million pop for country c1
itr = 100
list.china = numeric(itr)
list.c1 = numeric(itr)
for( i in 1:itr){
list.china[i] = mean( sample(world, 1.1E3) )
list.c1[i] = mean(sample(world, 20) )
}
Reference:
http://ablog.typepad.com/keytrendsinglobalisation/2013/05/only-30-of-the-world-now-has-a-higher-gdp-per-capita-than-china.html
Ted video on GDP per capital by country.
SEM = sigma / sqrt(sample_size)
R code for demo
world = rnorm(7.1E3) #world population 7.1 billion
china = sample(world, 1.1E3) #china 1.1 billion
c1 = sample(world, 20) #20 million pop for country c1
itr = 100
list.china = numeric(itr)
list.c1 = numeric(itr)
for( i in 1:itr){
list.china[i] = mean( sample(world, 1.1E3) )
list.c1[i] = mean(sample(world, 20) )
}
Reference:
http://ablog.typepad.com/keytrendsinglobalisation/2013/05/only-30-of-the-world-now-has-a-higher-gdp-per-capita-than-china.html
Ted video on GDP per capital by country.
Thursday, September 19, 2013
behind the scene of Gibhub
output of 'ps -ef | grep git'
502 3074 86237 0 4:15PM ?? 0:00.00 git pull --rebase --progress --prune --recurse-submodules=on-demand origin
502 3075 3074 0 4:15PM ?? 0:00.01 /bin/sh /Applications/GitHub.app/Contents/Resources/git/libexec/git-core/git-pull --rebase --progress --prune --recurse-submodules=on-demand origin
502 3166 3075 0 4:16PM ?? 0:00.10 git fetch --progress --update-head-ok --prune --recurse-submodules=on-demand origin
502 3174 3166 0 4:16PM ?? 0:00.00 git gc --auto
502 3177 3174 0 4:16PM ?? 0:00.00 git repack -d -l
502 3178 3177 0 4:16PM ?? 0:00.01 /bin/sh /Applications/GitHub.app/Contents/Resources/git/libexec/git-core/git-repack -d -l
502 3191 3178 0 4:16PM ?? 0:00.00 /bin/sh /Applications/GitHub.app/Contents/Resources/git/libexec/git-core/git-repack -d -l
502 3192 3191 0 4:16PM ?? 0:19.38 git pack-objects --keep-true-parents --honor-pack-keep --non-empty --all --reflog --unpacked --incremental --local --delta-base-offset /Users/hqin/github/BacillusSporeCoat/.git/objects/pack/.tmp-3178-pack
502 3074 86237 0 4:15PM ?? 0:00.00 git pull --rebase --progress --prune --recurse-submodules=on-demand origin
502 3075 3074 0 4:15PM ?? 0:00.01 /bin/sh /Applications/GitHub.app/Contents/Resources/git/libexec/git-core/git-pull --rebase --progress --prune --recurse-submodules=on-demand origin
502 3166 3075 0 4:16PM ?? 0:00.10 git fetch --progress --update-head-ok --prune --recurse-submodules=on-demand origin
502 3174 3166 0 4:16PM ?? 0:00.00 git gc --auto
502 3177 3174 0 4:16PM ?? 0:00.00 git repack -d -l
502 3178 3177 0 4:16PM ?? 0:00.01 /bin/sh /Applications/GitHub.app/Contents/Resources/git/libexec/git-core/git-repack -d -l
502 3191 3178 0 4:16PM ?? 0:00.00 /bin/sh /Applications/GitHub.app/Contents/Resources/git/libexec/git-core/git-repack -d -l
502 3192 3191 0 4:16PM ?? 0:19.38 git pack-objects --keep-true-parents --honor-pack-keep --non-empty --all --reflog --unpacked --incremental --local --delta-base-offset /Users/hqin/github/BacillusSporeCoat/.git/objects/pack/.tmp-3178-pack
Greek letters and Latex formula in R (to be continuted)
I tried to add $\omega_s$ as axis label. It seems some extra work need to be done.
plot(1:3, ylab = expression("Diameter of apeture (" * mu ~ "m)"),
, xlab = expression("Force spaces with ~" ~ mu ~ pi * sigma ~ pi)
, main = expression("This is another Greek character with space" ~ sigma))
http://stackoverflow.com/questions/6044800/adding-greek-character-to-axis-title
http://stackoverflow.com/questions/1395105/getting-latex-into-r-plots
Konigsberg bridge problem is taught at the 4th grade in primary school in China
The Konigsberg 7 bridge problem is discussed in a 4-th grade math textbook in primary schools in China. This textbook is the training materials for Olympic Math competition, and has been used in mass.
Wednesday, September 18, 2013
Yi Jiang's note, 20130918
Yi Jiang's note:
I find out that these two methods are what we need to parse those huge XML files: cElementTree.iterparse() and ElementTree.iterparse().
(1) http://effbot.org/zone/celementtree.htm
(2) http://effbot.org/zone/element-iterparse.htm
Both can load a small piece of the XML file into the memory and then parse it, which prevents occupying too much memory resources. And the iterparse() method in cElementTree library is faster than that in ElementTree library.
There are two questions I need to figure out:
1. How to remove items.
once an item is parsed, it needs to be removed to release the memory. Things to be released not only include the content within the item, but also include the item itself. Also, we also need to remove those items that we are not interested in.
2. namespace
Some documents discussed on how to solve problems related to the namespace. I will try to figure out whether it will be a problem in our project.
I find out that these two methods are what we need to parse those huge XML files: cElementTree.iterparse() and ElementTree.iterparse().
(1) http://effbot.org/zone/celementtree.htm
(2) http://effbot.org/zone/element-iterparse.htm
Both can load a small piece of the XML file into the memory and then parse it, which prevents occupying too much memory resources. And the iterparse() method in cElementTree library is faster than that in ElementTree library.
There are two questions I need to figure out:
1. How to remove items.
once an item is parsed, it needs to be removed to release the memory. Things to be released not only include the content within the item, but also include the item itself. Also, we also need to remove those items that we are not interested in.
2. namespace
Some documents discussed on how to solve problems related to the namespace. I will try to figure out whether it will be a problem in our project.
Subscribe to:
Posts (Atom)