Sponsored Content
Top Forums Shell Programming and Scripting Deleting sequences based on character frequency Post 302430285 by Scrutinizer on Thursday 17th of June 2010 05:04:12 AM
Old 06-17-2010
Hi, this should do it:
Code:
WHINY_USERS=1 awk '/^>/{id=$0;next}length>=5&&length<=18{F[$1]++;if (!I[$1]) I[$1]=id} 
                   END{for(i in I)printf "%s Freq %s\n%s\n",I[i],F[i],i}' infile

Combining these two:
Code:
WHINY_USERS=1 awk '/^>/{id=$0;next}length>=5&&length<=18{F[$1]++;if (!I[$1]) I[$1]=id} 
                   END{for(i in I)if (F[i]>=5) printf "%s Freq %s\n%s\n",I[i],F[i],i}' infile

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Deleting all characters from 350th character to 450th character from the log file

Hi All, I have a big log file i want to delete all characters (between 350th to 450th characters) starting at 350th character position to 450th character position. please advice or sample code. (6 Replies)
Discussion started by: rajeshorpu
6 Replies

2. Shell Programming and Scripting

Trimming sequences based on specific pattern

My files look like this And I need to cut the sequences at the last "A" found in the following 'pattern' -highlighted for easier identification, the pattern is the actual file is not highlighted. The expected result should look like this Thus, all the sequences would end with AGCCCTA... (2 Replies)
Discussion started by: Xterra
2 Replies

3. Shell Programming and Scripting

Removing low frequency sequences

If I have a file with the following information And I would like to remove all the sequences with Freq less than 3, so I end up having the following file: I am currently using awk to accomplish this task but I am not getting the results I actually want. Any help will be greatly appreciated. (3 Replies)
Discussion started by: Xterra
3 Replies

4. Shell Programming and Scripting

Trimming sequences based on Reference

My file looks something like this Wnat I need is to look for the Reference sequence (">Reference1") and based on the length of that sequence trim all the entries in that file. So, the rersulting file will contain all sequences with the same length, like this Thus, all sequences will keep... (5 Replies)
Discussion started by: Xterra
5 Replies

5. Shell Programming and Scripting

Extract sequences based on the list

Hi, I have a file with more than 28000 records and it looks like below.. >mm10_refflat_ABCD range=chr1:1234567-2345678 tgtgcacactacacatgactagtacatgactagac....so on >mm10_refflat_BCD range=chr1:3234567-4545678... tgtgcacactacacatgactagtatgtgcacactacacatgactagta . . . . . so on ... (2 Replies)
Discussion started by: Diya123
2 Replies

6. Shell Programming and Scripting

Selecting sequences based on scores

I have two files with thousands of sequences of different lengths. infile1 contains the actual sequences and infile2 the scores for each A, T, G and C in infile1. Something like this: infile1: >HZVJKYI01ECH5R TTGATGTGCCAGCTGCCGTTGGTGTGCCAA >HZVJKYI01AQWJ8 GGATATGATGATGAACTGGTTTGGCACACC... (4 Replies)
Discussion started by: Xterra
4 Replies

7. Shell Programming and Scripting

Eliminating sequences based on Distances

I have to remove sequences from a file based on the distance value. I am attaching the file containing the distances (Distance.xls) The second file looks something like this: Sequences.txt >Sample1 Freq 59 ggatatgatgatgaactggt >Sample1 Freq 54 ggatatgatgttgaactggt >Sample1 Freq 44... (2 Replies)
Discussion started by: Xterra
2 Replies

8. Shell Programming and Scripting

Print sequences from file2 based on match to, AND in same order as, file1

I have a list of IDs in file1 and a list of sequences in file2. I can print sequences from file2, but I'm asking for help in printing the sequences in the same order as the IDs appear in file1. file1: EN_comp12952_c0_seq3:367-1668 ES_comp17168_c1_seq6:1-864 EN_comp13395_c3_seq14:231-1088... (5 Replies)
Discussion started by: pathunkathunk
5 Replies

9. UNIX for Dummies Questions & Answers

Filling positions based on frequency

I have files with hundreds of sequences with frequency values reported as "Freq X" and missing characters represented by a dash ("-"), something like this >39sample Freq 4 TAGATGTGCCCGTGGGTTTCCCGTCAACACCGGATAGTAGCAGCACTA >22sample Freq 15 T-GATGTCGTGGGTTTCCCGTCAACACCGGCAAATAGTAGCAGCACTA... (12 Replies)
Discussion started by: Xterra
12 Replies

10. Shell Programming and Scripting

Outputting sequences based on length with sed

I have this file: >ID1 AA >ID2 TTTTTT >ID-3 AAAAAAAAA >ID4 TTTTTTGGAGATCAGTAGCAGATGACAG-GGGGG-TGCACCCC Add I am trying to use this script to output sequences longer than 15 characters: sed -r '/^>/N;{/^.{,15}$/d}' The desire output would be this: >ID4... (8 Replies)
Discussion started by: Xterra
8 Replies
unifuzz(1)						      General Commands Manual							unifuzz(1)

NAME
unifuzz - Emit strings designed to test Unicode handling SYNOPSIS
unifuzz ([option flags]) DESCRIPTION
unifuzz emits strings designed to test the ability of programs intended to accept Unicode input to handle unexpected input. These include: characters from all Unicode ranges, Private Use characters, surrogates, undefined characters, non-characters, control characters, exotic space characters, sequences violating normalization rules, unexpected sequences (e.g. a base character from one range followed by a combin- ing character from another range), and long sequences of combining characters. It can also generate very long lines, strings containing embedded nulls, and ill-formed UTF-8. COMMAND LINE FLAGS
-b Restrict the output to the Basic Multilingual Plane (Plane 0). -g Do not emit specific characters. -h Print usage information. -l Emit very long lines. -n Emit string with embedded nulls. -q Be quiet. Omit commentary. -r <number> Set the number of random characters to emit. -S Scan ranges - emit a character from each range. -s <seed> Set the seed for the random number generator. -u Emit ill-formed UTF-8. -v Print version information. The sequence of random characters is determined by a pseudorandom number generator, so the same sequence can be obtained by setting the seed to the same value. If not set on the command line, a seed is chosen based on the time of execution. The seed used is included in the output in a line of the form "Seed = NNNNNN" immediately preceding the random character sequence. Note that in order to obtain the same sequence it is necessary to keep the same setting for restriction of output to the BMP. REFERENCES
Unicode Standard, version 5.0 AUTHOR
Bill Poser billposer@alum.mit.edu LICENSE
GNU General Public License April, 2008 unifuzz(1)
All times are GMT -4. The time now is 11:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy