Matrix


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Matrix
# 8  
Old 01-27-2011
Code:
awk 'FNR==1{h=h (h?FS:x) FILENAME}{A[FNR]=A[FNR](A[FNR]?x:$1) FS $2}
     END{gsub(/\.txt/,x,h);print h;for(i=1;i<=FNR;i++)print A[i]}' *.txt

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

List to matrix

I want to go from 1,a,1a 1,b,1b 1,c,1c 2,a,2a 2,b,2b 3,a,3a to a,b,c 1,1a,1b,1c 2,2a,2b,- 3,3a,-,- Here is what I tried awk -F, 'BEGIN {OFS = ","} (4 Replies)
Discussion started by: senhia83
4 Replies

2. Shell Programming and Scripting

MATRIX to CSV

Hello friends, A big question for the UNIX INTELLIGENCE I have a CSV file as follows: VALUE,USER1,relatedUSER1,relatedUSER2 -1,userA,userB,userC 1,userN,userD,userB 0,userF,userH,userG 0,userT,userH,userB 1,userN,userB,userA -1,userA,userF,userC 0,userF,userH,userG... (15 Replies)
Discussion started by: kraterions
15 Replies

3. Shell Programming and Scripting

column to matrix

Hello All, I need your help in the following problem. I have a matrix of 500 columns and 1000 rows and in each cell, it is having a value range from 0 to 9. I would like to convert each column in to a matrix, according to the value in each cell (ie) 0 to 9. For each column, I need a matrix... (5 Replies)
Discussion started by: Fredrick
5 Replies

4. Shell Programming and Scripting

Table to Matrix

Hi, I have a table in the format: 1 0 -1 1 0 2 0 1 -1 0 0 0 3 0 1 1 0 0 0 0 0 0 etc. I am trying to input this to a program, however it is complaining about the fact that it is not in matrix format. How do I add 0's to end of the rows to make them even? Thanks in advance! (2 Replies)
Discussion started by: Rhavin
2 Replies

5. 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

6. Programming

Matrix code in C++

I have the code below in C++ and am trying to understand what these do and how to call them. template <class Type> class Matrix { public: Matrix(); Matrix( const int m, const int n ); Matrix( const Matrix& A ); ~Matrix(); (0 Replies)
Discussion started by: kristinu
0 Replies

7. 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

8. Shell Programming and Scripting

Matrix construction

Hi experts How to construct a rectangular matrix for a text file with 6012 rows and 2221 columns. Thank You (1 Reply)
Discussion started by: riyabio
1 Replies

9. 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
Login or Register to Ask a Question
Bio::Matrix::MatrixI(3pm)				User Contributed Perl Documentation				 Bio::Matrix::MatrixI(3pm)

NAME
Bio::Matrix::MatrixI - An interface for describing a Matrix SYNOPSIS
# Get a Matrix object DESCRIPTION
This is an interface describing how one should be able to interact with a matrix. One can have a lot of information I suppose and this outline won't really work for PWM or PSSMs. We will have to derive a particular interface for those. 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 email or the web: https://redmine.open-bio.org/projects/bioperl/ AUTHOR - Jason Stajich Email jason-at-bioperl.org APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ matrix_id Title : matrix_id Usage : my $id = $matrix->matrix_id Function: Get the matrix ID Returns : string value Args : matrix_name Title : matrix_name Usage : my $name = $matrix->matrix_name(); Function: Get the matrix name Returns : string value Args : get_entry Title : get_entry Usage : my $entry = $matrix->get_entry($rowname,$columname) Function: Get the entry for a given row,column pair Returns : scalar Args : $row name $column name get_column Title : get_column Usage : my @row = $matrix->get_column('ALPHA'); Function: Get a particular column Returns : Array (in array context) or arrayref (in scalar context) of values Args : name of the column get_row Title : get_row Usage : my @row = $matrix->get_row('ALPHA'); Function: Get a particular row Returns : Array (in array context) or arrayref (in scalar context) of values Args : name of the row get_diagonal Title : get_diagonal Usage : my @diagonal = $matrix->get_diagonal; Function: Get the diagonal of the matrix Returns : Array (in array context) or arrayref (in scalar context) Args : none column_num_for_name Title : column_num_for_name Usage : my $num = $matrix->column_num_for_name($name) Function: Gets the column number for a particular column name Returns : integer Args : string row_num_for_name Title : row_num_for_name Usage : my $num = $matrix->row_num_for_name($name) Function: Gets the row number for a particular row name Returns : integer Args : string num_rows Title : num_rows Usage : my $rowcount = $matrix->num_rows; Function: Get the number of rows Returns : integer Args : none num_columns Title : num_columns Usage : my $colcount = $matrix->num_columns Function: Get the number of columns Returns : integer Args : none reverse Title : reverse Usage : my $matrix = $matrix->reverse Function: Get the reverse of a matrix Returns : Args : row_names Title : row_names Usage : my @rows = $matrix->row_names Function: The names of all the rows Returns : array in array context, arrayref in scalar context Args : none column_names Title : column_names Usage : my @columns = $matrix->column_names Function: The names of all the columns Returns : array in array context, arrayref in scalar context Args : none perl v5.14.2 2012-03-02 Bio::Matrix::MatrixI(3pm)