Sponsored Content
Top Forums Shell Programming and Scripting Remove whatever is mention in brackets Post 302731851 by Priyanka Chopra on Friday 16th of November 2012 01:00:05 AM
Old 11-16-2012
Remove whatever is mention in brackets

Hi all

My previous question was complicated let me simplify it

I have to just remove whatever is present in bracket () along with brackets

Code:
 ERCC1 (PA155)    Platinum compounds (PA164713176)    Allele A is not associated with response to Platinum compounds in women with Ovarian Neoplasms as compared to allele C .
CES1 (PA107)    methylphenidate (PA450464)    Genotype CT is not associated with response to methylphenidate in children with Attention Deficit Disorder with Hyperactivity as compared to genotype CC .
BCKDK (PA134899581),PRSS53 (PA165450635),VKORC1 (PA133787052)    warfarin (PA451906)    Genotype CT is associated with increased dose of warfarin in people with Thromboembolism as compared to genotype TT .
CFH (PA29261)    bevacizumab (PA130232992)    Genotype GG is associated with decreased response to bevacizumab in people with Macular Degeneration as compared to genotype AA .
ADH1A (PA24570)    cytarabine (PA449177);fludarabine (PA449655);gemtuzumab ozogamicin (PA164749431);idarubicin (PA449961)    Genotypes CT + TT are associated with increased resistance to cytarabine, fludarabine, gemtuzumab ozogamicin and idarubicin in people with Leukemia, Myeloid, Acute as compared to genotype CC .
CYP2C19 (PA124)    clopidogrel (PA449053)    Genotype CT is associated with increased response to clopidogrel in people with Coronary Artery Disease as compared to genotype CC .

Expected output is

Code:
ERCC1     Platinum compounds  Allele A is not associated with response to Platinum compounds in women with Ovarian Neoplasms as compared to allele C .
CES1    methylphenidate   Genotype CT is not associated with response to methylphenidate in children with Attention Deficit Disorder with Hyperactivity as compared to genotype CC .
BCKDK ,PRSS53 ,VKORC1     warfarin    Genotype CT is associated with increased dose of warfarin in people with Thromboembolism as compared to genotype TT .
CFH     bevacizumab     Genotype GG is associated with decreased response to bevacizumab in people with Macular Degeneration as compared to genotype AA .
ADH1A     cytarabine ;fludarabine ;gemtuzumab ozogamicin ;idarubicin   Genotypes CT + TT are associated with increased resistance to cytarabine, fludarabine, gemtuzumab ozogamicin and idarubicin in people with Leukemia, Myeloid, Acute as compared to genotype CC .
CYP2C19   clopidogrel     Genotype CT is associated with increased response to clopidogrel in people with Coronary Artery Disease as compared to genotype CC

Following code is removing brackets but not whetver present inside brackets:

Code:
awk -v p="[()]" '{
for(i=1;i<=NF;i++)
 if(gsub(p,"",$i))
  if(++a[$i]>1) 
   $i=""
for(i in a)
 delete a[i]
}1' infile

any changes which can be made in the code?

Last edited by Franklin52; 11-16-2012 at 03:42 AM.. Reason: adding code tags
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove text between brackets

How can I use bash to remove all text between "<" and ">" in a file? (1 Reply)
Discussion started by: locoroco
1 Replies

2. Shell Programming and Scripting

Remove brackets { } in the data

Hello folks, I have a data file in which each line has 54 numbers, and every 3 numbers are bracketed. So totally 18 pairs of brackets in each line. A typical line is like: {29.187000274658203 -16.148000717163086 -0.9380000233650208} {30.63800048828125 -15.977999687194824... (5 Replies)
Discussion started by: rockytodd
5 Replies

3. Shell Programming and Scripting

remove brackets and put it in a column and remove repeated entry

Hi all, I want to remove the remove bracket sign ( ) and put in the separate column I also want to remove the repeated entry like in first row in below input (PA156) is repeated ESR1 (PA156) leflunomide (PA450192) (PA156) leflunomide (PA450192) CHST3 (PA26503) docetaxel... (2 Replies)
Discussion started by: manigrover
2 Replies

4. Shell Programming and Scripting

Remove brackets repeats and separate in columns

Hi all, I want to remove the remove bracket sign ( ) and put in the separate column I also want to remove the repeated entry like in first row in below input (PA156) is repeated ESR1 (PA156) leflunomide (PA450192) (PA156) leflunomide (PA450192) CHST3 (PA26503) docetaxel... (4 Replies)
Discussion started by: manigrover
4 Replies

5. Shell Programming and Scripting

Remove everything inside of brackets

I need to use something bash related to remove everything inside of brackets. For example. In the following: abc<def>ghi<jkl>mno the result should be: abcghimno (4 Replies)
Discussion started by: locoroco
4 Replies

6. Shell Programming and Scripting

Dont want to mention user id passwd in shell script

Hi, i have one shell script which transfers files from one server to other server through FTP, but i can see login id and password is not mentioned. kindly help to understand the script.then how below script is working if login and password is not mentioned in script #!/bin/sh... (1 Reply)
Discussion started by: ni3b007
1 Replies

7. Shell Programming and Scripting

Remove multiline text between brackets

I have some text in a file like so This is {the first day of} my life. What I would like as output is This is my life. Any text between the curly braces is removed. In the forums I've found statements like sed 's/<*>//g' but the problem is that I think that... (12 Replies)
Discussion started by: climatron
12 Replies

8. Shell Programming and Scripting

Mention file include on command line: awk

Hi All: I need your help please. I have a include file *.awk , and I would want to know if it's there a option's awk where I can use this file include, for example: awk -f decodifica_bitmap.awk cadena_hex.txt -e /home/snh/Awk/include/funciones.awk > sal.out it give error: awk:... (1 Reply)
Discussion started by: solaris21
1 Replies

9. Shell Programming and Scripting

How to remove the text between all curly brackets from text file?

Hello experts, I have a text file with lot of curly brackets (both opening { & closing } ). I need to delete them alongwith the text between opening & closing brackets' pair. For ex: Input:- 59. Rh1 Qe4 {(Qf5-e4 Qd8-g8+ Kg6-f5 Qg8-h7+ Kf5-e5 Qh7-e7+ Ke5-f5 Qe7-d7+ Qe4-e6 Qd7-h7+ Qe6-g6... (6 Replies)
Discussion started by: prvnrk
6 Replies
Bio::PopGen::Individual(3pm)				User Contributed Perl Documentation			      Bio::PopGen::Individual(3pm)

NAME
Bio::PopGen::Individual - An implementation of an Individual who has Genotype or Sequence Results SYNOPSIS
use Bio::PopGen::Individual; my $ind = Bio::PopGen::Individual->new(-unique_id => $id, -genotypes => @genotypes); DESCRIPTION
This object is a container for genotypes. 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 list. 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 of the bugs and their resolution. Bug reports can be submitted via the web: https://redmine.open-bio.org/projects/bioperl/ AUTHOR - Jason Stajich Email jason-at-bioperl.org CONTRIBUTORS
Matthew Hahn, matthew.hahn-at-duke.edu APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ new Title : new Usage : my $obj = Bio::PopGen::Individual->new(); Function: Builds a new Bio::PopGen::Individual object Returns : an instance of Bio::PopGen::Individual Args : -unique_id => $id, -genotypes => @genotypes unique_id Title : unique_id Usage : my $id = $individual->unique_id Function: Unique Identifier Returns : string representing unique identifier Args : string num_of_results Title : num_of_results Usage : my $count = $person->num_results; Function: returns the count of the number of Results for a person Returns : integer Args : none annotation Title : annotation Usage : my $annotation_collection = $ind->annotation; Function: Get/set a Bio::AnnotationCollectionI for this individual Returns : Bio::AnnotationCollectionI object Args : [optional set] Bio::AnnotationCollectionI object add_Genotype Title : add_Genotype Usage : $individual->add_Genotype Function: add a genotype value Returns : count of the number of genotypes associated with this individual Args : @genotypes - L<Bio::PopGen::GenotypeI> object(s) containing alleles plus a marker name reset_Genotypes Title : reset_Genotypes Usage : $individual->reset_Genotypes; Function: Reset the genotypes stored for this individual Returns : none Args : none remove_Genotype Title : remove_Genotype Usage : $individual->remove_Genotype(@names) Function: Removes the genotypes for the requested markers Returns : none Args : Names of markers get_Genotypes Title : get_Genotypes Usage : my @genotypes = $ind->get_Genotypes(-marker => $markername); Function: Get the genotypes for an individual, based on a criteria Returns : Array of genotypes Args : either none (return all genotypes) or -marker => name of marker to return (exact match, case matters) has_Marker Title : has_Marker Usage : if( $ind->has_Marker($name) ) {} Function: Boolean test to see if an Individual has a genotype for a specific marker Returns : Boolean (true or false) Args : String representing a marker name get_marker_names Title : get_marker_names Usage : my @names = $individual->get_marker_names; Function: Returns the list of known marker names Returns : List of strings Args : none perl v5.14.2 2012-03-02 Bio::PopGen::Individual(3pm)
All times are GMT -4. The time now is 01:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy