Sponsored Content
Top Forums UNIX for Beginners Questions & Answers How to append strings with whitespace? Post 303038439 by bunny_merah19 on Tuesday 3rd of September 2019 08:53:19 AM
Old 09-03-2019
How to append strings with whitespace?

Hi,

Need help. This seems simple but I tried many things but failed to get what I wanted. Below is the input file:

Code:
Chr1	lnci	exon	83801516	83803251	.	-	.	gene_id"LINC01725";	transcript_id"LINC01725:44";	gene_alias_1"ENSG00000233008";	gene_alias_2"RP11-475O6.1";	gene_alias_3"ENSG00000233008.1";	gene_alias_4"OTTHUMG00000009930.1";	gene_alias_5"ENSG00000233008.5";	gene_alias_6"LINC01725";	gene_alias_7"LOC101927560";	transcript_alias_1"ENST00000457273";	transcript_alias_2"ENST00000457273.1";	transcript_alias_3"RP11-475O6.1-005";	transcript_alias_4"OTTHUMT00000027496.1";	transcript_alias_5"NONHSAT004171";	transcript_alias_6"NR_119374";	transcript_alias_7"ENST00000457273.5";	transcript_alias_8"NR_119374.1";
chr16	lnci	exon	83849907	83850022	.	-	.	gene_id"LINC01725";	transcript_id"LINC01725:44";	gene_alias_1"ENSG00000233008";	gene_alias_2"RP11-475O6.1";	gene_alias_3"ENSG00000233008.1";	gene_alias_4"OTTHUMG00000009930.1";

I need to append each row by adding a whitespace after field id starting from column 9 onwards. The output should be like below:-

Code:
Chr1	lnci	exon	83801516	83803251	.	-	.	gene_id "LINC01725";	transcript_id "LINC01725:44";	gene_alias_1 "ENSG00000233008";	gene_alias_2 "RP11-475O6.1";	gene_alias_3 "ENSG00000233008.1";	gene_alias_4 "OTTHUMG00000009930.1";	gene_alias_5 "ENSG00000233008.5";	gene_alias_6 "LINC01725";	gene_alias_7 "LOC101927560";	transcript_alias_1 "ENST00000457273";	transcript_alias_2 "ENST00000457273.1";	transcript_alias_3 "RP11-475O6.1-005";	transcript_alias_4 "OTTHUMT00000027496.1";	transcript_alias_5 "NONHSAT004171";	transcript_alias_6 "NR_119374";	transcript_alias_7 "ENST00000457273.5";	transcript_alias_8 "NR_119374.1";
chr16	lnci	exon	83849907	83850022	.	-	.	gene_id "LINC01725";	transcript_id "LINC01725:44";	gene_alias_1 "ENSG00000233008";	gene_alias_2 "RP11-475O6.1";	gene_alias_3 "ENSG00000233008.1";	gene_alias_4 "OTTHUMG00000009930.1";

Really appreciate your kind help. Thanks
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Append strings with filler spaces

Hi I am looping through the contents of a file as follows cat file |while read inrec do echo $inrec >> $TMP done (obviously this isn't all i am doing as it would be pointless but for the sake of the problem this is the important bit) The file has fields which are separated by... (1 Reply)
Discussion started by: handak9
1 Replies

2. UNIX for Dummies Questions & Answers

How to append "spaces" between strings

HI, Supose I have the folowing strings: "unix" and "linux". I want to concatenate the two strings, inserting between them a variable number of spaces. ex1: unix linux ex2: unix linux Can you help me in this simple problem? Regards, Elio (2 Replies)
Discussion started by: efernandes
2 Replies

3. Shell Programming and Scripting

Need help with command to append strings

Greetings all, I'm in need of some help in coming up with this command which requires me to append 5 strings together: 1. echo "Status from system:" 2. `cat logs.txt` (i need the output of this command) 3. echo "Error output: " 4. `cat errors.txt`(i need the output of this command) 5.... (3 Replies)
Discussion started by: rockysfr
3 Replies

4. Shell Programming and Scripting

How to append some strings line by line?

I would like to append the numbers 1, 2, 3, 4 and so on to the lines of the file: Adam Wilkins | Colorado | 36 John Butler | Los Angeles | 47 Cassey Johnson | Minneapolis | 25 Albert Aniston | Miami | 19 .... Tony Legler | Sacramento | 55 Matt Simmons | New York | 38 Output would look... (4 Replies)
Discussion started by: xinoo
4 Replies

5. Shell Programming and Scripting

How to match (whitespace digits whitespace) sequence?

Hi Following is an example line. echo "192.22.22.22 \"33dffwef\" 200 300 dsdsd" | sed "s:\(\ *\ \):\1:" I want it's output to be 200 However this is not the case. Can you tell me how to do it? I don't want to use AWK for this. Secondly, how can i fetch just 300? Should I use "\2"... (3 Replies)
Discussion started by: shahanali
3 Replies

6. Shell Programming and Scripting

Sed: Remove whitespace between two strings

I have a 13 number string, some whitespace, and then /mp3. I need to join them. Everyline that I need this for begins with "cd" (without the quotes). What it looks like now: cd media/Audio/WAVE/9781933976334 /mp3 What I want my output to be: cd media/Audio/WAVE/9781933976334/mp3 The 13... (7 Replies)
Discussion started by: glev2005
7 Replies

7. Shell Programming and Scripting

Delete lines in file containing duplicate strings, keeping longer strings

The question is not as simple as the title... I have a file, it looks like this <string name="string1">RZ-LED</string> <string name="string2">2.0</string> <string name="string2">Version 2.0</string> <string name="string3">BP</string> I would like to check for duplicate entries of... (11 Replies)
Discussion started by: raidzero
11 Replies

8. UNIX for Dummies Questions & Answers

Append command and strings to a text file

hi gurus, I'm executing some commands and I want to append both the command and output to a text file. Example: echo "strings -a wicmex.o|grep '$Header'" >> tmp.txt strings -a wicmex.o|grep '$Header' >> tmp.txt echo "strings -a libwip.a|grep '$Header'" >> tmp.txt strings -a libwip.a|grep... (1 Reply)
Discussion started by: donisback
1 Replies

9. Shell Programming and Scripting

Need to append matching strings in a file

Hi , I am writing a shell script to check pvsizes in linux box. # for i in `cat vgs1` > do > echo "########### $i ###########" > pvs|grep -i $i|awk '{print $2,$1,$5}'>pvs_$i > pvs|grep -i $i|awk '{print $1}'|while read a > do > fdisk -l $a|head -2|tail -1|awk '{print $2,$3}'>pvs_$i1 >... (3 Replies)
Discussion started by: nanduri
3 Replies

10. UNIX for Beginners Questions & Answers

How to pass strings from a list of strings from another file and create multiple files?

Hello Everyone , Iam a newbie to shell programming and iam reaching out if anyone can help in this :- I have two files 1) Insert.txt 2) partition_list.txt insert.txt looks like this :- insert into emp1 partition (partition_name) (a1, b2, c4, s6, d8) select a1, b2, c4, (2 Replies)
Discussion started by: nubie2linux
2 Replies
Bio::Tools::Sim4::Results(3pm)				User Contributed Perl Documentation			    Bio::Tools::Sim4::Results(3pm)

NAME
Bio::Tools::Sim4::Results - Results of one Sim4 run SYNOPSIS
# to preset the order of EST and genomic file as given on the sim4 # command line: my $sim4 = Bio::Tools::Sim4::Results->new(-file => 'result.sim4', -estfirst => 1); # to let the order be determined automatically (by length comparison): $sim4 = Bio::Tools::Sim4::Results->new( -file => 'sim4.results' ); # filehandle: $sim4 = Bio::Tools::Sim4::Results->new( -fh => *INPUT ); # parse the results while(my $exonset = $sim4->next_exonset()) { # $exonset is-a Bio::SeqFeature::Generic with Bio::Tools::Sim4::Exons # as sub features print "Delimited on sequence ", $exonset->seq_id(), "from ", $exonset->start(), " to ", $exonset->end(), " "; foreach my $exon ( $exonset->sub_SeqFeature() ) { # $exon is-a Bio::SeqFeature::FeaturePair print "Exon from ", $exon->start, " to ", $exon->end, " on strand ", $exon->strand(), " "; # you can get out what it matched using the est_hit attribute my $homol = $exon->est_hit(); print "Matched to sequence ", $homol->seq_id, " at ", $homol->start," to ", $homol->end, " "; } } # essential if you gave a filename at initialization (otherwise the file # stays open) $sim4->close(); DESCRIPTION
The sim4 module provides a parser and results object for sim4 output. The sim4 results are specialised types of SeqFeatures, meaning you can add them to AnnSeq objects fine, and manipulate them in the "normal" seqfeature manner. The sim4 Exon objects are Bio::SeqFeature::FeaturePair inherited objects. The $esthit = $exon->est_hit() is the alignment as a feature on the matching object (normally, an EST), in which the start/end points are where the hit lies. To make this module work sensibly you need to run sim4 genomic.fasta est.database.fasta or sim4 est.fasta genomic.database.fasta To get the sequence identifiers recorded for the first sequence, too, use A=4 as output option for sim4. One fiddle here is that there are only two real possibilities to the matching criteria: either one sequence needs reversing or not. Because of this, it is impossible to tell whether the match is in the forward or reverse strand of the genomic DNA. We solve this here by assuming that the genomic DNA is always forward. As a consequence, the strand attribute of the matching EST is unknown, and the strand attribute of the genomic DNA (i.e., the Exon object) will reflect the direction of the hit. See the documentation of parse_next_alignment() for abilities of the parser to deal with the different output format options of sim4. 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 - Ewan Birney, Hilmar Lapp Ewan Birney <birney-at-sanger.ac.uk> Hilmar Lapp <hlapp-at-gmx.net> or <hilmar.lapp-at-pharma.novartis.com>. APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ analysis_method Usage : $sim4->analysis_method(); Purpose : Inherited method. Overridden to ensure that the name matches /sim4/i. Returns : String Argument : n/a parse_next_alignment Title : parse_next_alignment Usage : @exons = $sim4_result->parse_next_alignment; foreach $exon (@exons) { # do something } Function: Parses the next alignment of the Sim4 result file and returns the found exons as an array of Bio::Tools::Sim4::Exon objects. Call this method repeatedly until an empty array is returned to get the results for all alignments. The $exon->seq_id() attribute will be set to the identifier of the respective sequence for both sequences if A=4 was used in the sim4 run, and otherwise for the second sequence only. If the output does not contain the identifier, the filename stripped of path and extension is used instead. In addition, the full filename will be recorded for both features ($exon inherits off Bio::SeqFeature::SimilarityPair) as tag 'filename'. The length is accessible via the seqlength() attribute of $exon->query() and $exon->est_hit(). Note that this method is capable of dealing with outputs generated with format 0,1,3, and 4 (via the A=n option to sim4). It automatically determines which of the two sequences has been reversed, and adjusts the coordinates for that sequence. It will also detect whether the EST sequence(s) were given as first or as second file to sim4, unless this has been specified at creation time of the object. Example : Returns : An array of Bio::Tools::Sim4::Exon objects Args : next_exonset Title : next_exonset Usage : $exonset = $sim4_result->parse_next_exonset; print "Exons start at ", $exonset->start(), "and end at ", $exonset->end(), " "; foreach $exon ($exonset->sub_SeqFeature()) { # do something } Function: Parses the next alignment of the Sim4 result file and returns the set of exons as a container of features. The container is itself a Bio::SeqFeature::Generic object, with the Bio::Tools::Sim4::Exon objects as sub features. Start, end, and strand of the container will represent the total region covered by the exons of this set. See the documentation of parse_next_alignment() for further reference about parsing and how the information is stored. Example : Returns : An Bio::SeqFeature::Generic object holding Bio::Tools::Sim4::Exon objects as sub features. Args : next_feature Title : next_feature Usage : while($exonset = $sim4->next_feature()) { # do something } Function: Does the same as L<next_exonset()>. See there for documentation of the functionality. Call this method repeatedly until FALSE is returned. The returned object is actually a SeqFeatureI implementing object. This method is required for classes implementing the SeqAnalysisParserI interface, and is merely an alias for next_exonset() at present. Example : Returns : A Bio::SeqFeature::Generic object. Args : perl v5.14.2 2012-03-02 Bio::Tools::Sim4::Results(3pm)
All times are GMT -4. The time now is 06:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy