Sponsored Content
Full Discussion: Snps annotation
Top Forums UNIX for Beginners Questions & Answers Snps annotation Post 302990586 by Don Cragun on Sunday 29th of January 2017 12:33:03 AM
Old 01-29-2017
Quote:
Originally Posted by marwah
you are so hard on me , by the way i'm not trying to confuse you or test your memory, I don't know how to modeify the code , If you can help please do so
I'm not trying to be hard on you. This site is here to help you and many, many others learn how to write code to do what you want or need to do. It is not here to act as your unpaid programming staff.

I didn't mean to imply that you were trying to confuse me or test me. I meant to say that copying someone's code without attribution and implying it is your own is plagiarism.

If you don't understand how that code works and what needs to be done to it to make it work with a different input file format, why don't you look at the awk man page on your system and try to figure out what the code is doing. If you can't figure it out, ask questions and the volunteers here will be happy to try to help you learn how it works and suggest what might need to be changed to work with your new file format.

Someone might also show you how to add a BEGIN clause to your awk script to print the heading you want in your output file. Maybe even something like:
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

As always, since you haven't bothered to tell us what operating system you're using, if you're using a Solaris/SunOS system change awk to /usr/xpg4/bin/awk or nawk.

With the sample input files you provided in post #1 in this thread, the above code produces the output:
Code:
gene      ID        CHROM  POS       txstart      txend
MAGI2 rs987435 chr7 78599583 77484309 78920826

exactly as requested.
 

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
ppmtosixel(1)                                                 General Commands Manual                                                ppmtosixel(1)

NAME
ppmtosixel - convert a portable pixmap into DEC sixel format SYNOPSIS
ppmtosixel [-raw] [-margin] [ppmfile] DESCRIPTION
Reads a portable pixmap as input. Produces sixel commands (SIX) as output. The output is formatted for color printing, e.g. for a DEC LJ250 color inkjet printer. If RGB values from the PPM file do not have maxval=100, the RGB values are rescaled. A printer control header and a color assignment table begin the SIX file. Image data is written in a compressed format by default. A printer control footer ends the image file. OPTIONS
-raw If specified, each pixel will be explicitly described in the image file. If -raw is not specified, output will default to com- pressed format in which identical adjacent pixels are replaced by "repeat pixel" commands. A raw file is often an order of magni- tude larger than a compressed file and prints much slower. -margin If -margin is not specified, the image will be start at the left margin (of the window, paper, or whatever). If -margin is speci- fied, a 1.5 inch left margin will offset the image. PRINTING
Generally, sixel files must reach the printer unfiltered. Use the lpr -x option or cat filename > /dev/tty0?. BUGS
Upon rescaling, truncation of the least significant bits of RGB values may result in poor color conversion. If the original PPM maxval was greater than 100, rescaling also reduces the image depth. While the actual RGB values from the ppm file are more or less retained, the color palette of the LJ250 may not match the colors on your screen. This seems to be a printer limitation. SEE ALSO
ppm(5) AUTHOR
Copyright (C) 1991 by Rick Vinci. 26 April 1991 ppmtosixel(1)
All times are GMT -4. The time now is 02:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy