Sponsored Content
Top Forums Shell Programming and Scripting Eliminating sequences based on Distances Post 302813197 by Xterra on Sunday 26th of May 2013 06:49:55 PM
Old 05-26-2013
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
Code:
 
>Sample1 Freq 59
ggatatgatgatgaactggt
>Sample1 Freq 54
ggatatgatgttgaactggt
>Sample1 Freq 44
ggatatgttgatgaactggt
>Sample1 Freq 39
ggatttgatgatgaactggt
>Sample1 Freq 3a 39
ggatatgatgatgaactggt
>Sample2 Freq 38
ggatatgatgatgaactggt
>Sample2 run13 reversed 7 3a Freq 32
ggatttgatgatgaactggt
>Sample2 run13 reversed 8 3a 30
ggatttgatgatgaactggt
>Sample2 29
ggatatgatgatgaactcct
>Sample2 reversed 10 3a 27
ggatatgatgatgaactggt

If the distance value is below 1, I need to remove the sequences from file Sequences.txt listed on colum Species 2. Thus, the output file should look something like this:

Outputfile
Code:
 
>Sample1 Freq 59
ggatatgatgatgaactggt
>Sample1 Freq 54
ggatatgatgttgaactggt
>Sample1 Freq 44
ggatatgttgatgaactggt
>Sample1 Freq 39
ggatttgatgatgaactggt
>Sample1 Freq 3a 39
ggatatgatgatgaactggt
>Sample2 29
ggatatgatgatgaactcct

I am trying to get an AWK or SED script so I can better understand the syntax. I am not that familiar with Perl but I might be able to follow the syntax once I see the script.
Thanks!
 

10 More Discussions You Might Find Interesting

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

2. Shell Programming and Scripting

Deleting sequences based on character frequency

This is what I would like to accomplish, I have an input file (file A) that consist of thousands of sequence elements with the same number of characters (length), each headed by a free text header starting with the chevron ‘>' character followed by the ID (all different IDs with different lenghts)... (9 Replies)
Discussion started by: Xterra
9 Replies

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

4. Shell Programming and Scripting

Removing distances from Newick tree format

I have a large numbers of files containing data that look like this: (ID31:0.01682,(ID-123:0.00000,(ID_24:0.00000,ID&890:0.00000):0.00000):0.00000,ID12876:0.00000); (ID_24:-0.00052,(ID31:0.01697,(ID-123:-0.00059,ID&890:0.03528):0.00037):0.00027,ID12876:0.03484); I need to find ":" anywhere... (6 Replies)
Discussion started by: Xterra
6 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. UNIX for Dummies Questions & Answers

Eliminating entries based on relative values

I have posted this before but did not get much feedback. So I will try again. I need to remove sequences from a file based on values listed on a second file. The sequences file looks like this: Sequences.txt >Sample1 Freq 59 ggatatgatgatgaactggt >Sample1 Freq 54 ggatatgatgttgaactggt... (4 Replies)
Discussion started by: Xterra
4 Replies

8. Shell Programming and Scripting

Extract sequences from a FASTA file based on another file

I have two files. File1 is shown below. >153L:B|PDBID|CHAIN|SEQUENCE RTDCYGNVNRIDTTGASCKTAKPEGLSYCGVSASKKIAERDLQAMDRYKTIIKKVGEKLCVEPAVIAGIISRESHAGKVL KNGWGDRGNGFGLMQVDKRSHKPQGTWNGEVHITQGTTILINFIKTIQKKFPSWTKDQQLKGGISAYNAGAGNVRSYARM DIGTTHDDYANDVVARAQYYKQHGY >16VP:A|PDBID|CHAIN|SEQUENCE... (7 Replies)
Discussion started by: nelsonfrans
7 Replies

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

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
Distances(3)						     Hardware Locality (hwloc)						      Distances(3)

NAME
Distances - Functions static inline struct hwloc_distances_s * hwloc_get_whole_distance_matrix_by_depth (hwloc_topology_t topology, unsigned depth)" static inline struct hwloc_distances_s * hwloc_get_whole_distance_matrix_by_type (hwloc_topology_t topology, hwloc_obj_type_t type)" static inline struct hwloc_distances_s * hwloc_get_distance_matrix_covering_obj_by_depth (hwloc_topology_t topology, hwloc_obj_t obj, unsigned depth, unsigned *firstp)" static inline int hwloc_get_latency (hwloc_topology_t topology, hwloc_obj_t obj1, hwloc_obj_t obj2, float *latency, float *reverse_latency) Function Documentation static inline struct hwloc_distances_s* hwloc_get_distance_matrix_covering_obj_by_depth (hwloc_topology_ttopology, hwloc_obj_tobj, unsigneddepth, unsigned *firstp) [static, read] Get distances for the given depth and covering some objects. Return a distance matrix that describes depth depth and covers at least object obj and all its children. When looking for the distance between some objects, a common ancestor should be passed in obj. firstp is set to logical index of the first object described by the matrix. The returned structure belongs to the hwloc library. The caller should not modify or free it. static inline int hwloc_get_latency (hwloc_topology_ttopology, hwloc_obj_tobj1, hwloc_obj_tobj2, float *latency, float *reverse_latency) [static] Get the latency in both directions between two objects. Look at ancestor objects from the bottom to the top until one of them contains a distance matrix that matches the objects exactly. latency gets the value from object obj1 to obj2, while reverse_latency gets the reverse-direction value, which may be different on some architectures. Returns: -1 if no ancestor contains a matching latency matrix. static inline struct hwloc_distances_s* hwloc_get_whole_distance_matrix_by_depth (hwloc_topology_ttopology, unsigneddepth) [static, read] Get the distances between all objects at the given depth. Returns: a distances structure containing a matrix with all distances between all objects at the given depth. Slot i+nbobjs*j contains the distance from the object of logical index i the object of logical index j. Note: This function only returns matrices covering the whole topology, without any unknown distance value. Those matrices are available in top-level object of the hierarchy. Matrices of lower objects are not reported here since they cover only part of the machine. The returned structure belongs to the hwloc library. The caller should not modify or free it. Returns: NULL if no such distance matrix exists. static inline struct hwloc_distances_s* hwloc_get_whole_distance_matrix_by_type (hwloc_topology_ttopology, hwloc_obj_type_ttype) [static, read] Get the distances between all objects of a given type. Returns: a distances structure containing a matrix with all distances between all objects of the given type. Slot i+nbobjs*j contains the distance from the object of logical index i the object of logical index j. Note: This function only returns matrices covering the whole topology, without any unknown distance value. Those matrices are available in top-level object of the hierarchy. Matrices of lower objects are not reported here since they cover only part of the machine. The returned structure belongs to the hwloc library. The caller should not modify or free it. Returns: NULL if no such distance matrix exists. Author Generated automatically by Doxygen for Hardware Locality (hwloc) from the source code. Version 1.4.1 Mon Feb 27 2012 Distances(3)
All times are GMT -4. The time now is 03:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy