Friday, May 10, 2013

Solving the Transcendental equation by matlab.

example:

TO solve:

cos(x)*cosh(x)+1=0


Matlab commands:

f = @(x) cos(x)*cosh(x) + 1;
fzero(f,2)


reference:

http://www.mathworks.com/help/matlab/ref/fzero.html

Thursday, April 25, 2013

Installed postfix, but no qshape? (CC)


Here’s a simple one…
I installed a new FC12, and postfix, using “yum install postfix”. Afterward, after configuring main.cf, postfix ran fine through our simple testing, so I put it in service on a limited basis. However, once we started using it, qshape failed, with an error indicating it was not found.
It took me a couple of hours of my poor google skills to find the answer, so hopefully, if you find yourself in the same pickle, you can use this and it will help you.
First, separately install all the perl packages with this command:
“yum groupinstall perl development”  once you have that all done, (and here’s the magic) run:
“yum install postfix-perl-scripts”.
I know, qshape is *supposed* to be installed with postfix.  Only it wasn’t. and it took me all morning to figure out how to get it in there….
…..It worked for me.

Wednesday, April 24, 2013

Blog for Linux System Administrators. : Sendmail vs Postfix vs Qmail vs Exim

Blog for Linux System Administrators. : Sendmail vs Postfix vs Qmail vs Exim: We have choice in using MTA in linux. We can use sendmail, postfix, qmail or exim. The selection of MTA depends on many factor such as follo...

Thursday, April 11, 2013

Process NIH GEO GSE data by geoQuery

How to get an Expression value table of a GSE* file from GEO website.

for example: GSE33147

>g = getGEO("GSE33147")

......

it may download a series data matrix file: GSE33147_series_matrix.txt.gz
then load the dat again:
>g = getGEO(filename="GSE33147_series_matrix.txt.gz")

check the data

>class(g)

get the ExpressionSet:

> e = as(g, "ExpressionSet")

get the data table
> f = exprs(e)

save:
> write.csv(f, file="***")

load the group gene names that you want: (assume you only want part of them)
the names are stored in file "top60.csv"
>genes = read.csv("top60.csv",header=T)

the genes are factors, we need change them to character,
> cgenes = as.character(genes[,1])               //the first column.

>

Wednesday, April 10, 2013

Processing Microarray data by using R and Bioinductor

Load all the .CEL.gz file from a folder:

>library(affy)
>data <- ReadAffy()

## For Affymetrix data, there is no concept of RAW data.
See page 72 of DNA microarray data analysis using Bioconductor.

Now get the RMA data
> data.rma <- rma(data)

or you can use the following if the size of data is too large.

>data.rma <- justRMA(data)


change the RMA result to expression values
data.e <- exprs(data.rma)

save the data.e
write.csv(data.e,file="data.csv")

##now process the data and map probe ID to gene ID
##by any script language ....such as python


now load the processed data to R again:
d <- read.table("processed_data.csv",header=T,sep=",")

now d is a string matrix, make it to float

df <- data.frame(d,row.names=1)    ## use the first column as name

calculate the mean and append to df

df$mean <- rowMeans(df)

ranking

dfr <- df[order(-df$mean),]

save the highest 60 to a .csv file

write.csv(dfs[1:60,],file="d60.csv",sep=",")


Tuesday, February 19, 2013

upgrade Ubuntu OS




sudo apt-get install update-manager-core
sudo vi /etc/update-manager/release-upgrades
change the line below from prompt=lts to prompt=normal.
sudo apt-get update && sudo apt-get upgrade
sudo do-release-upgrade







Thursday, December 13, 2012

Multiple interface on same network are using same NIC for communication


Multiple interfaces on the same subnet

In the Linux implementation of the IP stack a IP address belongs to the host event though the administrator configures it on a devices. This can cause somewhat unexpected behaviour when multiple interfaces are configured to use the same network.

The network

 {network A}
            \       +--------------+
             -(eth0)| Linux server |
                    +--------------+
                     (eth2)  (eth3)
                       |       | 
                      {Network B}
When multiple interfaces are configured for the same network you must use policy routing to make the internal IP stack route the packages out on the designated interface. This is done by using the "ip route" command.

Prerequisites

The following options must be enabled in the kernel.
CONFIG_IP_ADVANCED_ROUTER=y
CONFIG_IP_MULTIPLE_TABLES=y
CONFIG_IP_ROUTE_FWMARK=y
CONFIG_IP_ROUTE_MULTIPATH=y
CONFIG_IP_ROUTE_VERBOSE=y
CONFIG_NETLINK_DEV=y
You also need the iproute suite, also known as iproute2. In Debian (and Debian derivatives) this is the iproute package.

Example configuration for two interfaces on the same IP subnet


In Debian (and Debian derivatives) the easiest way to add the additional routes on start-up is to use the up option in /etc/network/interfaces.
auto eth2
iface eth2 inet static
   address 192.168.1.20
   network 1192.168.1.0
   netmask 255.255.255.0
   broadcast 192.168.1.255
   up ip route add 192.168.1.0/24 dev eth2 proto kernel scope link src 192.168.61.20 table 20
   up ip route add default via 192.168.1.1 dev eth2 table 20
   up ip rule add from 192.168.1.20 lookup 20
 
auto eth3
iface eth3 inet static
   address 192.168.1.21
   network 192.168.1.0
   netmask 255.255.255.0
   broadcast 192.168.1.255
   up ip route add 192.168.1.0/24 dev eth3 proto kernel scope link src 192.168.61.21 table 30
   up ip route add default via 192.168.1.1 dev eth3 table 30
   up ip rule add from 192.168.1.21 lookup 30
Note:The table id is just a positive integer in the range 0-255 that identifies a unique table. When setting up multiple interfaces on the same subnet this id needs to be unique for each interface. In the example the interface number times 10 is used. Table id 0 and 253-255 are reserved for internal use and may not be used for this configuration.
For more information about advanced Linux routing please see read the Linux Advanced Routing & Traffic Control HOWTO.
Book tip: "Linux Network Internals"


another example:

Multiple interface on same subnet same machine can work fine. 
we need to use advance routing concepts with arp_filter option, make table for each interface and configure default routes and lookups. following three magic lines solved my problem.

Code:
ip route add 10.209.192.0/22 dev eth1 proto kernel scope link src 10.209.193.131 table tlb_1
ip route add default via 10.209.192.1 dev eth1 table tlb_1
ip rule add from 10.209.193.131 lookup tlb_1
ip route flush cache