Sponsored Content
Top Forums Shell Programming and Scripting Shorten header of protein sequences in fasta file Post 302881214 by alexypaul on Friday 27th of December 2013 07:34:12 AM
Old 12-27-2013
Shorten header of protein sequences in fasta file

I have a fasta file as follows

Code:
>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 complex subunit alpha-2 OS=Rattus norvegicus GN=Ap2a2 PE=1 SV=3
MPAVSKGEGMRGLAVFISDIRNCKSKEAEIKRINKELANIRSKFKGDKALDGYSKKKYVC
KLLFIFLLGHDIDFGHMEAVNLLSSNRYTEKQIGYLFISVLVNSNSELIRLINNAIKNDL
ASRNPTFMGLALHCIANVGSREMAEAFAGEIPKILVAGDTMDSVKQSAALCLLRLYRTSP
DLVPMGDWTSRVVHLLNDQHLGVVTAATSLITTLAQKNPEEFKTSVSLAVSRLSRIVTSA
STDLQDYTYYFVPAPWLSVKLLRLLQCYPPPDPAVRGRLTECLETILNKAQEPPKSKKVQ

I would like to shorten the header of each sequence like this

Code:
>O15090
MCDAFVGTWKLVSSENFDDYMKEVGVGFATRKVAGMAKPNMIISVNGDVITIKSESTFKN
TEISFILGQEFDEVTADDRKVKSTITLDGGVLVHVQKWDGKSTTIKRKREDDKLVVECVM
KGVTSTRVYERA
>L18484
MPAVSKGEGMRGLAVFISDIRNCKSKEAEIKRINKELANIRSKFKGDKALDGYSKKKYVC
KLLFIFLLGHDIDFGHMEAVNLLSSNRYTEKQIGYLFISVLVNSNSELIRLINNAIKNDL
ASRNPTFMGLALHCIANVGSREMAEAFAGEIPKILVAGDTMDSVKQSAALCLLRLYRTSP
DLVPMGDWTSRVVHLLNDQHLGVVTAATSLITTLAQKNPEEFKTSVSLAVSRLSRIVTSA
STDLQDYTYYFVPAPWLSVKLLRLLQCYPPPDPAVRGRLTECLETILNKAQEPPKSKKVQ

Any help would be greatly appreciated
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

script to shorten usernames and output to file

Hopefully someone here can point me in the correct direction. I'm working on a username migration and am trying to map my users ols usernames to the new ones. Right now every user has a username of firstname.lastname i.e. john.doe I'm trying to create a bash or python script that will take... (3 Replies)
Discussion started by: binary-ninja
3 Replies

2. Shell Programming and Scripting

Shell script for changing the accession number of DNA sequences in a FASTA file

Hi, I am having a file of dna sequences in fasta format which look like this: >admin_1_45 atatagcaga >admin_1_46 atatagcagaatatatat with many such thousands of sequences in a single file. I want to the replace the accession Id "admin_1_45" similarly in following sequences to... (5 Replies)
Discussion started by: margarita
5 Replies

3. 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

4. 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

5. UNIX for Dummies Questions & Answers

Fasta header modification

Hi, I need some help with modifying fasta headers. I have a fasta file with thousands of contigs and I need to modify their headers with the information obtained from a second file. File 1 contains the fasta sequences: >contig0001 length=11115 numreads=10777 agatgtagatctct... (6 Replies)
Discussion started by: Lokaps
6 Replies

6. 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

7. 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

8. Shell Programming and Scripting

Find header in a text file and prepend it to all lines until another header is found

I've been struggling with this one for quite a while and cannot seem to find a solution for this find/replace scenario. Perhaps I'm getting rusty. I have a file that contains a number of metrics (exactly 3 fields per line) from a few appliances that are collected in parallel. To identify the... (3 Replies)
Discussion started by: verdepollo
3 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
LASTAL(1)							   User Commands							 LASTAL(1)

NAME
lastal - genome-scale comparison of biological sequences SYNOPSIS
lastal [options] lastdb-name fasta-sequence-file(s) DESCRIPTION
Find local sequence alignments. Score options (default settings): -r: match score (DNA: 1, protein: blosum62, 0<Q<5: 6) -q: mismatch cost (DNA: 1, protein: blosum62, 0<Q<5: 18) -p: file for residue pair scores -a: gap existence cost (DNA: 7, protein: 11, 0<Q<5: 21) -b: gap extension cost (DNA: 1, pro- tein: 2, 0<Q<5: 9) -c: unaligned residue pair cost (100000) -F: frameshift cost (off) -x: maximum score drop for gapped alignments (max[y, a+b*20]) -y: maximum score drop for gapless alignments (t*10) -z: maximum score drop for final gapped alignments (x) -d: minimum score for gapless alignments (e*3/5) -e: minimum score for gapped alignments (DNA: 40, protein: 100, 0<Q<5: 180) Cosmetic options (default settings): -h: show all options and their default settings -v: be verbose: write messages about what lastal is doing -o: output file -f: output format: 0=tabular, 1=maf (1) Miscellaneous options (default settings): -s: strand: 0=reverse, 1=forward, 2=both (2 for DNA, 1 for protein) -m: maximum multiplicity for initial matches (10) -l: minimum length for initial matches (1) -n: maximum number of gapless alignments per query position (infinity) -k: step-size along the query sequence (1) -i: query batch size (1 MiB if Q>0, else 16 MiB if j=0, else 128 MiB) -u: mask lowercase during extensions: 0=never, 1=gapless, 2=gapless+gapped but not final, 3=always (2 if lastdb -c and Q<5, else 0) -w: supress repeats inside exact matches, offset by this distance or less (1000) -G: genetic code file -t: 'temperature' for calculating probabilities (1/lambda) -g: 'gamma' parameter for gamma-centroid and LAMA (1) -j: output type: 0=match counts, 1=gapless, 2=redundant gapped, 3=gapped, 4=column ambiguity estimates, 5=gamma-centroid, 6=LAMA (3) -Q: input format: 0=fasta, 1=fastq-sanger, 2=fastq-solexa, 3=fastq-illumina, 4=prb, 5=PSSM (0) REPORTING BUGS
Report bugs to: last (ATmark) cbrc (dot) jp LAST home page: http://last.cbrc.jp/ lastal 199 May 2012 LASTAL(1)
All times are GMT -4. The time now is 10:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy