Sponsored Content
Top Forums Shell Programming and Scripting Shell script for changing the accession number of DNA sequences in a FASTA file Post 302881563 by RavinderSingh13 on Monday 30th of December 2013 10:34:04 AM
Old 12-30-2013
Hello,

One more approach with sed may help.

Code:
sed 's/\(^>.*_\)\(.*\)/my_desired_text_\2/g' file_name

Output will be as follows.

Code:
my_desired_text_45
atatagcaga
my_desired_text_46
atatagcagaatatatat



Thanks,
R. Singh

---------- Post updated at 11:34 AM ---------- Previous update was at 10:30 AM ----------

One more approach for same as follows.


Code:
awk -vs1="my_desired_ouput_" -F"_" '/^>/ {print s1$NF} !/^>/' file

Output will be as follows.

Code:
my_desired_ouput_45
atatagcaga
my_desired_ouput_46
atatagcagaatatatat


Thanks,
R. Singh
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Extracting DNA sequences from GenBank files using Perl

Hi all, Using Perl, I need to extract DNA bases from a GenBank file for a given plant species. A sample GenBank file is here... Nucleotide This is saved on my computer as NC_001666.gb. I also have a file that is saved on my computer as NC_001666.txt. This text file has a list of all... (5 Replies)
Discussion started by: akreibich07
5 Replies

2. UNIX for Dummies Questions & Answers

trying to grep -v multiple changing sequences from a file

Hello All - I am looking for help on how to solve a re-occuring problem. I have a file with certain sequences in it that need to be removed. The sequences are always different but the fix is always the same remove those sequences and leave the rest. Another team ID's the bad sequences and then I... (3 Replies)
Discussion started by: candyluv030
3 Replies

3. Shell Programming and Scripting

Tricky task with DNA sequences.

I am trying to reverse and complement my DNA sequences. The file format is FASTA, something like this: Now, to reverse the sequence, I should start reading from right to left. At the same should be complemented. Thus, "A" should be read as "T"; "C" should be read as "G"; "T" should be converted... (8 Replies)
Discussion started by: Xterra
8 Replies

4. Shell Programming and Scripting

Extract sequences from a FASTA file based on another file

I have two files. File1 is shown below. >153L:B|PDBID|CHAIN|SEQUENCE RTDCYGNVNRIDTTGASCKTAKPEGLSYCGVSASKKIAERDLQAMDRYKTIIKKVGEKLCVEPAVIAGIISRESHAGKVL KNGWGDRGNGFGLMQVDKRSHKPQGTWNGEVHITQGTTILINFIKTIQKKFPSWTKDQQLKGGISAYNAGAGNVRSYARM DIGTTHDDYANDVVARAQYYKQHGY >16VP:A|PDBID|CHAIN|SEQUENCE... (7 Replies)
Discussion started by: nelsonfrans
7 Replies

5. Shell Programming and Scripting

Shorten header of protein sequences in fasta file

I have a fasta file as follows >sp|O15090|FABP4_HUMAN Fatty acid-binding protein, adipocyte OS=Homo sapiens GN=FABP4 PE=1 SV=3 MCDAFVGTWKLVSSENFDDYMKEVGVGFATRKVAGMAKPNMIISVNGDVITIKSESTFKN TEISFILGQEFDEVTADDRKVKSTITLDGGVLVHVQKWDGKSTTIKRKREDDKLVVECVM KGVTSTRVYERA >sp|L18484|AP2A2_RAT AP-2... (3 Replies)
Discussion started by: alexypaul
3 Replies

6. UNIX for Dummies Questions & Answers

Select distinct sequences from fasta file and list

Hi How can I extract sequences from a fasta file with respect a certain criteria? The beginning of my file (containing in total more than 1000 sequences) looks like this: >H8V34IS02I59VP SDACNDLTIALLQIAREVRVCNPTFSFRWHPQVKDEVMRECFDCIRQGLG YPSMRNDPILIANCMNWHGHPLEEARQWVHQACMSPCPSTKHGFQPFRMA... (6 Replies)
Discussion started by: Marion MPI
6 Replies

7. Shell Programming and Scripting

Getting unique sequences from multiple fasta file

Hi, I have a fasta file with multiple sequences. How can i get only unique sequences from the file. For example my_file.fasta >seq1 TCTCAAAGAAAGCTGTGCTGCATACTGTACAAAACTTTGTCTGGAGAGATGGAGAATCTCATTGACTTTACAGGTGTGGACGGTCTTCAGAGATGGCTCAAGCTAACATTCCCTGACACACCTATAGGGAAAGAGCTAAC >seq2... (3 Replies)
Discussion started by: Ibk
3 Replies

8. UNIX for Beginners Questions & Answers

How to count the length of fasta sequences?

I could calculate the length of entire fasta sequences by following command, awk '/^>/{if (l!="") print l; print; l=0; next}{l+=length($0)}END{print l}' unique.fasta But, I need to calculate the length of a particular fasta sequence specified/listed in another txt file. The results to to be... (14 Replies)
Discussion started by: dineshkumarsrk
14 Replies

9. Shell Programming and Scripting

Shorten header of protein sequences in fasta file to only organism name

I have a fasta file as follows >sp|Q8WWQ8|STAB2_HUMAN Stabilin-2 OS=Homo sapiens OX=9606 GN=STAB2 PE=1 SV=3 MMLQHLVIFCLGLVVQNFCSPAETTGQARRCDRKSLLTIRTECRSCALNLGVKCPDGYTM ITSGSVGVRDCRYTFEVRTYSLSLPGCRHICRKDYLQPRCCPGRWGPDCIECPGGAGSPC NGRGSCAEGMEGNGTCSCQEGFGGTACETCADDNLFGPSCSSVCNCVHGVCNSGLDGDGT... (3 Replies)
Discussion started by: jerrild
3 Replies

10. UNIX for Beginners Questions & Answers

How to add specific bases at the beginning and ending of all the fasta sequences?

Hi, I have to add 7 bases of specific nucleotide at the beginning and ending of all the fasta sequences of a file. For example, I have a multi fasta file namely test.fasta as given below test.fasta >TalAA18_Xoo_CIAT_NZ_CP033194.1:_2936369-2939570:+1... (1 Reply)
Discussion started by: dineshkumarsrk
1 Replies
cmemit(1)							  Infernal Manual							 cmemit(1)

NAME
cmemit - generate sequences from a covariance model SYNOPSIS
cmemit [options] cmfile seqfile DESCRIPTION
cmemit reads the covariance model(s) (CMs) in cmfile and generates a number of sequences from the CM(s); or if the -c option is selected, generates a single majority-rule consensus. This can be useful for various application in which one needs a simulation of sequences consis- tent with a sequence family consensus. By default, cmemit generates 10 sequences and outputs them in FASTA (unaligned) format to seqfile. GENERAL OPTIONS
-h Print brief help; includes version number and summary of all options, including expert options. -o <f> Save the synthetic sequences to file <f> rather than writing them to stdout. -n <n> Generate <n> sequences. Default is 10. -u Write the generated sequences in unaligned format (FASTA). This is the default, so this option is probably useless. -a Write the generated sequences in an aligned format (STOCKHOLM) with consensus structure annotation rather than FASTA. -c Predict a single majority-rule consensus sequence instead of sampling sequences from the CM's probability distribution. Highly con- served residues (base paired residues that score higher than 3.0 bits, or single stranded residues that score higher than 1.0 bits) are shown in upper case; others are shown in lower case. -l Configure the CMs into local mode before emitting sequences. See the User's Guide for more information on locally configured CMs. -s <n> Set the random seed to <n>, where <n> is a positive integer. The default is to use time() to generate a different seed for each run, which means that two different runs of cmemit on the same CM will give different results. You can use this option to generate repro- ducible results. --devhelp Print help, as with -h , but also include undocumented developer options. These options are not listed below, are under development or experimental, and are not guaranteed to even work correctly. Use developer options at your own risk. The only resources for understanding what they actually do are the brief one-line description printed when --devhelp is enabled, and the source code. EXPERT OPTIONS
--rna Specify that the emitted sequences be output as RNA sequences. This is true by default. --dna Specify that the emitted sequences be output as DNA sequences. By default, the output alphabet is RNA. --tfile <f> Dump tabular sequence parsetrees (tracebacks) for each emitted sequence to file <f>. Primarily useful for debugging. --exp <x> Exponentiate the emission and transition probabilities of the CM by <x> and then renormalize those distributions before emitting sequences. This option changes the CM probability distribution of parsetrees relative to default. With <x> less than 1.0 the emitted sequences will tend to have lower bit scores upon alignment to the CM with cmalign. With <x> greater than 1.0, the emitted sequences will tend to have higher bit scores upon alignment to the CM. This bit score difference will increase as <x> moves further away from 1.0 in either direction. If <x> equals 1.0, this option has no effect relative to default. This option is useful for generating sequences that are either difficult ( <x> < 1.0) or easy ( <x> > 1.0) for the CM to distinguish as homologous from back- ground, random sequence. --begin <n> Truncate the resulting alignment by removing all residues before consensus column <n>, where <n> is a positive integer no greater than the consensus length of the CM. Must be used in combination with --end and either -a or --shmm (a developer option). --end <n> Truncate the resulting alignment by removing all residues after consensus column <n>, where <n> is a positive integer no greater than the consensus length of the CM. Must be used in combination with --begin and either -a or --shmm (a developer option). SEE ALSO
For complete documentation, see the User's Guide (Userguide.pdf) that came with the distribution; or see the Infernal web page, http://infernal.janelia.org/. COPYRIGHT
Copyright (C) 2009 HHMI Janelia Farm Research Campus. Freely distributed under the GNU General Public License (GPLv3). See the file COPYING that came with the source for details on redistribution conditions. AUTHOR
Eric Nawrocki, Diana Kolbe, and Sean Eddy HHMI Janelia Farm Research Campus 19700 Helix Drive Ashburn VA 20147 http://selab.janelia.org/ Infernal 1.0.2 October 2009 cmemit(1)
All times are GMT -4. The time now is 01:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy