Snps annotation


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Snps annotation
# 8  
Old 01-29-2017
I thought my questions were clear. Let me try one more time:

for #3: Show us the exact text that you typed as a command to the /bin/bash shell running in the terminal terminal emulator running on your "mac" to which it responded:
Quote:
Code:
 after for(i = 1; i <= k; i++) it lists all my files in the directory

awk: cmd. line:12: >= $5 && POS[i] <= $6)
awk: cmd. line:12: ^ syntax error
awk: cmd. line:12: >= $5 && POS[i] <= $6)
awk: cmd. line:12:                      ^ syntax error
awk: cmd. line:13: t $1, ID[i], $3, POS[i], $5, $6
awk: cmd. line:13:     ^ syntax error
awk: cmd. line:13: t $1, ID[i], $3, POS[i], $5, $6
awk: cmd. line:13:            ^ syntax error
awk: cmd. line:13: t $1, ID[i], $3, POS[i], $5, $6
awk: cmd. line:13:                        ^ syntax error

and for #4: We have to assume that you saved the text of the awk script I gave you in post #4 in this thread in a file on your system. Show us the output you get from the command:
Code:
od -bc < filename

where you replace filename with the name of the file in which you saved the awk script I gave you in post #4 in this thread.
# 9  
Old 01-29-2017
is the following correct to save the script
Code:
 awk '
BEGIN {	print "gene      ID        CHROM  POS       txstart      txend"
}
FNR == 1 {
	next
}
FNR == NR {
	POS[++k] = $2
	ID[k] = $3
	next
}
{	for(i = 1; i <= k; i++)
		if(POS[i] >= $5 && POS[i] <= $6)
			print $1, ID[i], $3, POS[i], $5, $6
}' pre_snpinfo_tumor.txt  refFlat.txt > data.txt

if yes the od -bs < data.txt gave me
0000000


for 3) I got
Code:
awk '
> BEGIN {print "gene      ID        CHROM  POS       txstart      txend"
> }
> FNR == 1 {
> next
> }
> FNR == NR {
> POS[++k] = $2
> ID[k] = $3
> next
> }
> {for(i = 1; i <= k; i++)
> 
annotation.vcf             out.txt
annovar.latest.tar         plink-1.07-i686/
A_thaliana_Jun_2009.2bit   plink-1.07-i686.zip
.bash_history              plink-1.07-i868
bedtools2/                 pre_snpinfo_normal.txt
bedtools-2.25.0.tar.gz     pre_snpinfo_tumor1.txt
bedtools-2.25.0.tar.gz.1   Pre_snpinfo_tumor1.txt
bin/                       pre_snpinfo_tumor2.txt
bposition.txt              pre_snpinfo_tumor.txt
BRCA/                      pre_snpinfo_tumor.txt.bak
BRCA_gene_RSEM.txt         pre_snp_normal.txt
BRCA_SNP6.normal.gt        pre_snp_tumor1.txt
BRCA_SNP6.tumor.gt         pre_snp_tumor2.txt
.ccache/                   pre_snp_tumor3.txt
clinvar.vcf                pre_snp_tumor.txt
datasnp                    R/
datasnp.rtf                .RDataTmp
datasnp.txt                refFlat.txt
data.tumor                 .Renviron
data.tumor.txt             rminer_1.4.2.tar.gz
datatumor.txt              rminer_1.4.2.tar.gz.1
data.txt                   short1_pre_snp_tumor.txt
dd.txt                     short2_gwas.map
dn.txt                     short2_gwas.ped
dt.txt                     short2_pre_snp_tumor.txt
.emacs                     snpanno
geneinfo-3.txt             snpEff/
geneinfo_normal.txt        snpEff_latest_core.zip
gene_normal.txt            snpinfo_normal.txt
gene.rtf                   snpinfo_tumor.txt
.gnome2/                   snp_normal.txt
gwas.map                   snp_tumor.txt
gwas.ped                   .ssh/
index.html                 temp
.kshrc                     test.chr22.ann.vcf
.mkshrc                    transpose-2.0/
.mozilla/                  transpose-2.0.zip
nohup.out                  tumor.exp.gt.txt
normal.exp.gt.txt          .viminfo
out1.txt                   .zshrc
out_file                   
> >= $5 && POS[i] <= $6)
> 
annotation.vcf             out.txt
annovar.latest.tar         plink-1.07-i686/
A_thaliana_Jun_2009.2bit   plink-1.07-i686.zip
.bash_history              plink-1.07-i868
bedtools2/                 pre_snpinfo_normal.txt
bedtools-2.25.0.tar.gz     pre_snpinfo_tumor1.txt
bedtools-2.25.0.tar.gz.1   Pre_snpinfo_tumor1.txt
bin/                       pre_snpinfo_tumor2.txt
bposition.txt              pre_snpinfo_tumor.txt
BRCA/                      pre_snpinfo_tumor.txt.bak
BRCA_gene_RSEM.txt         pre_snp_normal.txt
BRCA_SNP6.normal.gt        pre_snp_tumor1.txt
BRCA_SNP6.tumor.gt         pre_snp_tumor2.txt
.ccache/                   pre_snp_tumor3.txt
clinvar.vcf                pre_snp_tumor.txt
datasnp                    R/
datasnp.rtf                .RDataTmp
datasnp.txt                refFlat.txt
data.tumor                 .Renviron
data.tumor.txt             rminer_1.4.2.tar.gz
datatumor.txt              rminer_1.4.2.tar.gz.1
data.txt                   short1_pre_snp_tumor.txt
dd.txt                     short2_gwas.map
> t $1, ID[i], $3, POS[i], $5, $6
> }' pre_snpinfo_tumor.txt  refFlat.txt > data.txt
awk: cmd. line:12: >= $5 && POS[i] <= $6)
awk: cmd. line:12: ^ syntax error
awk: cmd. line:12: >= $5 && POS[i] <= $6)
awk: cmd. line:12:                      ^ syntax error
awk: cmd. line:13: t $1, ID[i], $3, POS[i], $5, $6
awk: cmd. line:13:     ^ syntax error
awk: cmd. line:13: t $1, ID[i], $3, POS[i], $5, $6
awk: cmd. line:13:            ^ syntax error
awk: cmd. line:13: t $1, ID[i], $3, POS[i], $5, $6
awk: cmd. line:13:                        ^ syntax error

---------- Post updated at 02:04 AM ---------- Previous update was at 01:29 AM ----------

i have a question does unix knows that CHOM, POS, ID are the header
like in R we type in read.table (" file,header=TRUE")

because I added the header ...the data was with no header (snp data)
so I wonder if it understand that those are the header

Last edited by marwah; 01-29-2017 at 04:11 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

2 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Map snps into a ref gene file

I have the following data set about the snps ID txt file POS ID 78599583 rs987435 33395779 rs345783 189807684 rs955894 33907909 rs6088791 75664046 rs11180435 218890658 rs17571465 127630276 rs17011450 90919465 rs6919430 and a gene... (7 Replies)
Discussion started by: marwah
7 Replies

2. UNIX for Dummies Questions & Answers

How to average value if they have the same annotation names?

Hi I have a file like this input_fileCR387793 -0.8 CR387793 -5.5 CR387794 -5.3 CR387795 -0.9 AR388755 -3.0 AR388755 3.8 AR388755 4.5 Each line has annotation name and its correlated value. The annotation name and the value are seperated by a space. I want to average the value if the lines... (4 Replies)
Discussion started by: yuejian
4 Replies
Login or Register to Ask a Question