Sponsored Content
Full Discussion: Matrix parsing help !
Top Forums Programming Matrix parsing help ! Post 302586807 by mchimich on Tuesday 3rd of January 2012 09:47:00 AM
Old 01-03-2012
This is your code :
Code:
awk 'NR>1&&$3>=80{A[$1]=$1;B[A[$1]]=(B[A[$1]]?B[A[$1]]:$1)" "$2}END{for(i in A) print B[A[i]]}' test.tttt

And this is the output :
Code:
A D E
B C
D E

--> The DE is not a single group it's normally a part of the group 1 (ADE) I don't now if I'm clear
What i want to do after it's to get every group ID and using Bioperl to check the corresponding fasta files in a database. So i need just a output with two line (for this exemple).
Thanks
Moderator's Comments:
Mod Comment
Please use code tags when posting data and code samples!

Last edited by vgersh99; 01-03-2012 at 10:53 AM..
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl parsing compared to Ksh parsing

#! /usr/local/bin/perl -w $ip = "$ARGV"; $rw = "$ARGV"; $snmpg = "/usr/local/bin/snmpbulkget -v2c -Cn1 -Cn2 -Os -c $rw"; $snmpw = "/usr/local/bin/snmpwalk -Os -c $rw"; $syst=`$snmpg $ip system sysName sysObjectID`; sysDescr.0 = STRING: Cisco Internetwork Operating System Software... (1 Reply)
Discussion started by: popeye
1 Replies

2. Shell Programming and Scripting

Parsing of file for Report Generation (String parsing and splitting)

Hey guys, I have this file generated by me... i want to create some HTML output from it. The problem is that i am really confused about how do I go about reading the file. The file is in the following format: TID1 Name1 ATime=xx AResult=yyy AExpected=yyy BTime=xx BResult=yyy... (8 Replies)
Discussion started by: umar.shaikh
8 Replies

3. Shell Programming and Scripting

diagonal matrix to square matrix

Hello, all! I am struggling with a short script to read a diagonal matrix for later retrieval. 1.000 0.234 0.435 0.123 0.012 0.102 0.325 0.412 0.087 0.098 1.000 0.111 0.412 0.115 0.058 0.091 0.190 0.045 0.058 1.000 0.205 0.542 0.335 0.054 0.117 0.203 0.125 1.000 0.587 0.159 0.357... (11 Replies)
Discussion started by: yifangt
11 Replies

4. Shell Programming and Scripting

Matrix

Hi All I would like to merge multiple files with the same row and column size into a matrix format In a folder I have multiple files in the following format vi 12.txt a 1 b 5 c 7 d 0 vi 45.txt a 3 b 6 c 9 d 2 vi 9.txt a 4 (7 Replies)
Discussion started by: Lucky Ali
7 Replies

5. Ubuntu

How to convert full data matrix to linearised left data matrix?

Hi all, Is there a way to convert full data matrix to linearised left data matrix? e.g full data matrix Bh1 Bh2 Bh3 Bh4 Bh5 Bh6 Bh7 Bh1 0 0.241058 0.236129 0.244397 0.237479 0.240767 0.245245 Bh2 0.241058 0 0.240594 0.241931 0.241975 ... (8 Replies)
Discussion started by: evoll
8 Replies

6. Shell Programming and Scripting

awk? adjacency matrix to adjacency list / correlation matrix to list

Hi everyone I am very new at awk but think that that might be the best strategy for this. I have a matrix very similar to a correlation matrix and in practical terms I need to convert it into a list containing the values from the matrix (one value per line) with the first field of the line (row... (5 Replies)
Discussion started by: stonemonkey
5 Replies

7. Shell Programming and Scripting

Constructing a Matrix

Hi, I do have couple of files in a folder. The names of each of the files have a pattern. ahet_005678.txt ahet_005898.txt ahet_007678.txt ahet_004778.txt ... ... ahet_002378.txt Each of the above files have the same pattern of data with 4 columns and have an header for the last 3... (4 Replies)
Discussion started by: Kanja
4 Replies

8. Shell Programming and Scripting

Highest value matrix parsing

Hi All I do have a matrix in the following format a_2 a_3 s_4 t_6 b 0 0.9 0.004 0 c 0 0 1 0 d 0 0.98 0 0 e 0.0023 0.96 0 0.0034 I have thousands of rows I would like to parse the maximum value in each of the row and out put that highest value along the column header of... (2 Replies)
Discussion started by: Kanja
2 Replies

9. 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
Matrix(3)						User Contributed Perl Documentation						 Matrix(3)

NAME
PDL::Matrix -- a derived matrix class that implements column-major constructors and methods VERSION
This document refers to version PDL::Matrix 0.01 of PDL::Matrix SYNOPSIS
use PDL::Matrix; $m = mpdl [[1,2,3],[4,5,6]]; $m = PDL::Matrix->pdl([[1,2,3],[4,5,6]]); $m = msequence(4,3); @dimsa = $a->mdims; # 'dims' is not overloaded $v = vpdl [0,1,2,3] $v = vzeroes(4); DESCRIPTION
Overview This package tries to help people who want to use PDL for 2D matrix computation with lots of indexing involved . It provides a PDL subclass so one- and two-dimensional piddles that are used as vectors resp. matrices can be typed in using traditional matrix convention. The original pdl class refers to the first index as the first row, the second index as the first column of a matrix. Consider print $B = sequence(3,2) [ [0 1 2] [3 4 5] ] which gives a 2x3 matrix in terms of the matrix convention, but the constructor used (3,2). This might get more confusing when using slices like sequence(3,2)->slice("1:2,(0)") : with traditional matrix convention one would expect [2 4] instead of [1 2]. This subclass PDL::Matrix overloads the constructors and indexing functions of pdls so that they are compatible with the usual matrix con- vention, where the first dimension refers to the row of a matrix. So now, the above example would be written as print $B = PDL::Matrix->sequence(3,2) # or $B = msequence(3,2) [ [0 1] [2 3] [4 5] ] Routines like eigenvalue or matrix inversion can be used without any changes. Furthermore one can construct and use vectors as n x 1 matrices without mentioning the second index '1'. Implementation "PDL::Matrix" works by overloading a number of PDL constructors and methods such that first and second args (corresponding to first and second dims of corresponding matrices) are effectively swapped. It is not yet clear if PDL::Matrix achieves a consistent column major look-and-feel in this way. FUNCTIONS
mpdl, PDL::Matrix::pdl constructs an object of class PDL::Matrix which is a piddle child class, where the first index refers to the first column of the two-dimen- sional piddle. $m = mpdl [[1,2,3],[4,5,6]]; $m = PDL::Matrix->pdl([[1,2,3],[4,5,6]]); mzeroes, mones, msequence constructs a PDL::Matrix object similar to the piddle constructors zeroes, ones, sequence vpdl constructs an object of class PDL::Matrix which is of matrix dimensions (n x 1) print $v = vpdl [0,1]; [ [0] [1] ] vzeroes, vones, vsequence constructs a PDL::Matrix object with matrix dimensions (n x 1), therefore only the first scalar argument is used. print $v = vsequence(2); [ [0] [1] ] PDL::Matrix::slice, PDL::Matrix::dice same as slice, dice for normal piddles, but reflecting the matrix convention by swapping the first two arguments. print sequence(3,2)->slice("1:2,(0)") # piddle [1 2] print msequence(3,2)->slice("1:2,(0)") # PDL::Matrix [2 4] PDL::Matrix::at same as at for piddles, but reflecting the matrix convention by swapping the first two arguments If only one scalar argument is used, we assume the object to be a vector and look only at the first column. PDL::Matrix::set set a particular value in a PDL::Matrix object. Note that this has to be called as an object method rather than a function print msequence(3,3)->set(2,0,-1) # ok with PDL::Matrix convention [ [ 0 1 2] [ 3 4 5] [-1 7 8] ] print set msequence(3,3), 2,0,-1 # does not conform with PDL::Matrix convention [ [ 0 1 -1] [ 3 4 5] [ 6 7 8] ] PDL::Matrix::reshape same as reshape for piddles, but reflecting the matrix convention by swapping the first two arguments mdims returns the dimensions of the PDL::Matrix object in matrix convention "dims" is NOT overloaded by PDL::Matrix to make sure that methods like PDL::transpose still work. So use "mdims" to get the dims in the PDL::Matrix notation. print msequence(3,2)->mdims 3 2 kroneckerproduct returns kroneckerproduct of two matrices. This is not efficiently implemented. det_general returns a generalized determinant of a matrix. If the matrix is not regular, one can specify the rank of the matrix and the corresponding subdeterminant is returned. This is implemented using the "eigens" function. trace returns the trace of a matrix (sum of diagonals) vcrossp, PDL::Matrix::crossp similar to PDL::crossp, however reflecting PDL::Matrix notations BUGS AND PROBLEMS
Because we change the way piddles are constructed, not all pdl operators may be applied to piddle-matrices. The inner product is not rede- fined. We might have missed some functions/methods. Internal consistency of our approach needs yet to be established. TODO
check all PDL functions, benchmarks, optimization, lots of other things ... AUTHOR(S) Stephan Heuel (stephan@heuel.org), Christian Soeller (c.soeller@auckland.ac.nz). COPYRIGHT
All rights reserved. There is no warranty. You are allowed to redistribute this software / documentation under certain conditions. For details, see the file COPYING in the PDL distribution. If this file is separated from the PDL distribution, the copyright notice should be included in the file. perl v5.8.0 2001-12-03 Matrix(3)
All times are GMT -4. The time now is 04:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy