Register
It is currently Wed Nov 26, 2014 11:16 am

matching column and search closest elements


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Thu Jul 10, 2014 5:21 am   

Joined: Thu Jul 10, 2014 5:17 am
Posts: 1
Hi all
I am new on this forum and I have a problem that I am not able to resolve.
Briefly, I have a file like this:


Code:
ID_1 chr1 100 -
ID_2 chr2 300 +


and another file like this:


Code:
name_1 chr1 150 no -
name_2 chr1 250 yes -
name_3 chr2 350 yes +
name_4 chr2 280 yes +


Well, for each entry in file1 I would like to find the closest (considering column 3) feature in file2.
So, for instance for entry1 in file1, I would like to check in file2 which is the element that is closest to "chr1 100" (the second column must matchand the 3th column must be the closest).
Moreover i would like to take in consideration only the elements in file2 in which the 4th column is "yes"(or at least I can have the possibility to decide this parameter) and the 5th column must match with the entry in file1(or also in this case I should have the possibility to decide this).

The output file for the example above should be (if I have 4th columns must match) like this:

Code:
ID_1 chr1 100 - name2 chr1 250 yes - 150 2
ID_2 chr2 300 + name4 chr2 280 yes + -20 1


So I would like to output all entry in file1 with the closest feature in file2 and report (last 2 column) the distance between column 3 (taken from the 2 files) and, for example for entry1, that the closest feature (reported) "yes" is the second met.

I really hope that my explanation wa good.

If you need further information let me know.


Top
 Profile  
 PostPosted: Mon Jul 14, 2014 8:57 am   
Site Admin
User avatar

Joined: Sun May 15, 2005 9:36 pm
Posts: 673
Location: Des Moines, Iowa
Sure, what class is this for ? ;)


Top
 Profile WWW  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP