Sliding window for sequencing data


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Sliding window for sequencing data
# 1  
Old 02-19-2010
Sliding window for sequencing data

Hi!

I have some sequencing data that I have aligned using maq software

Now, I have data that looks like this each line is a 'tag'

chr1 10001
chr1 10002
chr1 10005
chr1 10007
chr1 10008
chr1 10008
chr1 10008
chr1 10019
chr1 10019
chr1 10020

What I really want to find out is how many of these 'tags' i've got in a space of 150 units (column 2 contains coordinates in units where the tag is). So ideally some way of looking at each line, looking at the coordinate on each line then seeing how many other tags there are 75 units either side of this coordinate. Then maybe print this value in a third column?

Does that make sense? I am a relative unix newbie and have no idea where to start. I've been messing around with awk for a while trying to think of something but I'm clueless. Any help much appreciated

awk -v x=$2 '$2 == $x+150' |<- my pitiful attempt to get started
# 2  
Old 02-19-2010
Could you give an example of the desired output?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Search and replace with a sliding window

Hi Unix Gurus, I have a file with data like: >header_1 TCCCCGA >header_2 CCAATTGGGTA The data to work with starts from the next line after '>header_xx'. (1) I want to search the three letter patterns 'CHH' or 'DDG' and replace C and G by exclamation ! so that CHH becomes !HH and DDG... (3 Replies)
Discussion started by: Fahmida
3 Replies

2. Shell Programming and Scripting

How do add values in a vector using a sliding window?

Greetings. I have a vector of numbers such as the following: 1 75 79 90 91 92 109 120 167 198 203 204 206 224 230 236 240 (4 Replies)
Discussion started by: Twinklefingers
4 Replies

3. IP Networking

TCP Same Ack Sequencing for Two Packets

I was analyzing a TCP snoop. And found following scenario From Server to Client ---> SEQ 2993 ACK 1744 WIN 8192 LEN 13 From Server to Client ---> SEQ 3006 ACK 1744 WIN 8192 LEN 13 From Client to server --> SEQ 1744 ACK 3019 WIN 3304 I just want to know Why Packet 1 and 2... (3 Replies)
Discussion started by: mr_deb
3 Replies

4. Shell Programming and Scripting

Sliding window for string manipulation

I have a sting of "0"s and "1"s that I need to analyze. I need to look at each "1" and determine if it is in a neighborhood that is enriched for "1"s which means it is one of at least three "1"s in a 4 character window. My desired output is a count of "1"s in an enriched area. For Example Input... (1 Reply)
Discussion started by: monstrousturtle
1 Replies

5. UNIX for Dummies Questions & Answers

"Sliding window" with variables

I'm doing a little work that involves computing the average completion time of the last 5 of many file decompressions. It's not too tough, but I'm wondering if maybe there's a better way to write it. This is a bash script; here's the current idea: ctime5=$ctime4 ctime4=$ctime3 ctime3=$ctime2... (2 Replies)
Discussion started by: treesloth
2 Replies

6. Shell Programming and Scripting

Help generating a script for next-generation sequencing data

I am not sure if this is entirely possible, but I want to compare data in a particular column in several .txt files and have a new file generated. I am a biologist with limited unix knowledge. There are currently no programs written for this type of analysis. First I would like to define the... (1 Reply)
Discussion started by: kellywilliams
1 Replies

7. UNIX for Dummies Questions & Answers

Sliding window

Very simple problem I am not able to solve. I have been trying to modify the following code: awk '{t=$1; c = x}{for (i = 1; i <= length; i += wn)print t FS"" substr($2, i, mx) > ("block" ++c)}' mx=100 wn=100 infile.txt What I am tryng to acccomplish, I have a bunch of files where the first... (3 Replies)
Discussion started by: Xterra
3 Replies

8. Programming

Proximity-card reader: no data when app window out of focus

Hello. I can't get it work :( My application receives data from em-marin reader only being active. Switching to another app makes the port become silent. MarinReader works in another thread. Port reading is going while the app is inactive (tested). Env: Ubuntu 9.04, Gnome, Qt (i've tryed pure... (2 Replies)
Discussion started by: Dp0H
2 Replies

9. UNIX for Dummies Questions & Answers

grab the data from the unix window

Hi, How could i grab a set of data (eg:file execution start & stop time stamp f) from unix? (1 Reply)
Discussion started by: siriv
1 Replies

10. Programming

Ideas Please (File Sequencing)

Hello All Hope someone can help me with an idea or two on how to approach the following situation; I currently have a process that generates sequenced files. The sequencing is very important and skipping sequences are not allowed. The applicaton has a single thread that consume data produced... (9 Replies)
Discussion started by: bcpkvh
9 Replies
Login or Register to Ask a Question