SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract subset of Fastq sequences based on a list of IDs pepperoni Bioinformatics 36 05-06-2013 02:38 AM
PubMed: Graph-based clustering and characterization of repetitive sequences in next-g Newsbot! Literature Watch 1 10-31-2012 04:10 AM
Script for extracting random sub-set of sequences silver_steve Bioinformatics 9 01-16-2012 11:07 PM
Create one sequence based on overlapping primer sequences in amplicon ketan_bnf Bioinformatics 2 09-15-2011 01:33 AM
building unigene form contigs genelab Bioinformatics 0 12-09-2010 11:24 PM

Reply
 
Thread Tools
Old 02-22-2010, 09:32 AM   #1
Lisa
Member
 
Location: Ohio

Join Date: Jan 2010
Posts: 10
Default pick up some unigene sequences based on a id set

Hello,

I am wondering if anyone would like to share some scripts to pick up sequences from fasta format dataset (Unigene) based on a group of id. Thanks a lot.


Lisa
Lisa is offline   Reply With Quote
Old 02-23-2010, 12:31 AM   #2
simonandrews
Simon Andrews
 
Location: Babraham Inst, Cambridge, UK

Join Date: May 2009
Posts: 871
Default

Rather than write scripts to do this I'd normally create a local database using the tools in EMBOSS (dbxfasta for a fasta database). Once you've indexed it then you can do batch retrieval of sequences really easily using the seqret program.

If you'd rather handle this in a script then there are existing indexing schemes available in most languages. For Perl you could use a simple Fasta index via something like Bio::Index::Fasta or go the more formal route to create a Bio:: DB::Flat database
simonandrews is offline   Reply With Quote
Old 02-23-2010, 06:12 AM   #3
Lisa
Member
 
Location: Ohio

Join Date: Jan 2010
Posts: 10
Default

Thanks a lot. That would definitely help!
Lisa
Lisa is offline   Reply With Quote
Old 02-23-2010, 06:23 AM   #4
maubp
Peter (Biopython etc)
 
Location: Dundee, Scotland, UK

Join Date: Jul 2009
Posts: 1,543
Default

If you want to using scripting, for a Python option you might try Biopython's Bio.SeqIO.index() functionality which can be used on a FASTA file or many other formats. See:
http://news.open-bio.org/news/2009/0...n-seqio-index/
maubp is offline   Reply With Quote
Old 02-23-2010, 09:14 AM   #5
Lisa
Member
 
Location: Ohio

Join Date: Jan 2010
Posts: 10
Default

I downloaded a Unigene set fron NCBI, which is in fasta format as the following,

>gnl|UG|Les#S50866699 Solanum lycopersicum cDNA, clone: LEFL1002BB12, HTC in leaf /gb=AK319185 /gi=225321
324 /ug=Les.1 /len=3282
CAACTCCCAATTC......

I created a index with the following sample code ( eg, test1.pl) based the data set with the command as

perl test1.pl myindex Les.seq.uniq

# Complete code for making an index for several
# fasta files ----------test1.pl
use Bio::Index::Fasta;
use strict;
my $Index_File_Name = shift;
my $inx = Bio::Index::Fasta->new(
'-filename' => $Index_File_Name,
'-write_flag' => 1);
$inx->make_index(@ARGV);


Then, I tried the following sample code ( test2.pl) to retrieve a sequence with the command as

perl test2.pl myindex UG:Les#S50866699

# Print out several sequences present in the index
# in Fasta format --------test2.pl
use Bio::Index::Fasta;
use strict;
my $Index_File_Name = shift;
my $inx = Bio::Index::Fasta->new('-filename' => $Index_File_Name);
my $out = Bio::SeqIO->new('-format' => 'Fasta','-fh' => *STDOUT);
foreach my $id (@ARGV) {
my $seq = $inx->fetch($id); # Returns Bio::Seq object
$out->write_seq($seq);
}

Finally, I got this error message


------------- EXCEPTION -------------
MSG: Did not provide a valid Bio::PrimarySeqI object
STACK Bio::SeqIO::fasta::write_seq /usr/lib/perl5/site_perl/5.8.8/Bio/SeqIO/fasta.pm:178
STACK toplevel retrieve_seq.pl:12
-------------------------------------


What is the wrong I made? Please help! Thanks a lot!
Lisa is offline   Reply With Quote
Old 02-24-2010, 12:01 AM   #6
maubp
Peter (Biopython etc)
 
Location: Dundee, Scotland, UK

Join Date: Jul 2009
Posts: 1,543
Default

I'd try asking on the BioPerl mailing list - they're a helpful bunch
maubp 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 03:23 PM.


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