Stops and start


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Stops and start
# 1  
Old 04-17-2012
Stops and start

Hi,

I am not sure how well I can explain this.. Below is the file which I want to perform the code on.. Column 2 are my stop sites and column 3 are my start site.. For every gene I need to look at my starts(column3) and add +10,000 to it only if there is no gene when we move upstream 10,000( which mean the next gene stop site(column2) should not coincide with it).

Code:
chr1	879582	894679	NOC2L
chr1	934341	935552	HES4
chr1	1007125	1009687	RNF223
chr1	1017197	1051736	C1orf159
chr1	1138887	1142089	TNFRSF18
chr1	1146705	1149548	TNFRSF4
chr1	1152287	1167447	SDF4
chr1	1177825	1182102	FAM132A
chr1	1189291	1209234	UBE2J2
chr1	1227763	1243269	ACAP3
chr1	1246964	1260046	CPSF3L
chr1	1270657	1284492	DVL1
chr1	1288070	1293915	MXRA8

For the first gene NOC2L start site is 894679 when I try to add +10,000 its going to be 904679, which does not coincide with the next gene stop site( 934341). If it coincides then that row should be left as it is

output

Code:
chr1	879582	894679	NOC2L
chr1 894680 904679 NOC2L_1
chr1	934341	935552	HES4
chr1 935553 945553 HES4_1

Let me know if I am not clear..

Thanks,
# 2  
Old 04-17-2012
Hi,

try this:

Code:
cat YOURFILE.txt |awk -F " " '{if ($2 == a ) {print $0}; a=$3 + 10001;}'

Moderator's Comments:
Mod Comment Use code tags instead of quote tags, thank you

Last edited by Scrutinizer; 04-17-2012 at 04:24 PM..
# 3  
Old 04-17-2012
Try:
Code:
awk 'v<$2{print p}1; {$2=$3+1; v=$3+=10000; $4=$4"_1"; p=$0} END{print p}' infile

I don't know if END{print p} is necessary, otherwise you can leave that out..
# 4  
Old 04-17-2012
Great it worked...

Thanks,
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Copy Script Stops

Good Morning, I have a copy script on Solaris 9 machine that is supposed to copy some files to a NAS using: cp -r /dir/dir/ /dir/dir/dirThe script doesn't finish. The directory contains user files of which one seems to copy fine, a second was failing until I did achmod -R -777 to it. Now,... (6 Replies)
Discussion started by: Stellaman1977
6 Replies

2. Shell Programming and Scripting

Sendmail when a process stops

I have a process that crashes quite often. I'm unable to fix it since I'm not the developer and it is beyond my control to do so. However restarting the process will fix the issue which is fine. I would like to receive a notification via email that the process has failed so I can login and... (5 Replies)
Discussion started by: deaconf19
5 Replies

3. Solaris

Nohup immediately stops.

I try and start a short script nohup the nohup immediately stops. Here's the code #!/bin/sh rm backup.out for i in `cat /home/xxxxx/Allservers.txt` do echo "Logging onto $i" ssh -qt $i '/usr/local/bin/sudo "/src/bkupsa"' done >>backup.out Any ideas? (3 Replies)
Discussion started by: ekrause77
3 Replies

4. Shell Programming and Scripting

My script stops after logoff...why??

Hi' i am runing a script thats run with a loop...while loop true. when i exit the server..logon and again the script doenst run. its a bash script test.sh. i run it as: #./test.sh & what can be the priblem please? thanks alot (6 Replies)
Discussion started by: zigizag
6 Replies

5. UNIX for Dummies Questions & Answers

while loop stops after a function...

my ksh script is not working... i wanna remove lines in file2.txt from file1.txt # cat file1.txt this is line one this is line two this is line three this is line four this is line five # cat file2.txt this is line two this is line three # cat my_script.ksh #!/bin/ksh i=1 y=1... (8 Replies)
Discussion started by: curtis911
8 Replies

6. Shell Programming and Scripting

Start program in background (or start crontab ahead of time)

Hey! I'm working on a script that will add a user, create some configfiles, and add a crontab for the user. The crontab looks like the following: @reboot /home/user/program config.conf & I would like for this process to start at the end of my script under the corresponding username by... (0 Replies)
Discussion started by: noratx
0 Replies

7. Shell Programming and Scripting

ssh stops a while loop

The while loop exits (early) when a simple ssh command is run. #!/bin/ksh #set -x #------------------------------------------------------------------------- # Functions Section #------------------------------------------------------------------------- while : do cat list.txt|while read... (1 Reply)
Discussion started by: bkdias26
1 Replies

8. UNIX for Dummies Questions & Answers

Mailing attachment stops at 199K

Hi, I have a script which part of it mails an attachment. The command is uuencode $v_file_name.zip "output.zip" | mailx -s "$v_subject" $v_to_email There is a problem that it only sends 199K of an attachment. Is there a reason why it would stop at 199K? I've search the net and nothing... (2 Replies)
Discussion started by: m1l
2 Replies

9. Solaris

ufsrestore stops

Hi, SUN E3500 box. boot cdrom -s create disk partitions mount on /a one of the partitions cd /a ufsrestore -rf dev/rmt/0n Starts create de inodes Starts the extraction and then...... stops the extraction without any error and didnīt extract all files and stays forever waiting for i... (1 Reply)
Discussion started by: spacewalker
1 Replies

10. AIX

LED stops at 406eoch6 help

Hi can anybody help me when i boot up my machine the LED runs until it gets to 406coch6 and it simply stops their noting appears on the screen...? Is their a website that lists all the codes and their meaning Thanks Liam (2 Replies)
Discussion started by: lodonovan
2 Replies
Login or Register to Ask a Question