Sponsored Content
Full Discussion: Snps annotation
Top Forums UNIX for Beginners Questions & Answers Snps annotation Post 302990583 by marwah on Saturday 28th of January 2017 09:35:05 PM
Old 01-28-2017
Snps annotation

I have the following Snps data
Code:
 CHROM	POS	ID
chr7	78599583	rs987435
chr15	33395779	rs987436
chr1	189807684	rs987437
chr20	33907909	rs987438
chr12	75664046	rs987439

and the following gene data
Code:
genename    name    chrom   strand  txstart txend
MAGI2	NM_001301128	chr7	-	77484309	78920826	77486567	78920572	21
MRPS18C	NM_001297769	chr4	+	84596108	84601900	84596254	84601206	5
MRPS18C	NM_001297767	chr4	+	84596108	84601900	84596254	84601374	5
GCOM1	NM_001018091	chr15	+	55671393	55797047	55671524	55794059	13
FAHD1	NM_001018104	chr16	+	1817225	1830204	1817231	1828128	3
FAM134B	NM_001034850	chr5	-	16526146	16670167	16527849	16670080	9

I'm trying to find the snp whose postion (POS) lie between the txstart and txend in the gene data
so for this data I have the first SNP will lie between MAGI2 txstart and txend

the out put should be
Code:
gene      ID        CHROM  POS       txstart      txend
MAGI2 rs987435 chr7 78599583 77484309 78920826

I have tried the following but it didn't work
Code:
awk '
FNR==1 {next}
FNR == NR {
        POS[++k]=$1
        ID[k]=$2
        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

snps data= pre_snoinfo_tumor.txt
gene dat=refFlat.txt

Last edited by marwah; 01-29-2017 at 05:10 AM..
 

2 More Discussions You Might Find Interesting

1. 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

2. 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
All times are GMT -4. The time now is 09:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy