User Tools

Site Tools


users:guides:getting_structure_output

Getting Structure Output

The user Federica Lucati (flucati, responsible Marc Ventura) uses Structure with R with the library ParallelStructure. She needs the output of Structure (not the normal output that we usually receive because we only can see the R output).

After a long work searching how to save the outputs of the programs executed as R, Miguel downloades the source code of the ParallelStructure library.

He unpaccked the source tar.gz:

snippet.bash
# tar zxvf ParallelStructure_1.0.tar.gz

The file we were searching for is in ParallelStructure/R/parallelstructure.R:

Somewhere into the function it would be some call to Structure. Vualà:

217		#  wait before running the job (let time to re-new seed between jobs)
218		Sys.sleep(job$wait)
219		instr=paste(structure_path,'structure -m ',param_nam,sep='')
220		system(instr,ignore.stdout=T)

The first solution Miguel thinked was:

217		#  wait before running the job (let time to re-new seed between jobs)
218		Sys.sleep(job$wait)
219		instr=paste(structure_path,'structure -m ',param_nam, ' > structure_output.txt',sep='') # IMPORTANTE retocado el output
220		system(instr) #ignore.stdout=T)                                                         # omito ignore.stdout=T    

Then he paccked all again in a tar.gz and copied all to the proves machine (node16 in cc196).

# tar zcvf ParallelStructure_1.0.tar.gz ParallelStructure

Then, with aun unusual command, install the library:

/home/soft/R-3.4.3/bin/R

>install.packages("/home/soft/sources/ParallelStructure_1.0.tar.gz", repos = NULL, type="source")

He has some doubts that it works so easily, but in fact, it did it. He copied all the files he needed it to execute Structure and he installed the Structure program that it wasn't installed at node16 (/home/soft/console).

He retouch the paths from structure.R, structure.sh, he generated new joblists (as he explained here):

chmod +x structure.sh
./structure.sh

But there is some problem: everytime that we run the program overwrite the file, and we need to save one file per generated result. After talking with Xavi, I returned to the source code. Now I modified some lines before:

206     # generate parameted file for structure 
207	    param_nam=paste('parameter_job_',as.character(id),sep='')
(...)
219     instr=paste(structure_path,'structure -m ',param_nam,' > structure_output',as.character(id),'.txt', sep='')

After repeating all the process (pack the files, uninstall the library in R, reinstall). After that we have to generate all the joblists and remove the results directory (structure_results). And then yes, we have all the files generated.

Then we have to replicate into the cluster. He installed the library in R-3.4.3.

users/guides/getting_structure_output.txt · Last modified: 2018/06/18 12:19 by admins_ceab