Search Results

Search: Posts Made By: genome
3,613
Posted By genome
Calculate e raise to the power in awk | UNIX
Input data:



I'd like to calculate using value in second column. The value needs to be created using a formula, that employs exp (that is e raise to the power).

awk '{

if(FNR==1){
##if...
6,918
Posted By genome
BUF[TMP=substr($2,1,index($2,":")-1), ++CNT[TMP]]...
BUF[TMP=substr($2,1,index($2,":")-1), ++CNT[TMP]]


I am totally incapable of understanding this code snippet. Before comma I can see splitting, substring but , ++CNT[TMP]
May you please help?
6,918
Posted By genome
Oh, no print needed? Thanks. It's pretty. ...
Oh, no print needed? Thanks. It's pretty.



Yes, I was loading and reading file 22 times. Sorry, can't understand your code.
How and what logic is being implemented.

Thank you as always for...
6,918
Posted By genome
Thank you. for i in {1..22} do ...
Thank you.



for i in {1..22}
do



awk -v chr="^$i:" '{ ...
6,918
Posted By genome
Search for string in column using variable: awk
I'm interested to match column pattern through awk using an external variable for data:


-9 1:751343:T:A -9 0 T A 0.726 -5.408837e-03 9.576603e-03 7.967536e-01 5.722312e-01...
4,200
Posted By genome
Oh, thanks.
Oh, thanks.
4,200
Posted By genome
Awk: split column if special characters
Hi,

I've data like these:


Gene1,Gene2 snp1
Gene3 snp2
Gene4 snp3


I'd like to split line if comma and then print remaining information for the respective gene.

My code:




awk...
7,210
Posted By genome
Hi Rudic: Even if I do: awk...
Hi Rudic:

Even if I do:


awk '{out=""; for(i=6;i<=NF;i++){out=$out" "$i}; print $out}' pot.txt

This doesn't have any variables that print from first column.


print...
7,210
Posted By genome
Awk: printing column using for loop
Hello:

I've input data:

Input data

--- 3:60069:C:T 60069 C T 1 0 0 1 0 0 1 0 0 1 0 0 1
--- 3:60079:A:G 60079 A G 1 0 0 0.988 0.012 0 1 0 0 1 0 0 1
--- rs186476240:60157:G:A 60157 G A 1 0 0...
811
Posted By genome
Code has a bug somewhere. Pasting 20,000 wouldn't...
Code has a bug somewhere. Pasting 20,000 wouldn't be possible.


FNR == 1

Should I be using this?
811
Posted By genome
awk common between files
Hello there:

I want to find common among files. They all have one column.

Format for data:

CEU_snp_CHR21.txt

21:10758305
21:10827533
21:10913441
21:10920098
21:10952160...
2,482
Posted By genome
MadeInGermany: Thanks for the tip. :)
MadeInGermany: Thanks for the tip. :)
2,482
Posted By genome
Thanks for your reply. awk ' { ...
Thanks for your reply.



awk '

{
if(!snp[$2]){ snp[$2] = $0
cnt[$2]++
arr[++SN]=$2
}
else{ snp[$2] = snp[$2] " " $0 " "
cnt[$2]++
}
}
END {
for( i in snp){
if(cnt[i] == 2){...
2,482
Posted By genome
Awk: Error with END
Hello,

I can't understand why there's an error with End with simple code.

Data:

rs10458597 1:564621
rs2185539 1:566875
rs11240767 1:728951
rs12564807 1:734462
rs3131972 1:752721...
3,430
Posted By genome
@Scrutinizer: Thanks. This one works as...
@Scrutinizer:

Thanks. This one works as needed


grep " have the same position." input.log | awk -v re="^'exm" ' { if (! ( $5 ~ re )) print $0 }'



It's hard for me not use if and...
3,430
Posted By genome
Thanks. It frustrates me how simple things...
Thanks.
It frustrates me how simple things don't work on awk/bash.



grep " have the same position." input.log | awk ' { if( $5 ~ /^\x027exm/ ){print $0} } '


I added exm to \x027
If I...
3,430
Posted By genome
Hi Rudic, Sorry, I've edited my post....
Hi Rudic,

Sorry, I've edited my post. Missed the case I'm intending to use awk and if.
3,430
Posted By genome
Awk: single quote match in If
Hello,

I'd like to print line if column 5th doesn't match with exm. But to reach there I have to make sure I match single quote.
I'm struggling to match that.

I've input file like:

...
5,458
Posted By genome
@RudiC: Thank you for your reply. I read awk...
@RudiC:
Thank you for your reply. I read awk man page.

Apologies for my repeats on this post.
I know the code is reading files twice, but which lines manage it, I'm wondering. :(

Copying...
5,458
Posted By genome
Hi Rudic Sorry for my delay in writing back....
Hi Rudic

Sorry for my delay in writing back.
I am still going through your code and am struck with it.
I'm copying few lines from #9:



awk '
BEGIN {TF = ARGC - 1 ...
5,458
Posted By genome
Sorry, rudic I can't understand now too. ...
Sorry, rudic I can't understand now too.


FNR == 1

How does this help?

If occurrence of $2 is equal to file count:

CNT[$2] == TF {if (!LINE[$2]) SEQ[++SN] = $2 # only...
5,458
Posted By genome
@RudiC: Yup, I saw that just now. I can't get...
@RudiC:
Yup, I saw that just now. I can't get my head around it. TF, FC I'm absolutely stumped by it. Please explain.
5,458
Posted By genome
Do you mind explaining what and how it does what?
Do you mind explaining what and how it does what?
5,458
Posted By genome
for i in {1..22} do #--iterate over...
for i in {1..22}
do
#--iterate over chromosomes
saveTemp=""
files_info="$(find $input_dir -name "*_CHR$i.info" | sort )"
files_list=""

#---split by new lines and make...
1,555
Posted By genome
Thanks don. ($( this should be good!
Thanks don.
($(
this should be good!
Showing results 1 to 25 of 58

 
All times are GMT -4. The time now is 02:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy