#*/
#* Copyright (c) 2011 Gitanjali Yadav (gy@nipgr.res.in)
#* All rights reserved.
#*
#* Redistribution and use in source and binary forms, with or without
#* modification, are permitted without a fee provided that the following
#* conditions are met:
#*
#* 1. This software is only used for private, research, or academic 
#*    purposes.
#*    
#* 2. Redistributions of source code must retain the above copyright
#*    notice, this list of conditions and the following disclaimer.
#*
#* 3. Redistributions in binary form must reproduce the above copyright
#*    notice, this list of conditions and the following disclaimer in the
#*    documentation and/or other materials provided with the distribution.
#*
#* 4. Any changes made to this package must be submitted to the author.
#*    The legal status of the submitted changes must allow their inclusion
#*    into this package under this license.
#*
#* 5. Publications in the field of pseudorandom number generation, which
#*    made use of this package must include a reference to this package.
#*      
#* Any use of this software in a commercial environment requires a
#* written licence from the author. Contact Gitanjali Yadav
#* (gy@nipgr.res.in) to negotiate the terms.
#*
#* THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
#* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
#* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#* 
#* IN NO EVENT SHALL GITANJALI YADAV BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
#* INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES 
#* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR
#* NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
#* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
#* OF THIS SOFTWARE.
#*
#*/
#*
#*/
#*  get_node_perturbation 	For perturbation of a single node in the network 
#*
#*  Author:	Gitanjali Yadav (gy@nipgr.res.in)
#*
#*  Called from within 'run_single_perturbation'
#*/

#*/ Modification History:

#   11/01/01: First Version.
#   11/25/03: incorporate more measures into R
#   11/09/07: replaced /usr/local/bin/R by Rpath
#*/

sed 's/INODE/'"$1"'/' run_node_perturb.R >runnode_tmp.R
sed -n $1p DATA.nodes >iname
cp iname node_$1.iname
`cat Rpath` --no-restore --no-save --no-readline --slave < runnode_tmp.R >>R.out
sed 's/"/\n/g' node_$1.isolates | grep '[A-Z|a-z|0-9]' | sed '1d'   | grep -v '\[' >node_$1.secex
grep -w `cat iname` DATA.ncol >node_$1.ncol
grep -w `cat iname` DATA.stat | sed 's/\t/\n/g' | sed '1d'  >itmp6
paste attr.node itmp6 >node_$1.attr
sed 's/'"`cat iname`"'//' node_$1.ncol | sed 's/\t //g'  >node_$1.int
