Sponsored Content
Top Forums Shell Programming and Scripting Match ids and print original file Post 302777479 by nans on Friday 8th of March 2013 03:31:23 AM
Old 03-08-2013
Match ids and print original file

Hello,

I have two files

Original: ( 5000 entries)
Chr Position
chr1 879108
chr1 881918
chr1 896874 ...

and a file with allele freq ( 2000 entries)
Chr Position MAF
chr1 881918 0.007
chr1 979748 0.007
chr1 1120377 0.007
chr1 1178925 0.036

I would like the original file matched with the allele freq and print out the output file with 5000 entries.
Chr Position MAF
chr1 879108 NULL
chr1 881918 0.007
chr1 896874 NULL
...

Any help is appreciated. Thank you.

Last edited by nans; 03-08-2013 at 04:59 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

print remaining part from the first-match within a file

Hi, i was looking for unix command(s) for : find the first occurrence of a given pattern with in a file and print the remaining part. below is an example of what i am looking for: lets say, a file named myfile.txt now, the command i am looking for will do the following (4 Replies)
Discussion started by: nurulamin862
4 Replies

2. Shell Programming and Scripting

Strings from one file which exactly match to the 1st column of other file and then print lines.

Hi, I have two files. 1st file has 1 column (huge file containing ~19200000 lines) and 2nd file has 2 columns (small file containing ~6000 lines). ################################# huge_file.txt a a ab b ################################## small_file.txt a 1.5 b 2.5 ab ... (4 Replies)
Discussion started by: AshwaniSharma09
4 Replies

3. Shell Programming and Scripting

print when column match with other file

Hello all, please help. There are two file like this: file1: 1197510.0 294777.7 9666973.0 21.6 1839.8 1197510.0 294777.7 9666973.0 413.2 2075.9 1197510.0 294777.7 9666973.0 689.3 2260.0 ... (1 Reply)
Discussion started by: attila
1 Replies

4. UNIX for Dummies Questions & Answers

Match values/IDs from column and text files

Hello, I am trying to modify 2 files, to yield results in a 3rd file. File-1 is a 8-columned file, separted with tab. 1234:1 xyz1234 blah blah blah blah blah blah 1234:1 xyz1233 blah blah blah blah blah blah 1234:1 abc1234 blah blah blah blah blah blah n/a RRR0000 blah blah blah... (1 Reply)
Discussion started by: ad23
1 Replies

5. Shell Programming and Scripting

AWK print and retain original format

I have a file with very specific column spacing formatting, I wish to do the following: awk '{print $1, $2, $3, $4, $5, $6, $19-$7, $20-$8, $21-$9, $10, $11, $12}' merge.pdb > vector.pdb but the format gets ruined. I have tried with print -f but to no avail.... (7 Replies)
Discussion started by: chrisjorg
7 Replies

6. Shell Programming and Scripting

Match and print columns in second file

Hi All, I have to match each row in file 1 with 1st row in file 2 and print the corresponding column from file2. I am trying to use an awk script to do this. For example cat File1 X1 X3 X4 cat File2 ID X1 X2 X3 X4 A 1 6 2 1 B 2 7 3 3 C 3 8 4 1 D 4 9 1 1 (3 Replies)
Discussion started by: newpro
3 Replies

7. Shell Programming and Scripting

Match ids

Hello, I have two files File 1 with 10 columns rsid position ........ xx 1:10000 File 2 position 1:10000 2:2000 .... I need to extract the IDs given in file 2(column1) from file 1 (column2) and print all columns from file1. I am trying this command (1 Reply)
Discussion started by: nans
1 Replies

8. UNIX for Beginners Questions & Answers

Count multiple columns and print original file

Hello, I have two tab files with headers File1: with 4 columns header1 header2 header3 header4 44 a bb 1 57 c ab 4 64 d d 5 File2: with 26 columns header1.. header5 header6 header7 ... header 22...header26 id1 44 a bb id2 57 ... (6 Replies)
Discussion started by: nans
6 Replies

9. UNIX for Beginners Questions & Answers

Match duplicate ids in two files

I have two text files. File 1 has 150 ids but all the ids exists in duplicates so it has 300 ids in total. File 2 has 1500 ids but all exists in duplicates so file 2 has 300 ids in total. i want to match the first occurance of every id in file 1 with first occurance of thet id in file 2 and 2nd... (2 Replies)
Discussion started by: limd
2 Replies

10. Shell Programming and Scripting

awk to print match or non-match and select fields/patterns for non-matches

In the awk below I am trying to output those lines that Match between file1 and file2, those Missing in file1, and those missing in file2. Using each $1,$2,$4,$5 value as a key to match on, that is if those 4 fields are found in both files the match, but if those 4 fields are not found then missing... (0 Replies)
Discussion started by: cmccabe
0 Replies
Bio::Graphics::Glyph::stackedplot(3pm)			User Contributed Perl Documentation		    Bio::Graphics::Glyph::stackedplot(3pm)

