shell scripting for extracting input from different directorires
I have two input data files ‘input1’ and ‘input2’ with same name (different values) in different directories like dir1, dir2, dir3, dir4. I have to take these two input files from each directory one at a time (i.e, first inputs from dir1; after final ouput; same process for dir2; etc) to execute the following shells ‘t1prog’ and ‘t2prog’. The output of these two shells ‘t1out’ and ‘t2out’ is input to java program named as ‘RNA’. I placed these three statements in a shell like ‘RNA final’. When I run this shell, final output is coming from Java program.
SHELL SCRIPT FOR MAKING THIS THREE STATEMENTS IN A LOOP LIKE ACCEPTING INPUTS (input1 and input2) FROM EACH DIRECTORY ONE AFTER ANOTHER and execute the two shells ‘t1prog’ and ‘t2prog’, redirect their outputs to ‘t1out’ and ‘t2out’ and run the java program and redirect the final output to a new file ‘RNA out’ for each directory inputs i.e., ‘RNAout’ is output file for input from dir1; ‘RNAout1’ is output file for input from dir2; so on. Code:
Sh t1prog > t1out (presently I am given ‘done<input1’ inside this |
While it was a different kind of coding, I was working on something similar that once I hit very large data sets I had to change my coding to optimize searches. Not quite what you are looking for but may still be useful.
http://forums.theplanet.com/index.ph...dpost&p=605109 |
Quote:
It might help if you
|
Shell scripting
I written two shell scripts named 't1prog' and 't2prog' and executed these two by giving the input inside the program (done < input1 for t1prog and done < input2 for t2prog). I am redirecting the output from t1prog to 't1out' and t2prog to 't2out'. Third, I written a java program which takes 't1out' and 't2out' as input (inside the program) and give the final ouput. This entire process from the beginning I am doing in a directory 'dir1' where my data files 'input1' and 'input2' are placed.
I NEED A SHELL SCRIPT TO PUT THESE THREE ACTIVITIES IN A LOOP LIKE 1. Accepting 'input1' from Dir1 and read by 't1prog' automatically 2. Run the shell script 't1prog' and redirect the output to 't1out' 3. Accepting 'input2' from Dir1 and read by 't2prog' automatically 4. Run the shell script 't2prog' and redirect the output to 't2out' 5. Run the java program 'java RNA' and redirect its output to 'RNA1out' After executing the above 5 steps and the shell has to take the inputs from 'dir2' directory (because the filenames are same and format same; values different)do the 5 steps and redirect the output after 5th step to 'RNA2out'. Like this it has to accept the input from each directory, repeat 5 steps above and redirect the output to sepearte output file like 'RNAoutnout'. All directories named as 'dir1' 'dir2' dir3' like this. All these are placed in a single directory 'RNA'. PLS WRITE A SHELL SCRIPTING FOR THIS WHICH IS ESSENTAIL IN MY BIOINFORMATICS RESEARCH. THANKS IN ADVANCE. Quote:
|
I am herewith posting all the details. kindly help me.
The two shell scripts (t1prog and t2prog) are given below they are working fine. The input for the first program is 't1.det' and for second program is 't1.rnaml'. These two input files are in 'dir1' folder. I am executing the shell like 'sh t1prog > t1out' and 'sh t2prog > t2out' from this directory only. Then I am executing a java program 'java RNA'; for this, t1out and t2out are input files used in the program and I am getting the final output on screen. The input files 't1.det' and 't1.rnaml' are in different folders with same name and with different values. Each folder specifies one gene sequence input files. In 'mfold' directory there are 5 directories and each directory contains these input files (t1.det and t1.rnaml)as shown below cd mfold dir1 dir2 dir3 dir4 dir5 cd dir1 t1.det t1.rnaml cd .. cd dir2 t1.det t1.rnaml (like this in all directories) I requesting you to please help me in shell script to automate this process like 't1prog' and 't2prog' first take the inputs from dir1 folder, run the shell and redirect the output to 't1out' and 't2out' and after executing the java program with statment 'java RNA' the output will be redirected to a file like 'RNAout1'. Then takes the inputs from dir2 folder, same process again, and redirect the output to 'RNAout2'. Like this for all inputs values from 5 folders. Modify the two shell scripts given below, to accept the inputs in that way shell 1: t1prog 1. #!/bin/bash 2. PrintVal() { C=${C#*(}; C=${C%)*}; echo $C | sed 's/).*( /-/'; } 3. while IFS=':=' read A B C 4. do 5. case $(echo $A) in 6. Initial*) 7. ((NotFirst)) && { echo; echo; } || NotFirst=1 8. echo ${B#* }; echo 9. Hairpins=0 10. ;; 11. 12. Hairpin*) 13. ((Hairpins==0)) && echo "$A:" 14. PrintVal 15. ((Hairpins++)) 16. ;; 17. Multi-loop) 18. echo "$A:" 19. PrintVal 20. ;; 21. esac 22. done <t1.det shell 2: t2prog #!/bin/sh i=1 while read line do freecount=`echo "${line}" | grep -i "free" | wc -l` poscount=`echo "${line}" | grep -i "position" | wc -l` if [ $freecount -eq 1 ] then rangeoutput=0 else rangeoutput=1 fi if [ $rangeoutput -eq 0 ] then value=`echo "${line}" | sed -n 's/<.*>\(.*\)<.*>/\1/p'` echo $value else if [ $poscount -eq 1 ] then pvalue[$i]=`echo "${line}" | sed -n 's/<.*>\(.*\)<.*>/\1/p'` if [ $i -eq 2 ] then echo "${pvalue[1]} - ${pvalue[2]}" i=0 fi i=`expr $i + 1` fi fi done <t1.rnaml ----------------------------- for one input set in 'dir1' i am executing like this with the above two scripts. sh t1prog > t1out sh t2prog > t2out java RNA for inputs in different directories and executing these and redirecting the final ouput after executing 'java RNA' statement to a file is needed. PLS. KINDLY HELP ME WHICH IS VERY ESSENTAIL FOR ME. THANKING YOU Quote:
|
Everyone at LQ is a volunteer, free to help you or not as they choose.
CAPITAL LETTERS usually denote heavy emphasis or shouting on bulletin boards, thus your "PLS. KINDLY HELP ME WHICH IS VERY ESSENTAIL FOR ME. THANKING YOU" could be taken as demanding -- which is more likely to put people off answering than encourage them. It also helps us understand if you use code tags (that's a link to instructions or you may prefer to use "Advanced Edit" which has a # button to insert code tags. Another very useful (and easy) technique for explaining what you are doing is to copy and paste from a terminal emulator, into code tags to show us what you have done. Your Quote:
Code:
c@CW8:/tmp$ cd mfold As I understand it the directory+file hierarchy relative to the mfold directory is (this is output from the tree command): Code:
. Code:
#!/bin/bash |
Shell scirpting
When I run the script I am getting the following errors. The shell processing the input in 'dir1' and generating two output files t1out and t2out. It is not processing for inputs in 'dir2'. For each folder output i.e., t1out and t2out Java program has to be executed and it has to redirect the output to a folder. That is also not working. I am herewith submitting my java program also. . When I am executing single data set 't1out' and 't2out'(using the following code) Java program is running successuflly and giving output.Pls help me. I am in confusion
sh t1prog > t1out sh t2prog > t2out java RNA -------------------------------------------------------------------------- errors: Processing in the /users/rsankar/rna/mfold/dir1 directory Exception in thread "main" java.lang.NoClassDefFoundError: RNA Caused by: java.lang.ClassNotFoundException: RNA at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) Quote:
|
Quote:
|
All times are GMT -5. The time now is 04:51 AM. |