[SOLVED] Chemistry problem- File matching and Sorting!!!
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I have a file called ranking.txt, in which I have 4 chemical compounds in *.sdf file format named ligands_m1, ligands_m2, ligands_m3, ligands_m4.
Each compounds is assigned with a particular score along with the file location.
------------------------------------------------------------------------
------------------------------------------------------------------------
In the same directory, I have another set of files called cluster files also in the *.sdf format.
I have included the cluster files structure below:
I need a script that does the following job. For example, ONLY If the score is above 28 and number of cluster files is less than or equal to 3, then write the output.
#!/usr/bin/env perl
use strict;
use File::Basename;
local $\ = "\n";
while (<>) {
chomp;
next unless /./;
my ($score, $dir, $name) = split;
next unless $score > 28;
$dir = dirname $dir;
my @L = <$dir/*.sdf>;
next unless (@L < 4);
print ;
}
Last edited by bigearsbilly; 07-12-2010 at 06:34 AM.
Reason: it was wrong
Dear bigearsbilly
The script works fine thank you very much. But it didnt write the number of clusters in the last column. Could you please modify this program to add no_of_clusters as last column.
Also it will be great, if the output is written in a separate file "output.txt".
Thank you very much for your time and consideration
Regards
Robert
And ???.
Seems you want some-one else to do all the work for you. Personally I don't mind giving people a nudge in the right direction - I think you have certainly received that - and more.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.