Shell scripting for this sequence


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell scripting for this sequence
# 1  
Old 10-12-2010
Power Shell scripting for this sequence

KINDLY HELP ME FOR SHELL SCRIPTING FOR THIS TASK.

My input file consists of thousands of sequence in this format. The given input file consists of four sequences which are starting with ‘>’ symbol (each sequence shown in different colour for easy understanding). I have to use a command at $ prompt like mfold seq=’filename’. If the file consists of one sequence it is working well because for each sequence it generates ‘n’ number of files.

My request is how to process all these sequences one by one in the above command by giving the filename in that command and the output for each sequence to be redirect to one directory like dir1, dir2, dir3, dir4 (four directories for these four sequences outputs) because the output of each sequence consists of ‘n files.

Code:
>Chr8:86884850-86884997
TCCCTGGACATTCTCTTCACTGTGGGATGAGGTAGTAGGTTGTATAGTTTTAGGGTCACA
CCCACCACTGGGAGATAACTATACAATCTACTGTCTTTCCTAAGGTGATAGAAAAATCTG
CATCCAAACAACCTCACACAGTTGATAA
>ChrX:96383583-96383703
TAAAACTATACAATCTACTACCTCATCCCACAGAGCACCAGTGTTCATCTTCAGTCTACT
TGGGCCAGCTACTTGGGTCAGGAAAAAGAATCAACCAATAATTAGCAAGAAGGAAAAATGG
>Chr15:33347613-33347720
TAAACTATACAACCTACTACCTCAACCTGGGAGCATGCAGTCACAATGGCTGGAAAGCTA
CCGTTTCTTAAGCAATGAAATTACAAGTTAGTCTTATAATTGTTCTTC
>Chr25:33347623-33347720
TACACATTTAATACGGGAAGATTATCACCACAAAATCTTTCTTGTTGCCAAGTCTAACAC
AAAAGGCTCTATAGACACTTGACGTGTGGCTACTTAGC


Last edited by radoulov; 10-12-2010 at 04:45 PM.. Reason: Code tags, please!
# 2  
Old 10-12-2010
This want to be a solution for your problem
Code:
awk -F\> '/>/{++d;system("mkdir "d)}NF{print > (d"/"$NF)}' file

however if you expect something else please post the required output base on original data sample.
This User Gave Thanks to danmero For This Post:
# 3  
Old 10-12-2010
How about this awk script (process.awk):

Code:
BEGIN {
   FS=">";RS=">";ORS="";
}
$NF { d++
  system("mkdir dir"d);
  print ">"$0 > ("dir"d"/input");
  system("cd dir"d"; mfold seq=input");
}

run it with:
Code:
$ awk -f process.awk inputfile

This User Gave Thanks to Chubler_XL For This Post:
# 4  
Old 12-04-2010
awk process modification

Respected Sir,
I added some lines to the process and executing. My input file contains 5000 sequences. This program executing 1020 times. after that it is giving awk : 6: fatal error. Modification to run for 5000 times is highly appreciated. Thanks in advance.

Code:
 
BEGIN {
   FS=">";RS=">";ORS="";
}
$NF { d++
  system("mkdir dir"d);
  print ">"$0 > ("dir"d"/input");
  system("cd dir"d"; mfold SEQ=input");
  system("cd dir"d"; /home/rsankar/bin/mfold SEQ=input");
  system(cd "/home/rsankar/rna/org/org1");
  system("sh final5");
  system("rm -rf dir"d);

Quote:
Originally Posted by Chubler_XL
How about this awk script (process.awk):

Code:
BEGIN {
   FS=">";RS=">";ORS="";
}
$NF { d++
  system("mkdir dir"d);
  print ">"$0 > ("dir"d"/input");
  system("cd dir"d"; mfold seq=input");
}

run it with:
Code:
$ awk -f process.awk inputfile

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Print Line as per the dependent sequence in shell script.

Hi i have a file like this as shown below: DA PROCESS_ID IDENTIFIER DA_FILE STATUS WAITING_FOR SCOPED_DEPENDENT 1836 21000 01052019 BH90P.TEMP.DA1836.FTP W NULL ... (6 Replies)
Discussion started by: krishnaswarnkar
6 Replies

2. Shell Programming and Scripting

Will shell script executes in sequence

I have a shell script scheduled in cron job to run at every 1 minute which transfers files to remote machine and then move the files to backup folder. cd /u01/app/ftp_tmp sftp user@hostname <<-EOF cd /home/user/ftp mput * bye EOF mv /u01/app/ftp_tmp/* /u01/app/ftp_bkp Now the problem is... (6 Replies)
Discussion started by: Bhavi
6 Replies

3. Shell Programming and Scripting

How to find a missing file sequence using shell scripting?

Hey guys, I want the below files to be processed with the help of BASH so that i will be able to find the missing file names : PP01674520141228X.gz PP01674620141228X.gz PP01674820141228X.gz PP01674920141228X.gz PP01675420141228X.gz PP01675520141228X.gz PP01676020141228X.gz . . . .... (4 Replies)
Discussion started by: TANUJ
4 Replies

4. Shell Programming and Scripting

Sequence generation in shell

Hi, I am using the nested for loops to generate the sequence , taking start and end sequence number input from test.txt (sample content mentioned below). Also , can I print the rest of columns as well with sequence number into the same file. for i in `cat test.txt|cut -d"," -f7` do ... (8 Replies)
Discussion started by: tushar.modgil
8 Replies

5. Shell Programming and Scripting

find common entries and match the number with long sequence and cut that sequence in output

Hi all, I have a file like this ID 3BP5L_HUMAN Reviewed; 393 AA. AC Q7L8J4; Q96FI5; Q9BQH8; Q9C0E3; DT 05-FEB-2008, integrated into UniProtKB/Swiss-Prot. DT 05-JUL-2004, sequence version 1. DT 05-SEP-2012, entry version 71. FT COILED 59 140 ... (1 Reply)
Discussion started by: manigrover
1 Replies

6. UNIX for Advanced & Expert Users

Sequence number merged with hypen, shell script

Hello Folks, i have to write shell scripting for given expected output manner. in given input we have to write shell script in such a way that sequence no can b merged/link between start and end digit with hyphen "-" symbol and rest of digit separated by "," Eg : For Input "2 6 7 8 11 12... (9 Replies)
Discussion started by: panchalh
9 Replies

7. Shell Programming and Scripting

How to insert a sequence number column inside a pipe delimited csv file using shell scripting?

Hi All, I need a shell script which could insert a sequence number column inside a dat file(pipe delimited). I have the dat file similar to the one as shown below.. |A|B|C||D|E |F|G|H||I|J |K|L|M||N|O |P|Q|R||S|T As shown above, the column 4 is currently blank and i need to insert sequence... (5 Replies)
Discussion started by: nithins007
5 Replies

8. Shell Programming and Scripting

Shell scripting for this sequence to compare

I have two input files (given below) and to compare each line of the File1 with each line of File2 starts with '>sample1'. If a match occurs and that matched line in the File2 contains another line or sequence of lines starting with "Chr" they have to be displayed in output file with that sample.... (4 Replies)
Discussion started by: hravisankar
4 Replies

9. Shell Programming and Scripting

Shell scripting : Help Me for this sequence

I have two input files (given below) and to compare each line of the File1 with each line of File2 starts with '>sample1'. If a match occurs and that matched line in the File2 contains another line or sequence of lines starting with "Chr" they have to be displayed in output file with that sample.... (9 Replies)
Discussion started by: hravisankar
9 Replies

10. Shell Programming and Scripting

difference between AIX shell scripting and Unix shell scripting.

please give the difference between AIX shell scripting and Unix shell scripting. (2 Replies)
Discussion started by: haroonec
2 Replies
Login or Register to Ask a Question