Question: Transpose For Tab-Delimited File?
1
gravatar for Elaine Angelino
9.6 years ago by
Elaine Angelino20 wrote:
hi there! i'm very new to galaxy and it looks very cool. short version of my question: is there a way to take the transpose of a tabular file? longer: i have a tab-delimited file of SNP data, where each row corresponds to a SNP and each column corresponds to an individual (or other attribute with per-SNP information, ex. chromosome or gene information). for example, i would like to make a tab-delimited file where each row corresponds to an individual and each column corresponds to a SNP. then i would like to convert to hapmap format, etc. thanks for any help! elaine
galaxy • 2.0k views
ADD COMMENTlink modified 9.6 years ago by Anton Nekrutenko1.7k • written 9.6 years ago by Elaine Angelino20
1
gravatar for Cook, Malcolm
9.6 years ago by
Cook, Malcolm30 wrote:
Elaine, et al, Here is a small perl script that might help you. It uses the perl module Array::Transpose. #!/usr/bin/env perl # PURPOSE: output the tab-delimited transpose of whitespace-delimited # matrix. Take input from STDIN unless -t provided, in which case use # the test __DATA__ (below). # AUTHOR: malcolm_cook@stowers.org use strict; use warnings; use Getopt::Std; use Array::Transpose; our $opt_t; getopts('t'); *ARGV=*DATA if $opt_t; my @L; while (<>) { push(@L,[split]); } local($,,$\)=("\t","\n"); print @$_ foreach transpose(\@L); exit 0; __DATA__ a b c d 1 2 3 4 ________________________________________ To: galaxy-user@bx.psu.edu Subject: [galaxy-user] transpose for tab-delimited file? hi there! i'm very new to galaxy and it looks very cool. short version of my question: is there a way to take the transpose of a tabular file? longer: i have a tab-delimited file of SNP data, where each row corresponds to a SNP and each column corresponds to an individual (or other attribute with per-SNP information, ex. chromosome or gene information). for example, i would like to make a tab-delimited file where each row corresponds to an individual and each column corresponds to a SNP. then i would like to convert to hapmap format, etc. thanks for any help! elaine
ADD COMMENTlink written 9.6 years ago by Cook, Malcolm30
0
gravatar for Anton Nekrutenko
9.6 years ago by
Penn State
Anton Nekrutenko1.7k wrote:
Dear Elaine: Suppose you have a list of SNP like this: SNP Individual A 1 B 1 C 1 A 2 D 2 E 3 If you use Group tool (Join, Subtract, Group -> Group) with parameters as shown in the attached figure you will get this: 1 ['A', 'B', 'C'] 2 ['A', 'D'] 3 E It does print these brackets for the moment, but this will be fixed once the Galaxy site in updated on Monday. Let me know if this helps. anton
ADD COMMENTlink written 9.6 years ago by Anton Nekrutenko1.7k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 172 users visited in the last hour