This script describes a way to run multiple serial jobs on clusters.
#PBS -N serial.analysis
#PBS -j oe
#PBS -l walltime=4:00:00,nodes=22:ppn=16,gres=widow2
cd $PBS_O_WORKDIR
date
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PBS_O_WORKDIR
sort $PBS_NODEFILE | uniq > ./TEMP.NODEFILE
n=`wc -l ./TEMP.NODEFILE |awk '{print $1}'`
for((i=1;i<=$n;i++)); do j=`expr $i - 1`; sed -n ''$i','$i'p' ./TEMP.NODEFILE > host.$j; done
$MPI -np 1 --hostfile host.0 $NAMD ./w1_md3_resid_100.namd > ./w1_md3_resid_100.namd.out &
$MPI -np 1 --hostfile host.0 $NAMD ./w1_md3_resid_101.namd > ./w1_md3_resid_101.namd.out &
....
$MPI -np 1 --hostfile host.0 $NAMD ./w1_md3_resid_174.namd > ./w1_md3_resid_174.namd.out &
$MPI -np 1 --hostfile host.1 $NAMD ./w1_md3_resid_175.namd > ./w1_md3_resid_175.namd.out &
....
$MPI -np 1 --hostfile host.1 $NAMD ./w1_md3_resid_246.namd > ./w1_md3_resid_246.namd.out &
$MPI -np 1 --hostfile host.2 $NAMD ./w1_md3_resid_247.namd > ./w1_md3_resid_247.namd.out &
$MPI -np 1 --hostfile host.2 $NAMD ./w1_md3_resid_251.namd > ./w1_md3_resid_251.namd.out &
..
and so on.
This web log is my online notebook for software tips and hacks to make my life and hopefully that of someone else just a little bit easy. Should you find any mistakes or have any useful suggestions, please do not hesitate to write to me. Peace! Pavan Ghatty
Friday, May 27, 2011
Friday, May 6, 2011
Conditional plots in R
This link says it all.
Al - 19 Jan 2007 15:33 GMT
Hi!
Given a 1000x2 matrix x, i.e. 1000 2d-points. How can I directly (!)
plot/visualize only those which fulfill a certain condition, say
x[,1]>0 & x[,2]>0?
Thanks,
Al
Given a 1000x2 matrix x, i.e. 1000 2d-points. How can I directly (!)
plot/visualize only those which fulfill a certain condition, say
x[,1]>0 & x[,2]>0?
Thanks,
Al
> Hi!
> Given a 1000x2 matrix x, i.e. 1000 2d-points. How can I directly (!)
> plot/visualize only those which fulfill a certain condition, say
> x[,1]>0 & x[,2]>0?
> Thanks,
> Al
> Given a 1000x2 matrix x, i.e. 1000 2d-points. How can I directly (!)
> plot/visualize only those which fulfill a certain condition, say
> x[,1]>0 & x[,2]>0?
> Thanks,
> Al
First, R specific programming queries are best posted to the r-help
list. More information at:
http://www.r-project.org/
under the Mailing Lists link.
Second, the easiest way to do this is to subset the data while using
plot.formula(), which is a plot method that will be dispatched if the
first argument to plot() is a formula, such as 'y ~ x'. See ?plot and
?plot.formula for more information.
As an example, let's create a data frame with 2 columns and 1000 rows,
each column comprised of 1000 random normal deviates:
DF <- data.frame(x = rnorm(1000), y = rnorm(1000))
> str(DF)
'data.frame': 1000 obs. of 2 variables:
$ x: num -0.0265 0.1554 -0.1050 -0.9697 -0.3430 ...
$ y: num 1.386 -1.356 -1.170 0.426 0.204 ...
Now, let's plot the data meeting the criteria you indicated above:
plot(y ~ x, data = DF, subset = (x > 0) & (y > 0))
This says to generate a scatter plot, using 'DF' as the input data set,
and specifying the logical subset where x and y are both > 0. Modify
the subset argument as you require.
Note that in this usage, the 'data' argument must be a data frame. So
you could coerce your matrix (if needed) by using:
DF <- as.data.frame(matrix)
HTH,
Marc Schwartz
$ x: num -0.0265 0.1554 -0.1050 -0.9697 -0.3430 ...
$ y: num 1.386 -1.356 -1.170 0.426 0.204 ...
Now, let's plot the data meeting the criteria you indicated above:
plot(y ~ x, data = DF, subset = (x > 0) & (y > 0))
This says to generate a scatter plot, using 'DF' as the input data set,
and specifying the logical subset where x and y are both > 0. Modify
the subset argument as you require.
Note that in this usage, the 'data' argument must be a data frame. So
you could coerce your matrix (if needed) by using:
DF <- as.data.frame(matrix)
HTH,
Marc Schwartz
And this is the way (ex.) to get the length of the array that satisfies the conditions.
sum((x > 0) & (y > 0), na.rm=TRUE)
Wednesday, May 4, 2011
Custom replacements in VI
Thanks to Steve for this pearl of VI wisdom.
For search and replace operation in VI, parenthesis remembers the item. This can be used for custom replacements later. Try the command below on a file with this data:
29 5 2010
30 6 2011
:1,$s/[0-9]* \([0-9]*\) \([0-9]*\)/\2 \1/
VI can remember 9 such fields.
For search and replace operation in VI, parenthesis remembers the item. This can be used for custom replacements later. Try the command below on a file with this data:
29 5 2010
30 6 2011
:1,$s/[0-9]* \([0-9]*\) \([0-9]*\)/\2 \1/
VI can remember 9 such fields.
Subscribe to:
Posts (Atom)