NAME
Bio::Graphics::Glyph::stackedplot - The stackedplot glyph SYNOPSIS
See L<Bio::Graphics::Panel> and L<Bio::Graphics::Glyph>. DESCRIPTION
The stackedplot glyph can be used to draw quantitative feature data using a stacked column plot. It differs from the xyplot glyph in that the plot applies to a single top level feature, not a group of subfeatures. The data to be graphed is derived from an attribute called "data_series." The data to be graphed is represented as a list of arrays: ( [1, 2, 8], [6, 1, 1], [10,8, 0], [1, 1, 1], ) Each array is a column in the stacked plot. Its values become the subdivisions of the column. In this example, there are four columns, each of which has three subdivisions. You can add labels to the columns and change the colors of the subdivisions. To assign data to a feature, you can add a "series" tag: $snp1 = Bio::SeqFeature::Generic ->new (-start => 500,-end=>501, -display_name =>'example', -tag=> { series => [ [10,20,30], [30,30,0], [5,45,10], [5,45,10], [5,45,10], [50,0,50], ], } ); Note that the series tag must consist of an array of arrays. If you are using a gff3 representation, you can load a database with data that looks like this: chr1 test feature 1 1000 . . . series=10 20 30;series=30 30 0;series=5 45 10... If you are using a gff2 representation, you can load a database with data that looks like this: chr1 test feature 1 1000 . . . series 10 20 30; series 30 30 0 series 5 45 10... Or you can pass a callback to the -series option: $panel->add_track(@data, -glyph => 'stackedplot', -series => sub { my $feature = shift; return [ [10,20,30], [30,30,0], [5,45,10], ] } ); OPTIONS The following options are standard among all Glyphs. See Bio::Graphics::Glyph for a full explanation. Option Description Default ------ ----------- ------- -fgcolor Foreground color black -outlinecolor Synonym for -fgcolor -bgcolor Background color turquoise -fillcolor Synonym for -bgcolor -linewidth Line width 1 -height Height of glyph 10 -font Glyph font gdSmallFont -label Whether to draw a label 0 (false) -description Whether to draw a description 0 (false) -hilite Highlight color undef (no color) In addition, the alignment glyph recognizes all the options of the xyplot glyph, as well as the following glyph-specific option: Option Description Default ------ ----------- ------- -fixed_gap Vertical distance between 8 the rectangle that shows the start:end range of the feature and the fixed width stacked plot. -series_colors A list giving a series of red,blue,green,orange, color names for the data brown,grey,black series (the values inside each stacked column). -column_labels A list of labels to print -none- underneath each column. -column_width The width of each column. 8 -column_spacing Spacing between each 2 column. -min_score Minimum score for the 0.0 sum of the members of each data series. -max_score Maximum score for the 1.0 sum of the members of each data series. -scale_font Font to use for the scale. gdTinyFont -column_font Font to use for the column gdSmallFont labels. -draw_scale Whether to draw a scale to true right of the columns. Note that -min_score and -max_score represent the minimum and maximum SUM of all the values in the data series. For example, if your largest column contains the series (10,20,30), then the -max_score is 60. EXAMPLE
To understand how this glyph works, try running and modifying the following example: #!/usr/bin/perl use strict; use warnings; use Bio::Graphics; use Bio::SeqFeature::Generic; my $segment = Bio::Graphics::Feature->new(-start=>1,-end=>700); my $snp1 = Bio::SeqFeature::Generic ->new (-start => 500,-end=>590, -display_name =>'fred', -tag=> { series => [ [10,20,30], [30,30,0], [5,45,10], [5,45,10], [5,45,10], [50,0,50], ], }, -source=>'A test', ); my $snp2 = Bio::SeqFeature::Generic->new(-start => 300, -end => 301, -display_name => 'rs12345', -tag=> { series => [ [30,20,10 ], [80,10,10 ], ], }, -source=>'Another test', ); my $panel = Bio::Graphics::Panel->new(-segment=>$segment,-width=>800); $panel->add_track($segment,-glyph=>'arrow',-double=>1,-tick=>2); $panel->add_track([$snp1,$snp2], -height => 50, -glyph => 'stackedplot', -fixed_gap => 12, -series_colors => [qw(red blue lavender)], -column_labels => [qw(a b c d e f g)], -min_score => 0, -max_score => 100, -column_width => 8, -column_font => 'gdMediumBoldFont', -scale_font => 'gdTinyFont', -label => 1, -description=>1, ); print $panel->png; BUGS
Please report them. SEE ALSO
Bio::Graphics::Panel, Bio::Graphics::Track, Bio::Graphics::Glyph::transcript2, Bio::Graphics::Glyph::anchored_arrow, Bio::Graphics::Glyph::arrow, Bio::Graphics::Glyph::box, Bio::Graphics::Glyph::primers, Bio::Graphics::Glyph::segments, Bio::Graphics::Glyph::toomany, Bio::Graphics::Glyph::transcript, AUTHOR
Lincoln Stein <lstein@cshl.org> Copyright (c) 2006 Cold Spring Harbor Laboratory This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See DISCLAIMER.txt for disclaimers of warranty. perl v5.14.2 2012-02-20 Bio::Graphics::Glyph::stackedplot(3pm)
All times are GMT -4. The time now is 03:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy