Parsing file in perl script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Parsing file in perl script
# 1  
Old 04-09-2010
Parsing file in perl script

Hi Guys,

I have a large text file that is has a bunch of records. Each record starts with a header line that starts with the ">" character. Then there are several lines under that line that contain sequences of letters.

For example, a file might look like:
Code:
>TEXT ID=2L TEXT
ABCDEDKGFKGJDJED
ALDKDKKFJFJGF

>TEXT  ID=3R TEXT
FGDFGKDFSKDSLD
FGFDGDSFFDG
FDGF

I can send you the actual file if you would like to see it. All I want is a PERL script that inputs a file in the following format:
Code:
ID:START-STOP  SEQUENCE

Where ID is an identifier for the record (in the above record 1 has identifier of 2L and record 2 has identifier of 3R and start and stop are first and last positions of a subsequence in the record. Then there is a space and a SEQUENCE. I can send you an actual file for testing.

I want the script to use the ranges to pull out the subsequence from the big record text file and then see if it matches the SEQUENCE in the input. The big record file is large so you can't load the whole file into memory, you need to stream it.

The output would be the subsequence from the record and a space and a YES or NO for where it matches.

Thanks in advance

Last edited by Franklin52; 04-09-2010 at 05:09 AM.. Reason: Please use code tags!
# 2  
Old 04-09-2010
if you don't mind, please post the sample output for the above 2 records.
also are you free to use any other tool or only PERL?
# 3  
Old 04-09-2010
also please post the code you have tried so far and where you are stuck with
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Help with understanding this regex in a Perl script parsing a 'complex' string

Hi, I need some guidance with understanding this Perl script below. I am not the author of the script and the author has not leave any documentation. I supposed it is meant to be 'easy' if you're a Perl or regex guru. I am having problem understanding what regex to use :confused: The script does... (3 Replies)
Discussion started by: newbie_01
3 Replies

2. Shell Programming and Scripting

Command Line Perl for parsing fasta file

I would like to take a fasta file formated like >0001 agttcgaggtcagaatt >0002 agttcgag >0003 ggtaacctga and use command line perl to move the all sample gt 8 in length to a new file. the result would be >0001 agttcgaggtcagaatt >0003 ggtaacctga cat ${sample}.fasta | perl -lane... (2 Replies)
Discussion started by: jdilts
2 Replies

3. Shell Programming and Scripting

Help in parsing XML output file in perl.

Hi I have an XML output like : <?xml version="1.0" encoding="ISO-8859-1" ?> - <envelope> - <body> - <outputGetUsageSummary> - <usgSumm rerateDone="5"> - <usageAccum accumId="269" accumCaptn="VD_DP_AR" inclUnits="9999999.00" inclUnitsUsed="0.00" shared="false" pooled="false"... (7 Replies)
Discussion started by: rkrish
7 Replies

4. Shell Programming and Scripting

Parsing config-file (perl)

Hi, i'm trying to parse a config file that have alot of rows similar to this one: Example value value value What i want to do is to split and save the row above in a hash, like this: Example = value value value Basically i want to split on the first whitespace after the first... (3 Replies)
Discussion started by: mikemikemike
3 Replies

5. Shell Programming and Scripting

Perl script parsing Help

Hi All, I am looking for a parsing in perl script which will parse DJEČJI SVIJET. There is a unicode character above character C. How to parse the total DJEČJI SVIJET in perl. Regards, Harikrishna (3 Replies)
Discussion started by: Harikrishna
3 Replies

6. Shell Programming and Scripting

Parsing a file using perl and skipping some lines

Hi, Consider following file with input: `YFLG:NC^Byad_insert constraint {id=600104470} {profile=GENDER == 2} {profile=BEHAVIOR == 17} {profile=SITEATTR_MULT == siteid:211051} {profile=AGE in } yad_insert ad {id=1718286093336959379} {type=R} ^AYFLG:YOO^Byad_insert constraint {id=600104471}... (1 Reply)
Discussion started by: bvids
1 Replies

7. UNIX for Dummies Questions & Answers

Script for parsing details in a log file to a seperate file

Hi Experts, Im a new bee for scripting, I would ned to do the following via linux shell scripting, I have an application which throws a log file, on each action of a particular work with the application, as sson as the action is done, the log file would vanish or stops updating there, the... (2 Replies)
Discussion started by: pingnagan
2 Replies

8. Shell Programming and Scripting

Perl parsing compared to Ksh parsing

#! /usr/local/bin/perl -w $ip = "$ARGV"; $rw = "$ARGV"; $snmpg = "/usr/local/bin/snmpbulkget -v2c -Cn1 -Cn2 -Os -c $rw"; $snmpw = "/usr/local/bin/snmpwalk -Os -c $rw"; $syst=`$snmpg $ip system sysName sysObjectID`; sysDescr.0 = STRING: Cisco Internetwork Operating System Software... (1 Reply)
Discussion started by: popeye
1 Replies

9. Shell Programming and Scripting

Parsing a file in Shell Script

Hi, I have a requirement. I have an application which can take a file as inputs. Now the file can contain any number of lines. The tool has to pick up the first uncommented line and begin processing it. For example the file could be like this: #MANI123|MANI1234 #MANI234|MANI247... (4 Replies)
Discussion started by: sendhilmani123
4 Replies

10. Shell Programming and Scripting

Conversion of bash parsing script to perl?

I need help with a perl parsing script. I have some error logs on a windows machine that I need to parse from a text file, but I know nothing about perl. I usually run this bash script on my linux box and it does just what I need. How would I do the same thing with perl and port it to my windows... (2 Replies)
Discussion started by: cstovall
2 Replies
Login or Register to Ask a Question