SEQanswers

Go Back   SEQanswers > General



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it possible to create a consensus sequence from a fasta file? ssnowfox Pacific Biosciences 4 06-23-2016 07:21 PM
Is it possible to create a consensus sequence from a fasta file? ssnowfox Bioinformatics 1 02-12-2015 12:01 PM
adapters sequence fasta file mmmm Bioinformatics 14 12-12-2013 10:39 PM
How to combine all the seqences in a fasta file to one sequence? wmseq Bioinformatics 7 10-28-2013 08:40 AM
FASTA sequence From large BAM file mez Bioinformatics 9 01-13-2013 05:42 AM

Reply
 
Thread Tools
Old 11-20-2015, 03:16 AM   #1
nmauri
Junior Member
 
Location: spain

Join Date: Nov 2015
Posts: 1
Post how to get the ID of the sequence matched from a fasta file

Hi Everyone!
I am a begginer in Bioinformatics and I need to solve the following problem:
I have a fasta file of protein that looks like this:
>id1
AASEQUENCE1
>id2
AASEQUENCE2
>id3
AASEQUENCE3

I have to match a sequence, for example, AIKA in each sequence and then return the corresponding ids of matches.
Thanks a lot
nmauri is offline   Reply With Quote
Old 11-20-2015, 05:28 AM   #2
dariober
Senior Member
 
Location: Cambridge, UK

Join Date: May 2010
Posts: 310
Default

This has been asked before in different flavours. If you are ok using shell/bash, try this:

Code:
awk -v RS=">" 'NR>1 {sub("\n", "\t"); gsub("\n", ""); print ">"$0}' test.fa \
| awk -v FS="\t" '$2 ~ /AIKA/ {sub("\t", "\n"); print $0}'
First awk linearizes the fasta file, second awk captures records containing AIKA and outputs back in fasta format. The original line wrapping is lost though.
dariober is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT -8. The time now is 10:46 PM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO