Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Need help with deleting certain characters on a line Post 302314737 by kylle345 on Saturday 9th of May 2009 09:26:21 PM
Old 05-09-2009
Need help with deleting certain characters on a line

I have a file that looks like this:

It is a huge file and basically I want to delete everything at the > line except for the number after “C”.

>c1154[org=S_mikatae][moltype=genomic][contig=c996]
ATCTCACTCGTAATTCTACATAATTTTGTTTATGCTTTTATTGTCATTTTATATATTGTCAGTCATTATCCTATTACATTATCAATCCTTGCATTTCAGC TTCCACTTATTTCGATGACCGCTTCTCATAACTTATGTCATCTTCTAACACCGTATATGATAATGTACCAGTAGTATGAC
>c584[org=S_bayanus][moltype=genomic][contig=c290]
GCAAGCTTTATAGTGACAACAATAAGGTATCACTCGGTTACAATTACCCCCACTTCCCCT

So basically I want the file to look like this:

>1154
ATCTCACTCGTAATTCTACATAATTTTGTTTATGCTTTTATTGTCATTTTATATATTGTCAGTCATTATCCTATTACATTATCAATCCTTGCATTTCAGC TTCCACTTATTTCGATGACCGCTTCTCATAACTTATGTCATCTTCTAACACCGTATATGATAATGTACCAGTAGTATGAC
>584
GCAAGCTTTATAGTGACAACAATAAGGTATCACTCGGTTACAATTACCCCCACTTCCCCT


Thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Deleting the blank line in a file and counting the characters....

Hi, I am trying to do two things in my script. I will really appreciate any help in this regards. Is there a way to delete a last line from a pipe delimited flat file if the last line is blank. If the line is not blank then do nothing..... Is there a way to count a word that are starting... (4 Replies)
Discussion started by: rkumar28
4 Replies

2. Shell Programming and Scripting

Deleting First Two Characters On Each Line

How would one go about deleting the first two characters on each line of a file on Unix? I thought about using awk, but cannot seem to find if it can explicitly do this. In this case there might or might not be a field separator. Meaning that the data might look like this. 01999999999... (5 Replies)
Discussion started by: scotbuff
5 Replies

3. Shell Programming and Scripting

deleting last characters of a word

Hi All is there a way to delete last n characters from a word like say i have employee_new i want to delete _new. and just get only employee I want this in AIX Shell scripting Thanks (3 Replies)
Discussion started by: rajaryan4545
3 Replies

4. Shell Programming and Scripting

Deleting Characters at specific position in a line if the line is certain length

I've got a file that would have lines similar to: 12345678 x.00 xx.00 x.00 xxx.00 xx.00 xx.00 xx.00 23456781 x.00 xx.00 xx.00 xx.00 xx.00 x.00 xxx.00 xx.00 xx.00 xx.00 34567812 x.00 xx.00 x.00 xxx.00 xx.00 xx.00 xx.00 45678123 x.00 xx.00 xx.00 xx.00 xx.00 x.00 xxx.00 xx.00 xx.00 xx.00 xx.00... (10 Replies)
Discussion started by: Cailet
10 Replies

5. Shell Programming and Scripting

Help need in Deleting Characters

Hi, I have a log file whose size is number of characters in the file with multiple lines. Example: SQL*Loader: Release 10.2.0.4.0 - Production on Sat Sep 12 07:55:29 2009 Copyright (c) 1982, 2007, Oracle. All rights reserved. Control File: ../adm/ctl/institution.ctl Character Set... (4 Replies)
Discussion started by: rajeshorpu
4 Replies

6. Shell Programming and Scripting

deleting rows that have certain characters

Hi, I want to delete rows whenever column one has the letters 'rpa'. The file is tab seperated. e.g. years 1 bears 1 cats 2 rpat 3 rpa99 4 rpa011 5 then removing 'rpa' containing rows based on the first column years 1 bears 1 cats 2 thanks (7 Replies)
Discussion started by: phil_heath
7 Replies

7. Shell Programming and Scripting

Deleting all characters before the last occurrence of /

Hi All, I have a text file with the following text in it: file:///About/accessibility.html file:///About/disclaimer.html file:///About/disclaimer.html#disclaimer file:///pubmed?term=%22Dacre%20I%22%5BAuthor%5D file:///pubmed?term=%22Madigan%20J%22%5BAuthor%5D... (8 Replies)
Discussion started by: shoaibjameel123
8 Replies

8. Shell Programming and Scripting

Deleting new line characters

Hi, I have a weird requirement. I am having a file with 12fields in it and the end of the line for each record is "\n" (Just \n and no carriage returns) and the field delimiter is "|". Problem is I can have new line characters in any field in the data and these new line characters can even come... (11 Replies)
Discussion started by: ngkumar
11 Replies

9. Shell Programming and Scripting

Deleting particular characters from each line in a file in bash

Hi All, I am struck with an issue. I need to delete '%' and 'G' from all lines in the input file. Below is what I want to do. InputFile 04/09/2012.21:58:17,well9,rootfs,3.9G,2.7G,1.1G,71%,/ 04/09/2012.21:58:17,well9,/dev/hda2,3.9G,2.7G,1.1G,71%,/... (6 Replies)
Discussion started by: vharsha
6 Replies

10. UNIX for Dummies Questions & Answers

Deleting a pattern in UNIX without deleting the entire line

Hi I have a file: r58778.3|SOURCES={KEY=f665931a...,fw,221-705}|ERRORS={16_1:T,30_1:T,56_1:C,57_1:T,59_1:A,101_1:A,115:-,158_1:C,186_1:A,204:-,271_1:T,305:-,350_1:C,368_1:G,442_1:C,472_1:G,477_1:A}|SOURCE_1="Contig_1092402550638"(f665931a359e36cea0976db191ff60ff09cc816e) I want to retain... (15 Replies)
Discussion started by: Alyaa
15 Replies
Bio::Assembly::Scaffold(3pm)				User Contributed Perl Documentation			      Bio::Assembly::Scaffold(3pm)

NAME
Bio::Assembly::Scaffold - Perl module to hold and manipulate sequence assembly data. SYNOPSIS # # Module loading use Bio::Assembly::IO; # Assembly loading methods my $aio = Bio::Assembly::IO->new(-file=>"test.ace.1", -format=>'phrap'); my $assembly = $aio->next_assembly; foreach my $contig ($assembly->all_contigs) { # do something... (see Bio::Assembly::Contig) } DESCRIPTION
Bio::Assembly::Scaffold was developed to store and manipulate data from sequence assembly programs like Phrap. It implements the ScaffoldI interface and intends to be generic enough to be used by Bio::Assembly::IO drivers written to programs other than Phrap. 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 rfsouza@citri.iq.usp.br APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ new () Title : new Usage : $scaffold = new ( -id => "assembly 1", -source => 'program_name', -contigs => @contigs, -singlets => @singlets ); Function: creates a new scaffold object Returns : Bio::Assembly::Scaffold Args : -id : [string] scaffold name -source : [string] sequence assembly program -contigs : reference to array of Bio::Assembly::Contig objects -singlets : reference to array of Bio::Assembly::Singlet objects Accessing general assembly data id Title : id Usage : $assembly->id() Function: Get/Set assembly ID Returns : string or undef Args : string annotation Title : annotation Usage : $assembly->annotation() Function: Get/Set assembly annotation object Returns : Bio::Annotation::Collection Args : none get_nof_contigs Title : get_nof_contigs Usage : $assembly->get_nof_contigs() Function: Get the number of contigs included in the scaffold Returns : integer Args : none get_nof_contig_seqs Title : get_nof_contig_seqs Usage : $assembly->get_nof_contig_seqs() Function: Get the number of sequences included in contigs of the scaffold (no consensus sequences or singlets) Returns : integer Args : none get_nof_singlets (get_nof_singlet_seqs) Title : nof_singlets Usage : $assembly->nof_singlets() Function: Get the number of singlets included in the assembly Returns : integer Args : none get_all_seq_ids Title : get_all_seq_ids Usage : $assembly->get_all_seq_ids() Function: Get the ID of all sequences making up the scaffold (sequences from contigs and singlets, not consensus). Returns : array of strings Args : none get_nof_seqs Title : get_nof_seqs Usage : $assembly->get_nof_seqs() Function: Get total number of sequences making up the scaffold (sequences from contigs and singlets, not consensus). Returns : integer Args : none get_contig_seq_ids Title : get_contig_seq_ids Usage : $assembly->get_contig_seq_ids() Function: Get the ID of all sequences in contigs Returns : array of strings 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. An empty array otherwise Args : none get_singlet_ids (get_singlet_seq_ids) Title : get_singlet_ids Usage : $assembly->get_singlet_ids() Function: Access list of singlet IDs from assembly Returns : array of strings if there are any singlets otherwise an empty array Args : none get_seq_by_id Title : get_seq_by_id Usage : $assembly->get_seq_by_id($id) Function: Get a reference for an sequence making up the scaffold (from a contig or singlet, not consensus) Returns : a Bio::LocatableSeq object undef if sequence $id is not found in the scaffold Args : [string] sequence identifier (id) get_contig_by_id Title : get_contig_by_id Usage : $assembly->get_contig_by_id($id) Function: Get a reference for a contig 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 Returns : Bio::Assembly::Singlet object or undef Args : [string] a singlet ID Modifier methods add_contig Title : add_contig Usage : $assembly->add_contig($contig) Function: Add a contig to the assembly Returns : 1 on success Args : a Bio::Assembly::Contig object order (optional) add_singlet Title : add_singlet Usage : $assembly->add_singlet($seq) Function: Add a singlet to the assembly Returns : 1 on success Args : a Bio::Assembly::Singlet object order (optional) update_seq_list Title : update_seq_list Usage : $assembly->update_seq_list() Function: Synchronizes the assembly registry for sequences in contigs and contig actual aligned sequences content. You probably want to run this after you remove/add a sequence from/to a contig in the assembly. Returns : 1 for success Args : none remove_contigs Title : remove_contigs Usage : $assembly->remove_contigs(1..4) Function: Remove contig from assembly object Returns : an array of removed Bio::Assembly::Contig objects Args : an array of contig IDs See function get_contig_ids() above remove_singlets Title : remove_singlets Usage : $assembly->remove_singlets(@singlet_ids) Function: Remove singlet from assembly object Returns : the Bio::Assembly::Singlet objects removed Args : a list of singlet IDs See function get_singlet_ids() above remove_features_collection Title : remove_features_collection Usage : $assembly->remove_features_collection() Function: Removes the collection of features associated to every contig and singlet of the scaffold. This can be useful to save some memory (when contig and singlet features are not needed). Returns : none Argument : none Contig and singlet selection methods select_contigs Title : select_contigs Usage : $assembly->select_contigs(@list) Function: Select 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 (in lexical id order) 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 (in lexical order by id) Args : none perl v5.14.2 2012-03-02 Bio::Assembly::Scaffold(3pm)
All times are GMT -4. The time now is 08:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy