Sponsored Content
Top Forums Shell Programming and Scripting How to remove a subset of data from a large dataset based on values on one line Post 302575977 by davegen on Wednesday 23rd of November 2011 10:28:49 AM
Old 11-23-2011
How to remove a subset of data from a large dataset based on values on one line

Hello. I was wondering if anyone could help. I have a file containing a large table in the format:

marker1 marker2 marker3 marker4
position1 position2 position3 position4
genotype1 genotype2 genotype3 genotype4

with marker being a name, position a numeric measure of distance and genotype also a number.

I need to remove columns based on the values in the "position" line i.e. I need a script to take each position and remove adjacent columns that are within a certain distance of that marker, which is indicated by the value the position line which is a measure of distance. So if the file looked like this

rs1 rs2 rs3 rs4 rs5
1 2 3 4 5
2 3 1 1 2

and I was dealing with rs3 and the distance I wanted to remove was 1, I would want the output:

rs1 rs3 rs5
1 3 5
2 1 2

Does anyone know any way can do this? I appreciate any help and I hope I haven't been too confusing!
 

10 More Discussions You Might Find Interesting

1. Programming

I have C++ exe file( no source code) and need to run many large dataset under unix, b

I have C++ exe file( no source code) and need to run many large dataset under unix, but how to know the memeroy usage for one dataset?http://www.codeproject.com/script/Forums/Images/New.gif I think "top" is not good and if using the profiler, it seems no free download, any ideas? (1 Reply)
Discussion started by: Danielwang1986
1 Replies

2. Shell Programming and Scripting

remove a specific line in a LARGE file

Hi guys, i have a really big file, and i want to remove a specific line. sed -i '5d' fileThis doesn't really work, it takes a lot of time... The whole script is supposed to remove every word containing less than 5 characters and currently looks like this: #!/bin/bash line="1"... (2 Replies)
Discussion started by: blubbiblubbkekz
2 Replies

3. Shell Programming and Scripting

Remove duplicate line detail based on column one data

My input file: AVI.out <detail>named as the RRM .</detail> AVI.out <detail>Contains 1 RRM .</detail> AR0.out <detail>named as the tellurite-resistance.</detail> AWG.out <detail>Contains 2 HTH .</detail> ADV.out <detail>named as the DENR family.</detail> ADV.out ... (10 Replies)
Discussion started by: patrick87
10 Replies

4. Shell Programming and Scripting

How to extract a subset from a huge dataset

Hi, All I have a huge file which has 450G. Its tab-delimited format is as below x1 A 50020 1 x1 B 50021 8 x1 C 50022 9 x1 A 50023 10 x2 D 50024 5 x2 C 50025 7 x2 F 50026 8 x2 N 50027 1 : : Now, I want to extract a subset from this file. In this subset, column 1 is x10, column 2 is... (3 Replies)
Discussion started by: cliffyiu
3 Replies

5. Shell Programming and Scripting

Find line number of bad data in large file

Hi Forum. I was trying to search the following scenario on the forum but was not able to. Let's say that I have a very large file that has some bad data in it (for ex: 0.0015 in the 12th column) and I would like to find the line number and remove that particular line. What's the easiest... (3 Replies)
Discussion started by: pchang
3 Replies

6. UNIX for Advanced & Expert Users

How to extract subset file from dataset?

Hello I have a data set which looks like this : progeny sire dam gender 12 1 3 M 13 2 4 F 14 2 5 F 15 6 5 ... (13 Replies)
Discussion started by: sajmar
13 Replies

7. Shell Programming and Scripting

How to read file line by line and compare subset of 1st line with 2nd?

Hi all, I have a log file say Test.log that gets updated continuously and it has data in pipe separated format. A sample log file would look like: <date1>|<data1>|<url1>|<result1> <date2>|<data2>|<url2>|<result2> <date3>|<data3>|<url3>|<result3> <date4>|<data4>|<url4>|<result4> What I... (3 Replies)
Discussion started by: pat_pramod
3 Replies

8. Shell Programming and Scripting

Selecting random columns from large dataset in UNIX

Dear folks I have a large data set which contains 400K columns. I decide to select 50K determined columns from the whole 400K columns. Is there any command in unix which could do this process for me? I need to also mention that I store all of the columns id in one file which may help to select... (5 Replies)
Discussion started by: sajmar
5 Replies

9. Shell Programming and Scripting

Reoccuring peak values in large data file and print the line..

Hi i have some large data files that contain several fields and rows the data in a field have a numeric value that is in a sine wave pattern what i would like todo is locate each peak and pick the highest value and print that complete line. the data looks something like this it is field nr4 which... (4 Replies)
Discussion started by: ninjaunx
4 Replies

10. Shell Programming and Scripting

Parsing a subset of data from a large matrix

I do have a large matrix of the following format and it is tab delimited ch-ab1-20 ch-bb2-23 ch-ab1-34 ch-ab1-24 er-cc1-45 bv-cc1-78 ch-ab1-20 0 2 3 4 5 6 ch-bb2-23 3 0 5 ... (6 Replies)
Discussion started by: Kanja
6 Replies
Bio::Map::Marker(3pm)					User Contributed Perl Documentation				     Bio::Map::Marker(3pm)

NAME
Bio::Map::Marker - An central map object representing a generic marker that can have multiple location in several maps. SYNOPSIS
# get map objects somehow # a marker with complex localisation $o_usat = Bio::Map::Marker->new(-name=>'Chad Super Marker 2', -positions => [ [$map1, $position1], [$map1, $position2] ] ); # The markers deal with Bio::Map::Position objects which can also # be explicitly created and passed on to markers as an array ref: $o_usat2 = Bio::Map::Marker->new(-name=>'Chad Super Marker 3', -positions => [ $pos1, $pos2 ] ); # a marker with unique position in a map $marker1 = Bio::Map::Marker->new(-name=>'hypervariable1', -map => $map1, -position => 100 ); # another way of creating a marker with unique position in a map: $marker2 = Bio::Map::Marker->new(-name=>'hypervariable2'); $map1->add_element($marker2); $marker2->position(100); # position method is a short cut for get/setting unique positions # which overwrites previous values # to place a marker to other maps or to have multiple positions # for a map within the same map use add_position() $marker2->add_position(200); # new position in the same map $marker2->add_position($map2,200); # new map # setting a map() in a marker or adding a marker into a map are # identical mathods. Both set the bidirectional connection which is # used by the marker to remember its latest, default map. # Regardes of how marker positions are created, they are stored and # returned as Bio::Map::PositionI objects: # unique position print $marker1->position->value, " "; # several positions foreach $pos ($marker2->each_position($map1)) { print $pos->value, " "; } See Bio::Map::Position and Bio::Map::PositionI for more information. DESCRIPTION
A Marker is a Bio::Map::Mappable with some properties particular to markers. It also offers a number of convienience methods to make dealing with map elements easier. FEEDBACK
Mailing Lists User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to the Bioperl mailing list. Your participation is much appreciated. bioperl-l@bioperl.org - General discussion http://bioperl.org/wiki/Mailing_lists - About the mailing lists Support Please direct usage questions or support issues to the mailing list: bioperl-l@bioperl.org rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible. Reporting Bugs Report bugs to the Bioperl bug tracking system to help us keep track of the bugs and their resolution. Bug reports can be submitted via the web: https://redmine.open-bio.org/projects/bioperl/ AUTHOR - Chad Matsalla Email bioinformatics1@dieselwurks.com CONTRIBUTORS
Heikki Lehvaslaiho heikki-at-bioperl-dot-org Lincoln Stein lstein@cshl.org Jason Stajich jason@bioperl.org Sendu Bala bix@sendu.me.uk APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ new Title : new Usage : my $marker = Bio::Map::Marker->new( -name => 'Whizzy marker', -position => $position); Function: Builds a new Bio::Map::Marker object Returns : Bio::Map::Marker Args : -name => name of this microsatellite [optional], string,default 'Unknown' -default_map => the default map for this marker, a Bio::Map::MapI -position => map position for this marker, a Bio::Map::PositionI -positions => array ref of Bio::Map::PositionI objects position and positions can also take as values anything the corresponding methods can take default_map Title : default_map Usage : my $map = $marker->default_map(); Function: Get/Set the default map for the marker. Returns : L<Bio::Map::MapI> Args : [optional] new L<Bio::Map::MapI> map Title : map Function: This is a synonym of the default_map() method *** does not actually add this marker to the map! *** Status : deprecated, will be removed in next version get_position_object Title : get_position_class Usage : my $position = $marker->get_position_object(); Function: To get an object of the default Position class for this Marker. Subclasses should redefine this method. The Position returned needs to be a L<Bio::Map::PositionI> with -element set to self. Returns : L<Bio::Map::PositionI> Args : none for an 'empty' PositionI object, optionally Bio::Map::MapI and value string to set the Position's -map and -value attributes. position Title : position Usage : my $position = $mappable->position(); $mappable->position($position); Function: Get/Set the Position of this Marker (where it is on which map), purging all other positions before setting. Returns : L<Bio::Map::PositionI> Args : Bio::Map::PositionI OR Bio::Map::MapI AND scalar OR scalar, but only if the marker has a default map add_position Title : add_position Usage : $marker->add_position($position); Function: Add a Position to this marker Returns : n/a Args : Bio::Map::PositionI OR Bio::Map::MapI AND scalar OR scalar, but only if the marker has a default map positions Title : positions Usage : $marker->positions([$pos1, $pos2, $pos3]); Function: Add multiple Bio::Map::PositionI to this marker Returns : n/a Args : array ref of $map/value tuples or array ref of Bio::Map::PositionI in_map Title : in_map Usage : if ( $marker->in_map($map) ) {} Function: Tests if this marker is found on a specific map Returns : boolean Args : a map unique id OR Bio::Map::MapI perl v5.14.2 2012-03-02 Bio::Map::Marker(3pm)
All times are GMT -4. The time now is 02:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy