Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Concatenating sequence length to another file Post 303031922 by rdrtx1 on Thursday 7th of March 2019 03:14:42 PM
Old 03-07-2019
Code:
for file in *.fa;
do
  awk '
  NR==FNR {
     if ($0 ~ /^>/ && why_print_seqlen_for_this_line) {if (seqlen) print seqlen; next;}
     # is there a record separator /^>/ in the *.fa files not mentioned in samples?

     seqlen += length($0);
     next;
  }
  {print FNR, $0, seqlen}
  ' OFS="\t" $file ${file%.*}_pos.txt > t_$$

  mv -f t_$$ ${file%.*}_pos.txt
done

This User Gave Thanks to rdrtx1 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Concatenating values in a File

Hi All, I have a ',' delimited file and i would like concatenate a new value at a specific column. Example :- xXXX,XYZ,20071005,ABC,DEF,123 xXXX,XYZ,20071005,ABC,DEF,123 xXXX,XYZ,20071005,ABC,DEF,123 The output that i want is xXXX,XYZ,20071005001,ABC,DEF,123... (7 Replies)
Discussion started by: amitkhiare
7 Replies

2. Shell Programming and Scripting

Concatenating the two lines in a file

hi My requirement is i have a file with some records like this file name ::xyz a=1 b=100,200 ,300,400 ,500,600 c=700,800 d=900 i want to change my file a=1 b=100,200,300,400 c=700,800 d=900 if record starts with " , " that line should fallows the previous line.please give... (6 Replies)
Discussion started by: srivsn
6 Replies

3. UNIX for Dummies Questions & Answers

What the command to find out the record length of a fixed length file?

I want to find out the record length of a fixed length file? I forgot the command. Any body know? (9 Replies)
Discussion started by: tranq01
9 Replies

4. UNIX for Dummies Questions & Answers

Convert a tab delimited/variable length file to fixed length file

Hi, all. I need to convert a file tab delimited/variable length file in AIX to a fixed lenght file delimited by spaces. This is the input file: 10200002<tab>US$ COM<tab>16/12/2008<tab>2,3775<tab>2,3783 19300978<tab>EURO<tab>16/12/2008<tab>3,28523<tab>3,28657 And this is the expected... (2 Replies)
Discussion started by: Everton_Silveir
2 Replies

5. Shell Programming and Scripting

Concatenating File and String for Sendmail

I want o add a variable in addition to a file which will be send with sendmail. I have problems to find the correct syntax for concatenating this variable called $MyVariable. sendmail mai@domain.com </tmp/errormessage.txt $MyVariable] Thanks for your help! (2 Replies)
Discussion started by: high5
2 Replies

6. Shell Programming and Scripting

Concatenating fixed length lines in shell script

I have a peculiar file with record format like given below. Each line is wrapped to next lines after certain number of characters. I want to concatenate all wrapped lines into 1. Input:(wrapped after 10 columns) This is li ne1 This is li ne2 and this line is too lo ng Shortline ... (8 Replies)
Discussion started by: kmanyam
8 Replies

7. Shell Programming and Scripting

Flat file-make field length equal to header length

Hello Everyone, I am stuck with one issue while working on abstract flat file which i have to use as input and load data to table. Input Data- ------ ------------------------ ---- ----------------- WFI001 Xxxxxx Control Work Item A Number of Records ------ ------------------------... (5 Replies)
Discussion started by: sonali.s.more
5 Replies

8. Shell Programming and Scripting

find common entries and match the number with long sequence and cut that sequence in output

Hi all, I have a file like this ID 3BP5L_HUMAN Reviewed; 393 AA. AC Q7L8J4; Q96FI5; Q9BQH8; Q9C0E3; DT 05-FEB-2008, integrated into UniProtKB/Swiss-Prot. DT 05-JUL-2004, sequence version 1. DT 05-SEP-2012, entry version 71. FT COILED 59 140 ... (1 Reply)
Discussion started by: manigrover
1 Replies

9. Shell Programming and Scripting

Concatenating 3 files into a single file

I have 3 files File1 C1 C2 c3 File 2 C1 c2 c3 File 3 C1 c2 c3 Now i want to have File1 as C1 c2 c3 I File2 as C1 c2 c3 O File3 as c1 c2 c3 D and these 3 files should be concatenated into a single file how can it be done in unix script? (3 Replies)
Discussion started by: Codesearcher
3 Replies

10. UNIX for Dummies Questions & Answers

ConCATenating binaries but excluding last bytes from each file

Hi there, shameful Linux Newbie here :p I was wondering if you could help with my problem... I have plenty of files I'd like to concatenate. I know how to basically use cat command but that won't be enough from what I need : excluding the last xx bytes from files before assembling since there's... (4 Replies)
Discussion started by: grolido
4 Replies
Bio::Matrix::PSM::PsmHeader(3pm)			User Contributed Perl Documentation			  Bio::Matrix::PSM::PsmHeader(3pm)

NAME
Bio::Matrix::PSM::PsmHeader - PSM mast parser implementation SYNOPSIS
# See Bio::Matrix::PSM::IO for detailed documentation on how to use # PSM parsers DESCRIPTION
Parser for mast. This driver unlike meme or transfac for example is dedicated more to PSM sequence matches 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 one of 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 - Stefan Kirov Email skirov@utk.edu APPENDIX
new Title : new Usage : my $header= Bio::Matrix::PSM::PsmHeader->new(-seq=>\%seq, -mid=>\%mid, -width=>\%width, -instances=>\%instances, -header=>@header, -type=>'mast'); Function: Creates a new Bio::Matrix::PSM::PsmHeader object Throws : Example : Returns : Bio::Matrix::PSM::PsmHeader object Args : hash seq Title : seq Usage : my %seq= $header->seq(); Function: Returns the sequence data as a hash, indexed by a sequence ID (motif id or accession number) In case the input data is a motif it would return the consenus seq for each of them (mast). Throws : Example : Returns : hash Args : hid Title : hid Usage : my @hid= $header->hid(); Function: Returns array with the motif ids Throws : Example : Returns : array Args : length Title : length Usage : my %length= $header->length(); Function: Returns the length of the input sequence or motifs as a hash, indexed by a sequence ID (motif id or accession number) Throws : Example : Returns : hash Args : instances Title : instances Usage : my %instances= $header->instances(); Function: Returns the info about the input data, contained in the header Throws : Example : Returns : hash Args : weight Title : weight Usage : my %weights= $header->weight(); Function: Returns the weights of the input sequence as a hash, indexed by a sequence ID Throws : Example : Returns : hash Args : unstuctured Title : unstuctured Usage : my @unstructured= $header->unstuctured(); Function: Returns the unstructured data in the header as an array, one line per array element, all control symbols are removed with W Throws : Example : Returns : array Args : version Title : version Usage : my $version= $header->version; Function: Returns the version of the file being parsed if such exists Throws : Example : Returns : string Args : release Title : release Usage : my $release= $header->release; Function: Returns the release of the file being parsed if such exists Throws : Example : Returns : string Args : _check Title : _check Usage : if ($self->_check('weights') { #do something} else {return 0;} Function: Checks if the method called is aplicable to the file format Throws : Example : Returns : boolean Args : string perl v5.14.2 2012-03-02 Bio::Matrix::PSM::PsmHeader(3pm)
All times are GMT -4. The time now is 01:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy