Please stop posting new questions as answers - that's 3 times now. I've edited your original question with the new query.
I have pdb chains from pdb pdb files
Example-275dA.seq 275dB.seq makes one pdb file pdb275d.ent.
i want to extract certain information from these files such as Header,Compnd,Title and print in new file...
kindly help me out please...
EDIT: Also, if i have Number of files like 6000 pdb files how to extract same thing from all files an print in new file with filename and retrived information
4 answers
We get a lot of questions like this one, of the form: "how can I use Perl to do something?" The short answer is, learn Perl - and then, you can use it to do anything.
What you are really asking is this. How can I use Perl to:
- open a file
- read it line by line
- identify specific text in each line
- print out the results
It doesn't matter that your file is a PDB file, or that you want to extract "HEADER". What you need to know are general Perl skills, which you can use as generalized solutions to many similar types of problem.
So first, learn the basics of file handling and regular expressions. Then, code like this will make perfect sense:
open FILE, "pdb275d.ent";
while(<FILE>) {
chomp;
my $line = $_;
# print whatever comes after COMPND
if ($line =~/^COMPND\s+(.*?)$/) {
print "$1\n";
}
}
close FILE;
Soon you will discover that if you have thought of a problem, it's likely that someone else did too and they created a solution. If you're lucky, that solution is something like the Bioperl project - a huge collection of libraries for processing biological data. In there you'll find Bio::Structure::IO for reading PDB files and Bio::Structure::Entry, for extracting information from them. But master the basics first.
Thanks a lot for ur help!!!as i am new to perl so learing it step by step... and one thing more i would like to know... If i have Number of files like 6000 pdb files how to extract same thing from all files an print in new file with filename and retrived information Thanks alot...i m highly obliged! Regards
You should edit your original question with new requests (I've done it for you this time), or add them as comments under the answer, not post them as new answers. Anyway, my answer is the same: learn the basic perl methods required (in this case, loops).
hey thanks alot for help as i am new to perl and wass little confused... I want to ask if i wana extract same information for number of files like 6000 files and display in new file...how cn i do that?? Thanks a lot for ur help guys... Regards
hey thanks alot for help as i am new to perl and wass little confused... I want to ask if i want to extract same information for number of files like 6000 files and display in new file...how cn i do that?? Same information as above from odb file but for 6000 or so files and displat result in new file... Thanks a lot for ur help guys... Regards
Log in to answer this question.
I don't think i understand the problem. I just took a short look at the pdb format and it seems you can just take the first word in each line and see if it's "HEADER", "COMPND", etc...
Please stop posting new questions as answers - that's 3 times now. I've edited your original question with the new query.
Have a look at this http://comp.chem.nottingham.ac.uk/parsepdb/