Sponsored Content
Full Discussion: Problem with AWK and OFS
Top Forums UNIX for Dummies Questions & Answers Problem with AWK and OFS Post 302566542 by Xterra on Thursday 20th of October 2011 02:43:29 PM
Old 10-20-2011
Problem with AWK and OFS

I have a file that looks like this:

Infile.seq
Quote:
"Contig 1" (1,314)
Contig Length: 314 bases
Average Length/Sequence: 257 bases
Total Sequence Length: 515 bases
Top Strand: 1 sequences
Bottom Strand: 1 sequences
Total: 2 sequences
FEATURES Location/Qualifiers
coverage_once 1..56
/Note="Only_once"
coverage_below 57..257
/Note="Below threshold"
coverage_once 258..314
/Note="Only_once"
^^
TTTGGATATGATGATGAACTGGTCACCTACAACGGCCCTGGTGGTATCGCAGTTACTCCGGATCCCACAAGCTGTCGTGGATATGGTGGCGGGGGCCC
I want to output the DNA sequence and add the filename as the identifier. The output file should look like this:

Quote:
>Infile.seq
TTTGGATATGATGATGAACTGGTCACCTACAACGGCCCTGGTGGTATCGCAGTTACTCCGGATCCCACAAGCTGTCGTGGATATGGTGGCGGGGGCCC
I am using the following code but I do not understand why the sequence is not in the output:

Code:
awk 'BEGIN { RS = "^^"; FS="\n"; OFS ="\n" }{print ">"FILENAME OFS}' Infile.seq

Any help will be greatly appreciated!

Last edited by Xterra; 10-20-2011 at 04:05 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

OFS in awk

Hi, I have these out put field seperator changed to "|" in my awk command, but it didn't give me the result. Can someone help me find out why? ======================================= /bin/awk 'BEGIN { OFS="|" } { print $0 }' list.tmp.$$ > listtmp.$$ =======================================... (1 Reply)
Discussion started by: whatsfordinner
1 Replies

2. Shell Programming and Scripting

OFS in awk.

OFS is inbuild command in awk. I have a file file.txt abc : def : ghi jkl : mno: pqr stu : vwx :yzz code i used: awk -F ":" 'BEGIN {OFS="|"} {print $1,$2}' file.txt output: abc def jkl mno stu vwx but as i have used OFS="|" and i am expecting output as: abc | def jkl... (4 Replies)
Discussion started by: salil2012
4 Replies

3. Shell Programming and Scripting

AWK - OFS

Hi All, I have a comma seperated delimited file with 10 columns. I need to convert it into TAB seperated delimited file. awk -F"," '{print $1"\t"$2"\t"$3"\t"$4"\t"$5"\t"$6"\t"$7"\t"$8"\t"$9"\t"$10}' a.txt >> b.txt how to use OFS to get the same output. I have tried by googling, but it... (5 Replies)
Discussion started by: Amit.Sagpariya
5 Replies

4. Shell Programming and Scripting

Parsing XML in awk : OFS does not work as expected

Hi, I am trying to parse regular XML file where I have to reduce number of decimal points in some xml elements. I am using following AWK command to achive that : #!/bin/ksh EDITCMD='BEGIN { FS = ""; OFS=FS } { if ( $3 ~ "*\\.*" && length(substr($3,1+index($3,"."))) == 15 ) {... (4 Replies)
Discussion started by: martin.franek
4 Replies

5. Shell Programming and Scripting

Awk OFS issues

Hi Im trying to tidy up the output of a who command when it writes to a log, everything I've tried doesnt seem to work though, any help would be massively appreciated. Im using the awk command to set the OFS as tab. #!/bin/bash who >> /export/home/tjmoore/logusers awk -F 'BEGIN... (3 Replies)
Discussion started by: 02JayJay02
3 Replies

6. Shell Programming and Scripting

Awk OFS issues

Hi, Could anyone tell me what Im doing wrong here any help will be much appreciated #!/bin/bash ls -ltr /export/home/tjmoore > /export/home/tjmoore/log100 awk -F " " /export/home/tjmoore/log100 'BEGIN {OFS="\t";} {print $1,$2,$3,$4,$5, $6,$7,$8,$9;}' > /export/home/tjmoore/log1001 I... (9 Replies)
Discussion started by: 02JayJay02
9 Replies

7. UNIX for Dummies Questions & Answers

OFS in awk

Hello, I have an issue with adding commas as delimiters in this scenario: cat xtr3.rpl|head -5|awk 'BEGIN {OFS=","} {print $1,$2,$3,$4}' Produces this output: 00530083,0000000471,000000000000.00,000000000000.00 00530085,0000000471,000000000000.00,000000000000.00... (10 Replies)
Discussion started by: MIA651
10 Replies

8. Shell Programming and Scripting

OFS print awk

file: sasa|asasa|asasa|asas erer|Erer|rere|ererer Output needed : sasa:asasa:asasa:asas erer:Erer:rere:ererer Im getting output, when i use the $1,$2. awk -F'|' 'BEGIN{OFS=":";} {print $1,$2; }' file Output : sasa:asasa erer:Erer But when i need the whole column, i... (5 Replies)
Discussion started by: Ramesh M
5 Replies

9. Shell Programming and Scripting

OFS does not apply to few records in awk

Hi , I am having a problem with my awk oneliner , which for some reason leaves the first two records Input File $ cat file1 A1:B1:C1:NoLimit M1:M2:M3:Limit A2:B2:C2,C3,C4,C5 A3:B3:C3,C4,C5,C6,C7Desired output A1,B1,C1,NoLimit M1,M2,M3,Limit A2,B2,C2 ,,,C3 ,,,C4 ,,,C5 A3,B3,C3... (5 Replies)
Discussion started by: chidori
5 Replies

10. Shell Programming and Scripting

awk - OFS printing duplicate. Why?

Why the following code printing duplicate records? bash-4.1$ cat rm1 c1 c2 c3 l1 2 3 4 l2 2 3 2 bash-4.1$ awk '{print $0} OFS = "\n"' rm1 c1 c2 c3 c1 c2 c3 l1 2 3 4 l1 2 3... (4 Replies)
Discussion started by: quincyjones
4 Replies
Bio::Assembly::ScaffoldI(3pm)				User Contributed Perl Documentation			     Bio::Assembly::ScaffoldI(3pm)

NAME
Bio::Assembly::ScaffoldI - Abstract Inteface of Sequence Assemblies SYNOPSIS
# get a Bio::Assembly::ScaffoldI object somehow foreach my $contig ($assembly->all_contigs) { # do something (see Bio::Assembly::Contig) } DESCRIPTION
This interface defines the basic set of methods an object should have to manipulate assembly data. FEEDBACK
Mailing Lists User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to the Bioperl mailing lists Your participation is much appreciated. bioperl-l@bioperl.org - General discussion http://bioperl.org/wiki/Mailing_lists - About the mailing lists Support Please direct usage questions or support issues to the mailing list: bioperl-l@bioperl.org rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible. Reporting Bugs Report bugs to the Bioperl bug tracking system to help us keep track the bugs and their resolution. Bug reports can be submitted via the web: https://redmine.open-bio.org/projects/bioperl/ AUTHOR - Robson Francisco de Souza Email: rfsouza@citri.iq.usp.br APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ Accessing general assembly data get_nof_contigs Title : get_nof_contigs Usage : $assembly->get_nof_contigs() Function: Get the number of contigs included in the assembly Returns : integer Args : none get_nof_singlets Title : get_nof_singlets Usage : $assembly->get_nof_singlets() Function: Get the number of singlets included in the assembly Returns : integer Args : none get_contig_ids Title : get_contig_ids Usage : $assembly->get_contig_ids() Function: Access list of contig IDs from assembly Returns : an array if there are any contigs in the assembly. undef otherwise Args : an array of contig IDs get_singlet_ids Title : get_singlet_ids Usage : $assembly->get_singlet_ids() Function: Access list of singlet IDs from assembly Returns : an array if there are any singlets in the assembly. undef otherwise Args : an array of singlet IDs get_contig_by_id Title : get_contig_by_id Usage : $assembly->get_contig_by_id($id) Function: Get a reference for a contig from the assembly Returns : a Bio::Assembly::Contig object or undef Args : [string] contig unique identifier (ID) get_singlet_by_id Title : get_singlet_by_id Usage : $assembly->get_singlet_by_id() Function: Get a reference for a singlet from the assembly Returns : Bio::Assembly::Singlet object or undef Args : [string] a singlet ID Modifier methods Implementation of these methods is optional in the sense that read-only implementations may not have these. If an object implements one of them, it should however implement all. add_contig Title : add_contig Usage : $assembly->add_contig($contig) Function: Add another contig to the Bio::Assembly::ScaffoldI object Returns : 1 on success, 0 otherwise Args : a Bio::Assembly:Contig object See Bio::Assembly::Contig for more information add_singlet Title : add_singlet Usage : $assembly->add_singlet($seq) Function: Add another singlet to the Bio::Assembly::ScaffoldI object Returns : 1 on success, 0 otherwise Args : a Bio::Assembly::Singlet object remove_contigs Title : remove_contigs Usage : $assembly->remove_contigs(1..4) Function: Remove contig from assembly object Returns : a Bio::Assembly::Contig object Args : a list of contig IDs See function get_contig_ids() above remove_singlets Title : remove_singlets Usage : $assembly->remove_singlets(1..4) Function: Remove singlets from assembly object Returns : an array of Bio::Assembly::Singlet objects Args : an array of singlet IDs See function get_singlet_ids() above Contig and singlet selection methos select_contigs Title : select_contig Usage : $assembly->select_contig Function: Selects an array of contigs from the assembly Returns : an array of Bio::Assembly::Contig objects Args : an array of contig ids See function get_contig_ids() above select_singlets Title : select_singlets Usage : $assembly->select_singlets(@list) Function: Selects an array of singlets from the assembly Returns : an array of Bio::Assembly::Singlet objects Args : an array of singlet ids See function get_singlet_ids() above all_contigs Title : all_contigs Usage : my @contigs = $assembly->all_contigs Function: Returns a list of all contigs in this assembly. Contigs are both clusters and alignments of one or more reads, with an associated consensus sequence. Returns : array of Bio::Assembly::Contig Args : none all_singlets Title : all_singlets Usage : my @singlets = $assembly->all_singlets Function: Returns a list of all singlets in this assembly. Singlets are isolated reads, without non-vector matches to any other read in the assembly. Returns : array of Bio::Assembly::Singlet objects Args : none perl v5.14.2 2012-03-02 Bio::Assembly::ScaffoldI(3pm)
All times are GMT -4. The time now is 11:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy