this is my input file:
AAAAAAAAAA;GSM1;17
AAAAAAATCA;GSM1;1
AAAAAAATTT;GSM1;1
AAAAAACAAA;GSM1;1
AAAAAACTCC;GSM1;1
AAAAAATAAA;GSM1;1
AAAAACAAAA;GSM1;1
AAAAAAAAAA;GSM10419;54
AAAAAAAAAC;GSM10419;2
AAAAAAAAAG;GSM10419;1
with gawk and without comment out this line:
if ( idx in tag) delete...
I don't know why but this code below used to perfom crosstab query (see crosstab with AWK question)returns
mismatch (with printing duplicate lines) if I use gawk interpretor instead awk. My gawk version is: GNU Awk 3.1.4.
what's wrong ?
BEGIN {
FS=OFS=";"
}
{
if ( !($2 in cols) )...
thanx again to futurelet for this code.
this awk code is pretty reasonable but curiously it's not get a big amount speedups probably because elements in "data" array (inside the loop) are not deleted with delete statement with each turn of loop. Vlad do it in his code.
I think something can be added to speed-up the code, maybe by using a function involved in the comparison step into the loop... I work it on...If you have some ideas, please fun !
Congratulation vlad and thank you so much for this help,
your code work fine.
So this the entire code with comments and description:
#!/usr/bin/awk -f
################################################################################
# crosstab.awk perform cross table analysis
# need to use a...
Dear Duncan,
these 2 tables don't marry-up!
first you have a tab (or comma) tabulated text file as the
format below:
tag;gsm;count
AAAAAAAAAA;GSM31945;6
AAAAAAAAAA;GSM3240;6
AAAAAACCCA;GSM3242;6
AAAAAAAGCA;GSM3243;6
AAAAAATACA;GSM41375;1
AAAAAATTTA;GSM41375;1
AAAAACACTC;GSM41378;1...
Cross tabulations are statistical reports where you de-normalize your data and show results grouped by one field, having one column for each distinct value of a second field.
This cross tabulations are usualy made using SQL language into dababase engine, but I want to fix it using a simple awk...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.