I hope it will at least be a step in the direction you are attempting to go.
The following awk script may help you to create the data files. If you embed a call to awk followed by a call to invoke nonmem and loop over the records in your id data file you should be able complete your bootstrap.
I have only tested it in a limited fashion. Let me know if you need a copy of awk (for DOS). It is small (47k) and public domain.
#boot
# assume each set of IDs are in a record in a file called id.dat delimited with
# spaces e.g.
# 25 18 7 11 33 ...
# 8 10 17 1 22 ...
# assume original NONMEM input data file with ID in col 1 called nm.dat
#
# select record from id.dat to use by setting IDROW= to record number
#Usage:
# awk -f boot.awk -v DATA=nm.dat -v IDROW=1 id.dat
BEGIN {
IDCOL=1 # col number for ID in nm.dat
DELIM=" " # field delimiter in nm.dat
n=0 # counter to name each new NONMEM output file
}
NR==IDROW {
NMOUT="nmsamp.dat"
print "# IDs="$0 > NMOUT
ok=getline datrec < DATA
do {
split(datrec,data,DELIM)
id=data[IDCOL]
for ( i=1; i <= NF ; i++ ) {
if ( id == $i ) {
do {
print datrec >> NMOUT
ok=getline datrec < DATA
split(datrec,data,DELIM)
id=data[IDCOL]
} while ( id == $i && ok > 0 )
i = NF*2 # force exit from for loop
}
}
if ( i == NF+1 ) ok=getline datrec < DATA
} while ( ok > 0 )
close(DATA)
close(NMOUT)
}
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.