Search Results

Search: Posts Made By: Sanchari
3,890
Posted By nezabudka
cat pattern.txt chr1 1000 2000 chr1 ...
cat pattern.txt
chr1 1000 2000 chr1 10000 11000
chr1 1000 2000 chr1 11000 12000
chr1 1000 2000 chr1 12000 13000
cat DB_file.txt
chr1 1000 ...
3,113
Posted By SriniShoo
yes, it would. Try to pass the file name...
yes, it would. Try to pass the file name correctly and handle it in code
3,113
Posted By rdrtx1
try also: awk ' NR>1{l[$1]=$1; c[$1]++; ...
try also:
awk '
NR>1{l[$1]=$1; c[$1]++;
for (i=2; i<=NF; i++) a[$1,i]+=$i;
}
END {
for (g in l) {
printf g " ";
for (i=2; i<=NF; i++) printf ("%.1f ", (a[g,i]/c[g]));
...
3,113
Posted By MadeInGermany
l[$1]=$1 is a useless value; l[$1] alone defines...
l[$1]=$1 is a useless value; l[$1] alone defines the key (no value).
Or store the length, i.e. allow an individual length for each gene type:
awk '
NR>1 {
L[$1]=NF; c[$1]++
for (i=2;...
3,113
Posted By Akshay Hegde
This is by reading same file twice, you can also...
This is by reading same file twice, you can also process this in END block

$ cat file
Gene Sample_1 Sample_2 Sample_3
gene_A 2 4 5
gene_B 1 2 3
gene_A 0 5 7
gene_B 4 5 6
gene_A 11 12 13...
1,050
Posted By pilnet101
awk '{if(!($1 $2 in a) && !($2 $1 in...
awk '{if(!($1 $2 in a) && !($2 $1 in a)){print};{a[$1 $2]++}}'
1,140
Posted By Scrutinizer
Try: awk -F, '$3<=-0.5 || $3>=0.5' file ...
Try: awk -F, '$3<=-0.5 || $3>=0.5' file



--
BTW your input does not correspond to your output. That should probably be:
A,B,0.6
C,D,-0.7
1,095
Posted By vgersh99
awk '$1 != $2 && $1=$1' OFS=, myFile
awk '$1 != $2 && $1=$1' OFS=, myFile
1,054
Posted By Akshay Hegde
Output order will be same as that of...
Output order will be same as that of edge_list.txt
Try :
$ awk 'FNR==NR{A[$1];next}($1 in A || $2 in A)' input.txt edge_list.txt
A B
J H
C A
G H
H A
K G
1,272
Posted By Scrutinizer
Hi, this is a fairly frequent question. If the...
Hi, this is a fairly frequent question. If the file is sorted try:
awk 'p!=$1{if(s)print s; p=$1; s=$0; next} {s=s OFS $2} END{print s}' file
1,272
Posted By Akshay Hegde
May try this...for given input this will work ...
May try this...for given input this will work

$ cat file
LOC_Os01g01870 GO:0006139
LOC_Os01g01870 GO:0009058
LOC_Os01g02570 GO:0006464
LOC_Os01g02570 GO:0009987
LOC_Os01g02570 ...
1,440
Posted By CarloM
$ grep -f nodes.txt edge.txt LOC_Os11g37970 ...
$ grep -f nodes.txt edge.txt
LOC_Os11g37970 LOC_Os04g47140
LOC_Os03g19480 LOC_Os02g47060
LOC_Os03g49630 LOC_Os03g19480
LOC_Os04g50860 LOC_Os11g37970
Although you don't get the header...
1,440
Posted By Yoda
Using awk: awk 'NR==FNR{A[$1];next}$1 in A ||...
Using awk:
awk 'NR==FNR{A[$1];next}$1 in A || $2 in A' node.txt edge.txt
1,719
Posted By Yoda
Using awk: awk '$3 >= 0.02' file
Using awk:
awk '$3 >= 0.02' file
1,194
Posted By disedorgue
Another way with sort: $ sed -n '2,$p' file |...
Another way with sort:
$ sed -n '2,$p' file | sort -n -k1,1 -k3,3 | sort -ur -k1,1
sed to suppress first line (column name).
Regards.
1,194
Posted By bartus11
Put this into "script.awk":function abs(x){ ...
Put this into "script.awk":function abs(x){
return ((x < 0.0) ? -x : x)
}
NR>1{
if (max[$1]<abs($3)){
max[$1]=abs($3)
a[$1]=$2
b[$1]=$3
}
}
END{
for (i in a){
...
1,201
Posted By Yoda
Using awk: awk '{if(A[$1]<$2||!(A[$1]))...
Using awk:
awk '{if(A[$1]<$2||!(A[$1])) A[$1]=$2}END{for(k in A) print k,A[k]}' file
Showing results 1 to 17 of 17

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