Sponsored Content
Top Forums Shell Programming and Scripting Outputting characters after a given string and reporting the characters in the row below --sed Post 303028725 by Don Cragun on Monday 14th of January 2019 03:28:31 AM
Old 01-14-2019
Making a few wild guesses... If the output you're trying to produce is:
Code:
Codon:	AAC	Quality Score:	,ED
Codon:	TCCAAG	Quality Score:	G7DCGG
Codon:	AAC	Quality Score:	GCC
Codon:	TCCAAG	Quality Score:	DGGCGG
Codon:	AAC	Quality Score:	GCC
Codon:	TCCAAG	Quality Score:	DGGCGG
Codon:	TTT	Quality Score:	+GG

you could try something like:
Code:
awk -v lengths="3 6" -v strings="GCATGAAAACATACA TTTCCAGAAATTGT" '
BEGIN {	nString = split(strings, String)
	split(lengths, OutLen)
	for(i = 1; i <= nString; i++)
		StringLen[i] = length(String[i])
}
/^@/ {	getline CodonLine
	getline
	getline QualityLine
	for(i = 1; i <= nString; i++)
		if(spot = index(CodonLine, String[i]))
			printf("Codon:\t%s\tQuality Score:\t%s\n",
			    substr(CodonLine, spot + StringLen[i], OutLen[i]),
			    substr(QualityLine, spot + StringLen[i], OutLen[i]))
}' file

These 2 Users Gave Thanks to Don Cragun For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

outputting selected characters from within a variable

Hi all, if for example I had a variable containing the string 'hello', is the any way I can output, for example, the e and the 2nd l based on their position in the string not their character (in this case 2 and 4)? any general pointers in the right direction will be much appreciated, at... (3 Replies)
Discussion started by: skinnygav
3 Replies

2. Shell Programming and Scripting

SED help delete characters in a string

Hi Please help me to refine my syntax. I want to delete the excess characters from the out put below. -bash-3.00$ top -b -n2 -d 00.20 |grep Cpu|tail -1 | awk -F ":" '{ print $2 }' | cut -d, -f1 4.4% us now i want to delete the % and us. How wil i do that to make it just 4.4. Thanks (7 Replies)
Discussion started by: redtred
7 Replies

3. Shell Programming and Scripting

Want to remove the last characters from each row of csv using shell script

Hi, I've a csv file seperated by '|' from which I'm trying to remove the excess '|' characters more than the existing fields. My CSV looks like as below. HRLOAD|Service|AddChange|EN PERSONID|STATUS|LASTNAME|FIRSTNAME|ITDCLIENTUSERID|ADDRESSLINE1 10000001|ACTIVE|Testazar1|Testore1|20041|||... (24 Replies)
Discussion started by: rajak.net
24 Replies

4. Shell Programming and Scripting

Delete row if a a particular column has more then three characters in it

Hi i have a data like hw:dsfnsmdf:39843 chr2 76219829 51M atatata 51 872389 hw:dsfnsmdf:39853 chr2 76219839 51M65T atatata 51 872389 hw:dsfnsmdf:39863 chr2 76219849 51M atatata 51 872389 hw:dsfnsmdf:39873 chr2 ... (3 Replies)
Discussion started by: bhargavpbk88
3 Replies

5. Shell Programming and Scripting

sed replacing specific characters and control characters by escaping

sed -e "s// /g" old.txt > new.txt While I do know some control characters need to be escaped, can normal characters also be escaped and still work the same way? Basically I do not know all control characters that have a special meaning, for example, ?, ., % have a meaning and have to be escaped... (11 Replies)
Discussion started by: ijustneeda
11 Replies

6. Shell Programming and Scripting

sed cut characters of string

helloo I wonder if there's a way to cut characters out of a string and keep only the last 2 by using sed. For example if there's the todays' date: 2012-05-06 and we only want to keep the last 2 characters which are the day. Is there a quick way to do it with sed? (2 Replies)
Discussion started by: vlm
2 Replies

7. Shell Programming and Scripting

Trouble with sed and substituting a string with special characters in variable

Hey guys, I know that title is a mouthful - I'll try to better explain my struggles a little better... What I'm trying to do is: 1. Query a db and output to a file, a list of column data. 2. Then, for each line in this file, repeat these values but wrap them with: ITEM{ ... (3 Replies)
Discussion started by: ampsys
3 Replies

8. Shell Programming and Scripting

Help with sed command - find a string between two characters

Hi, I have a xml file (Config.xml) <Header name="" TDate="" PDate=""> <Config> {"config" { "Nation" "Pri:|Sec:"}} </Config> </Header> Now I wanted to printed all the strings between "". I tried the following cat Config.xml | sed -n 's/.*\.*//p' ... (8 Replies)
Discussion started by: vivek_damodaran
8 Replies

9. Shell Programming and Scripting

sed replace nth characters with string

Hi, I hope you can help me out please? I need to replace from character 8-16 with AAAAAAAA and the rest should stay the same after character 16 gtwrhtrd11111111rjytwyejtyjejetjyetgeaEHT wrehrhw22222222hytekutkyukrylryilruilrGEQTH hrwjyety33333333gtrhwrjrgkreglqeriugn;RUGNEURGU ... (4 Replies)
Discussion started by: stinkefisch
4 Replies

10. UNIX for Dummies Questions & Answers

Reporting characters after string

I have a file that looks like this: >ID 1 AATAATTCCGGATCGTGC >ID 2 TTTGACAGTAGAC >ID 3 AGACGATGACGAT I am using the following script to report if AATTCCGGATCG is present in any sequence: awk 'FNR==1{n=substr(FILENAME,1,index(FILENAME,".")-1)} { print n "\t"... (10 Replies)
Discussion started by: Xterra
10 Replies
LONG-ORFS(1)						      General Commands Manual						      LONG-ORFS(1)

NAME
long-orfs -- Find/Score potential genes in genome-file using the probability model in icm-file SYNOPSIS
tigr-long-orgs [genome-file options] DESCRIPTION
Program long-orfs takes a sequence file (in FASTA format) and outputs a list of all long "potential genes" in it that do not overlap by too much. By "potential gene" I mean the portion of an orf from the first start codon to the stop codon at the end. The first few lines of output specify the settings of various parameters in the program: Minimum gene length is the length of the smallest fragment considered to be a gene. The length is measured from the first base of the start codon to the last base *before* the stop codon. This value can be specified when running the program with the -g option. By default, the program now (April 2003) will compute an optimal length for this parameter, where "optimal" is the value that produces the greatest number of long ORFs, thereby increasing the amount of data used for training. Minimum overlap length is a lower bound on the number of bases overlap between 2 genes that is considered a problem. Overlaps shorter than this are ignored. Minimum overlap percent is another lower bound on the number of bases overlap that is considered a problem. Overlaps shorter than this percentage of *both* genes are ignored. The next portion of the output is a list of potential genes: Column 1 is an ID number for reference purposes. It is assigned sequentially starting with 1 to all long potential genes. If overlap- ping genes are eliminated, gaps in the numbers will occur. The ID prefix is specified in the constant ID_PREFIX . Column 2 is the position of the first base of the first start codon in the orf. Currently I use atg, and gtg as start codons. This is easily changed in the function Is_Start () . Column 3 is the position of the last base *before* the stop codon. Stop codons are taa, tag, and tga. Note that for orfs in the reverse reading frames have their start position higher than the end position. The order in which orfs are listed is in increasing order by Max {OrfStart, End}, i.e., the highest numbered position in the orf, except for orfs that "wrap around" the end of the sequence. When two genes with ID numbers overlap by at least a sufficient amount (as determined by Min_Olap and Min_Olap_Percent ), they are elimi- nated and do not appear in the output. The final output of the program (sent to the standard error file so it does not show up when output is redirected to a file) is the length of the longest orf found. Specifying Different Start and Stop Codons: To specify different sets of start and stop codons, modify the file gene.h . Specifically, the functions: Is_Forward_Start Is_Reverse_Start Is_Start Is_Forward_Stop Is_Reverse_Stop Is_Stop are used to determine what is used for start and stop codons. Is_Start and Is_Stop do simple string comparisons to specify which patterns are used. To add a new pattern, just add the comparison for it. To remove a pattern, comment out or delete the comparison for it. The other four functions use a bit comparison to determine start and stop patterns. They represent a codon as a 12-bit pattern, with 4 bits for each base, one bit for each possible value of the bases, T, G, C or A. Thus the bit pattern 0010 0101 1100 represents the base pattern [C] [A or G] [G or T]. By doing bit operations (& | ~) and comparisons, more complicated patterns involving ambiguous reads can be tested efficiently. Simple patterns can be tested as in the current code. For example, to insert an additional start codon of CAT requires 3 changes: 1. The line || (Codon & 0x218) == Codon should be inserted into Is_Forward_Start , since 0x218 = 0010 0001 1000 represents CAT. 2. The line || (Codon & 0x184) == Codon should be inserted into Is_Reverse_Start , since 0x184 = 0001 1000 0100 represents ATG, which is the reverse-complement of CAT. Alternately, the #define constant ATG_MASK could be used. 3. The line || strncmp (S, "cat", 3) == 0 should be inserted into Is_Start . OPTIONS
-g n Set minimum gene length to n. Default is to compute an optimal value automatically. Don't change this unless you know what you're doing. -l Regard the genome as linear (not circular), i.e., do not allow genes to "wrap around" the end of the genome. This option works on both glimmer and long-orfs . The default behavior is to regard the genome as circular. -o n Set maximum overlap length to n. Overlaps shorter than this are permitted. (Default is 0 bp.) -p n Set maximum overlap percentage to n%. Overlaps shorter than this percentage of *both* strings are ignored. (Default is 10%.) SEE ALSO
tigr-glimmer3 (1), tigr-adjust (1), tigr-anomaly (1), tigr-build-icm (1), tigr-check (1), tigr-codon-usage (1), tigr-compare-lists (1), tigr-extract (1), tigr-generate (1), tigr-get-len (1), tigr-get-putative (1), http://www.tigr.org/software/glimmer/ Please see the readme in /usr/share/doc/tigr-glimmer for a description on how to use Glimmer3. AUTHOR
This manual page was quickly copied from the glimmer web site by Steffen Moeller moeller@debian.org for the Debian system. LONG-ORFS(1)
All times are GMT -4. The time now is 02:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy