Sponsored Content
Top Forums Shell Programming and Scripting Need to increment number in data file Post 302727003 by deneuve01 on Monday 5th of November 2012 04:10:57 PM
Old 11-05-2012
Here is the data with pipe delimiters so you can clearly identify the fields I am referencing:

Code:
 
|Refntns3_1 |char         |30 |Ref H77 nt codon 1      |Reference H77 Nucleotide Codon 1                                |             |--
|Codns3_1   |char         |30 |Obs Nucleotides codon 1 |Observed Nucleotides Codon 1                                    |             |--
|Refaans3_1 |char         |30 |Ref  H77 aa codon 1     |Reference H77 Amino Acid Codon 1                                |             |--
|Ns3_1      |char         |30 |Obs Amino acid codon 1  |Observed Amino Acid Codon 1                                     |             |--
|Mutns3_1   |char         |30 |Ref/Obs aa 1 (b_codes)  |Reference and Observed Amino Acid Codon 1 (see mut in b_codes)  |             |--
|Synns3_1   |int/value    | 3 |Syn codon 1 (b_codes)   |Synonymity Code Codon 1 (see syn in b_codes)                    |-2:4         |--
|Aamixns3_1 |int/value    | 3 |Mix codon 1 (b_codes)   |Mixture/Mutation Code Codon 1 (see aamix in b_codes)            |-2:4         |--

---------- Post updated at 04:10 PM ---------- Previous update was at 01:11 PM ----------

I figured the solution out myself and wrote a simple shell script to create the interation I needed.

Code:
#!/bin/csh
rm -f test1.txt
touch test1.txt
foreach X (`cat num`)
echo "| |refntns3_"$X" |Ref H77 nt codon "$X"      |Reference H77 Nucleotide Codon "$X"                                |6 |30 |0 |0 |  |">>test1.txt
echo "| |codns3_"$X"   |Obs Nucleotides codon "$X" |Observed Nucleotides Codon "$X"                                    |6 |30 |0 |0 |  |">>test1.txt
echo "| |refaans3_"$X" |Ref  H77 aa codon "$X"     |Reference H77 Amino Acid Codon "$X"                                |6 |30 |0 |0 |  |">>test1.txt
echo "| |ns3_"$X"      |Obs Amino acid codon "$X"  |Observed Amino Acid Codon "$X"                                     |6 |30 |0 |0 |  |">>test1.txt
echo "| |mutns3_"$X"   |Ref/Obs aa "$X" (b_codes)  |Reference and Observed Amino Acid Codon "$X" (see mut in b_codes)  |6 |30 |0 |0 |  |">>test1.txt
echo "| |synns3_"$X"   |Syn codon "$X" (b_codes)   |Synonymity Code Codon "$X" (see syn in b_codes)                    |2 |3  |0 |0 |-2:4 |">>test1.txt
echo "| |aamixns3_"$X" |Mix codon "$X" (b_codes)   |Mixture/Mutation Code Codon "$X" (see aamix in b_codes)            |2 |3 |0 |0 |-2:4  |">>test1.txt
end
exit

** the num file contains a simple list of numbers, 1-100

Thank you!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to number format a data file without using SED?

Hi I have a file which contains data (list of data) and I want to put a number with bracket 1) 2) 3) etc at the beginning of every successive line I can do it with SED and I can also do it using the nl route but am looking for a different method. I'm guessing I would need some sort of loop... (3 Replies)
Discussion started by: Cactus Jack
3 Replies

2. Shell Programming and Scripting

how to get the data from line number 1 to line number 100 of a file

Hi Everybody, I am trying to write a script that will get some perticuler data from a file and redirect to a file. My Question is, I have a Very huge file,In that file I have my required data is started from 25th line and it will ends in 100th line. I know the line numbers, I need to get all... (9 Replies)
Discussion started by: Anji
9 Replies

3. UNIX for Dummies Questions & Answers

count the number of occurance and increment

Hi, I am trying to count the number of occurance of a specific value in a column and increment the variable in the second column accordingly. I have very little information about Unix. As an example, 21 1 32 1 32 2 45 1 56 1 56 2 56 3 73 1 82 1 Thanks, Natasha (2 Replies)
Discussion started by: natasha
2 Replies

4. Shell Programming and Scripting

How to extract specific data and count number containing sets from a file?

Hello everybody! I am quit new here and hope you can help me. Using an awk script I am trying to extract data from several files. The structure of the input files is as follows: TimeStep parameter1 parameter2 parameter3 parameter4 e.g. 1 X Y Z L 1 D H Z I 1 H Y E W 2 D H G F 2 R... (2 Replies)
Discussion started by: Daniel8472
2 Replies

5. Shell Programming and Scripting

Increment a floating number in ksh

Hi ! How to increment a varibale in ksh. #!/bin/ksh set -x RELEASE_NUM=5.2.103 VAL=0.0.1 RELEASE_NUM=`echo $RELEASE_NUM + $VAL | bc` echo $RELEASE_NUM The above code is throwing this error. + RELEASE_NUM=5.2.103 (2 Replies)
Discussion started by: dashok.83
2 Replies

6. Shell Programming and Scripting

Find line number of bad data in large file

Hi Forum. I was trying to search the following scenario on the forum but was not able to. Let's say that I have a very large file that has some bad data in it (for ex: 0.0015 in the 12th column) and I would like to find the line number and remove that particular line. What's the easiest... (3 Replies)
Discussion started by: pchang
3 Replies

7. Shell Programming and Scripting

To increment the values from the file

Hi I have the file called "file.txt" which contains the following output $cat file.txt sandy <version>1</version> karen <version>2</version> Rob <version>3</version> peter <version>4</version> i want to write a command which will add the value 1 to the digits and show the output... (2 Replies)
Discussion started by: sidh_arth85
2 Replies

8. Shell Programming and Scripting

Need a REGEX to increment the file number of a pdf file

Hello, I have a few thousand .pdf files in various folders each have a naming scheme like this: 006_-_Titled_Document_#34_-_September-25-2011-side-1.pdf In each folder, the number system starts at 001 (as you see on the far left of the file name), and then ends at 999 (maximum .pdf files).... (4 Replies)
Discussion started by: Marcus Aurelius
4 Replies

9. Shell Programming and Scripting

awk processing of variable number of fields data file

Hy! I need to post-process some data files which have variable (and periodic) number of fields. For example, I need to square (data -> data*data) the folowing data file: -5.34281E-28 -3.69822E-29 8.19128E-29 9.55444E-29 8.16494E-29 6.23125E-29 4.42106E-29 2.94592E-29 1.84841E-29 ... (5 Replies)
Discussion started by: radudownload
5 Replies

10. Shell Programming and Scripting

Find a word and increment the number in the word & save into new files

Hi All, I am looking for a perl/awk/sed command to auto-increment the numbers line in file, P1.tcl: run_build_model sparc_ifu_dec run_drc set_faults -model path_delay -atpg_effectiveness -fault_coverage add_delay_paths P1 set_atpg -abort_limit 1000 run_atpg -ndetects 1000 I would like... (6 Replies)
Discussion started by: jypark22
6 Replies
Bio::Graphics::Glyph::translation(3pm)			User Contributed Perl Documentation		    Bio::Graphics::Glyph::translation(3pm)

NAME
Bio::Graphics::Glyph::translation - The "6-frame translation" glyph SYNOPSIS
See L<Bio::Graphics::Panel> and L<Bio::Graphics::Glyph>. DESCRIPTION
This glyph draws the conceptual translation of DNA sequences. At high magnifications, it simply draws lines indicating open reading frames. At low magnifications, it draws a conceptual protein translation. Options can be used to set 1-frame, 3-frame or 6-frame translations. OPTIONS The following options are standard among all Glyphs. See Bio::Graphics::Glyph for a full explanation. Option Description Default ------ ----------- ------- -fgcolor Foreground color black -outlinecolor Synonym for -fgcolor -bgcolor Background color turquoise -fillcolor Synonym for -bgcolor -linewidth Line width 1 -height Height of glyph 10 -font Glyph font gdSmallFont -connector Connector type 0 (false) -connector_color Connector color black -label Whether to draw a label 0 (false) -description Whether to draw a description 0 (false) -hilite Highlight color undef (no color) In addition to the common options, the following glyph-specific options are recognized: Option Description Default ------ ----------- ------- -translation Type of translation to 1frame perform. One of "1frame", "3frame", or "6frame" -strand Forward (+1) or reverse (-1) +1 translation. -frame0 Color for the first frame fgcolor -frame1 Color for the second frame fgcolor -frame2 Color for the third frame fgcolor -gridcolor Color for the horizontal lightgrey lines of the reading frames -start_codons Draw little arrowheads 0 (false) indicating start codons -stop_codons Draw little vertical ticks 1 (true) indicating stop codons -arrow_height Height of the start codon 1 arrowheads -show_sequence Show the amino acid sequence 1 (true) if there's room. -triletter_code Show the 3-letter amino acid 0 (false) code if there's room -codontable Codon table to use 1 (see Bio::Tools::CodonTable) SUGGESTED STANZA FOR GENOME BROWSER
This produces a nice gbrowse display in which the DNA/GC Content glyph is sandwiched between the forward and reverse three-frame translations. The frames are color-coordinated with the example configuration for the "cds" glyph. [TranslationF] glyph = translation global feature = 1 frame0 = cadetblue frame1 = blue frame2 = darkblue height = 20 fgcolor = purple strand = +1 translation = 3frame key = 3-frame translation (forward) [DNA/GC Content] glyph = dna global feature = 1 height = 40 do_gc = 1 fgcolor = red axis_color = blue [TranslationR] glyph = translation global feature = 1 frame0 = darkred frame1 = red frame2 = crimson height = 20 fgcolor = blue strand = -1 translation = 3frame key = 3-frame translation (reverse) BUGS
Please report them. SEE ALSO
Bio::Graphics::Panel, Bio::Graphics::Glyph, Bio::Graphics::Glyph::arrow, Bio::Graphics::Glyph::cds, Bio::Graphics::Glyph::crossbox, Bio::Graphics::Glyph::diamond, Bio::Graphics::Glyph::dna, Bio::Graphics::Glyph::dot, Bio::Graphics::Glyph::ellipse, Bio::Graphics::Glyph::extending_arrow, Bio::Graphics::Glyph::generic, Bio::Graphics::Glyph::graded_segments, Bio::Graphics::Glyph::heterogeneous_segments, Bio::Graphics::Glyph::line, Bio::Graphics::Glyph::pinsertion, Bio::Graphics::Glyph::primers, Bio::Graphics::Glyph::rndrect, Bio::Graphics::Glyph::segments, Bio::Graphics::Glyph::ruler_arrow, Bio::Graphics::Glyph::toomany, Bio::Graphics::Glyph::transcript, Bio::Graphics::Glyph::transcript2, Bio::Graphics::Glyph::translation, Bio::Graphics::Glyph::triangle, Bio::DB::GFF, Bio::SeqI, Bio::SeqFeatureI, Bio::Das, GD AUTHOR
Lincoln Stein <lstein@cshl.org>. Copyright (c) 2001 Cold Spring Harbor Laboratory This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See DISCLAIMER.txt for disclaimers of warranty. perl v5.14.2 2012-02-20 Bio::Graphics::Glyph::translation(3pm)
All times are GMT -4. The time now is 09:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy