
JenniC
Novice
Jul 8, 2009, 10:57 AM
Post #3 of 3
(3898 views)
|
Re: [kylle345] Need a program that prints out letters from another file
[In reply to]
|
Can't Post
|
|
Hi Kylle: Interesting problem. Which university do you work at ? (I know someone who does similar parsing and sequencing work.) I will show you a quick script for the first part of your requirement - how to handle the + sign. The second part of your requirement is unreadable. Feel free to repost that part. Below is the script. I will show samples in comments. set $wsep= " " # Read file 1. var str data1 ; cat "FILE1" > $data1 # Read lines in file1 one by one. while ($data1 <> "") do # Get the next line. var str line1 ; lex "1" $data1 > $line1 # $line1 is "1154 10 + AAD6" # Get columns 1, 2 and 3 in $line1 var str col1, col2, col3 ; wex -p "1" $line1 > $col1 ; wex -p "2" $line1 > $col2 ; wex -p "3" $line1 > $col3 # $col1 is "1154", $col2 is "10", $col3 is "+". # Read file 2. var str data2 ; cat "FILE2" > $data2 # Strip off everything up to $col1 (which has 1154) and the newline. stex ("^"+col1+"\n^]") $data2 > null # We don't want to see the stripped off portion, thus > null. # $data2 now begins with "ATCTCACTCGTAATTCTACATAATTTT...". # Strip off everything beginning with the 10th ($col2) chars. stex ("["+col2) $data2 > null # Again, we don't want to see the removed portion. # $data2 now is "ATCTCACTC". # We want to collect the last 8 chars. That means we want to remove the first (10-2) chars. # Remember $col2 is "10". var int chars ; set $chars = makeint(str($col2))- 8 - 1 # $chars is now 1. # Extract starting at 1st char. This time, print the output to screen. stex ("["+makestr(int($chars))) $data2 done The script is in biterscripting. To try, 1. Download biterscripting from http://www.biterscripting.com . 2. Save the above script as "C:\Scripts\sequence.txt". 3. Start biterscripting. Run the sequence script by entering the following command. You should see the correct output. Make sure you use correct paths for FILE1 and FILE2 and enclose them in double quotes. Once you are done testing, you can call the script from your overall perl program as follows. C:\biterScripting\biterScripting.exe sequence.txt > output.txt Vikas: Good suggestions for a new user. What is PCR amplification ? Jenni
(This post was edited by JenniC on Jul 8, 2009, 11:30 AM)
|