Sponsored Content
Full Discussion: Re ordering lines - Awk
Top Forums Shell Programming and Scripting Re ordering lines - Awk Post 302543740 by quincyjones on Tuesday 2nd of August 2011 01:45:02 AM
Old 08-02-2011
Re ordering lines - Awk

Is it possible to re-order certain rows as columns (of large files).
Few lines from the file for reference.

input
Code:
Splicing Factor: Tra2beta, Motif: aaguguu, Cutoff: 0.5000
Sequence Position	Genomic Coordinate	K-mer     	Score   
97               	chr1:67052604     	uacuguu   	0.571   
147              	chr1:67052554     	augugua   	0.536   
166              	chr1:67052535     	aaauuuu   	0.500   
226              	chr1:67052475     	aauugug   	0.612   
Splicing Factor: SRp20, Motif: wcwwc, Cutoff: 0.7200
Sequence Position	Genomic Coordinate	K-mer     	Score   
302              	chr1:67052399     	ucauc     	0.875   
349              	chr1:67052352     	acauc     	0.740



output
Code:
Splicing_Factor	Motif	Cutoff	Sequence_Position	Genomic_Coordinate	K-mer	Score   
Tra2beta	aaguguu	0.5000	97	chr1:67052604     	uacuguu   	0.571
Tra2beta	aaguguu	0.5000	147	chr1:67052554     	augugua   	0.536
Tra2beta	aaguguu	0.5000	166	chr1:67052535     	aaauuuu   	0.500 
Tra2beta	aaguguu	0.5000	226	chr1:67052475     	aauugug   	0.612
SRp20	wcwwc	0.7200	302	chr1:67052399	ucauc	0.875   
SRp20	wcwwc	0.7200	349	chr1:67052352	acauc	0.740


Last edited by quincyjones; 08-02-2011 at 02:52 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

proper ordering of o/p values

Hi, Below is my script which creates a file: #!/bin/sh if then echo "Enter bill period " echo "Syntax: sh cpd.sh G08" exit fi sqlplus uname/pwd@dbname <<EOF set WRAP off set FEEDBACK off set PAGESIZE 0 set VERIFY off (14 Replies)
Discussion started by: ss_ss
14 Replies

2. Shell Programming and Scripting

trying to make an AWK code for ordering numbers in a column from least to highest

Hi all, I have a large column of numbers like 5.6789 2.4578 9.4678 13.5673 1.6589 ..... I am trying to make an awk code so that awk can easily go through the column and arrange the numbers from least to highest like 1.6589 2.4578 5.6789 ....... can anybody suggest, how can I do... (5 Replies)
Discussion started by: ananyob
5 Replies

3. Homework & Coursework Questions

word ordering problem HELP please (linux)

Hi guys I need you ,please help me i have to do this for tomorow and i don't understand how to do Q1 : Order the words of RADIO.txt by frequency Q2 : Order the words of RADIO.txt in alphabétique order Q3 : Order the words of RADIO.txt par ordre "rhymique" (exemple, put togeder words which are... (1 Reply)
Discussion started by: Lili
1 Replies

4. Shell Programming and Scripting

ordering a data file

With an input file like this: How can I get an output like this? (In the quoted examples, the "_" sign represents an empty space) Note that there are some minus signs and no spaces, in the example above the first character of the first line is an empty space, so each number spans 10... (16 Replies)
Discussion started by: lego
16 Replies

5. Shell Programming and Scripting

Appending lines with word frequencies, ordering and indexing a column

Dear All, I have the following input data: w1 20 g1 w1 10 g1 w2 12 g1 w2 23 g1 w3 10 g1 w3 17 g1 w3 12.5 g1 w3 21 g1 w4 11 g1 w4 13.2 g1 w4 23 g1 w4 18 g1 First I seek to find the word frequencies in col1 and sort col2 in ascending order for each change in a col1 word. Second,... (5 Replies)
Discussion started by: Ghetz
5 Replies

6. Shell Programming and Scripting

Re-ordering data

input Predictions for job: 1299399580 ********************************************** gg18_qqq10_100017878_100017978_- ============================================================================== zzz Factor: XXX, ttt: crsmsgw, Cutoff: 0.6429 seqe Position fff Coordinate K-mer Score ... (3 Replies)
Discussion started by: quincyjones
3 Replies

7. Shell Programming and Scripting

ordering

file1 1 SNP2 3 1 SNP3 3 1 SNP5 4 2 SNP1 4 2 SNP4 4 file2 SNP1 1 1 1 SNP5 5 5 5 SNP4 4 4 4 SNP2 2 2 2 SNP3 1 1 1 desired output (1 Reply)
Discussion started by: johnkim0806
1 Replies

8. Shell Programming and Scripting

Random ordering

1 2 4 5 3 I would like to use a script so that i can randomly rearrange these numbers such as 3 5 2 4 1 Thanks! (3 Replies)
Discussion started by: johnkim0806
3 Replies

9. Shell Programming and Scripting

Ordering batch number

Hi, Could some one please help to order the batch number in sequence. I will be getting bunch of files with batch number in folder1 which are not in sequence. I need to move all files from folder1 to folder2 with batch number in sequence. Header record looks like PROCESS1... (8 Replies)
Discussion started by: zooby
8 Replies

10. Shell Programming and Scripting

awk to print missing and keep sequential ordering if not found

The below awk in bold will look for the ids in file1 in $2 of file2 and if they match print the line in file2. If an id is missing or not found in file2 (like BMPR2 in line4 of file1) I can not figure out how to add it to them to the lines in the output as missing in $3 following the same format.... (4 Replies)
Discussion started by: cmccabe
4 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 09:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy