in reply to Re^2: comparing two fasta files
in thread comparing two fasta files
As for the code you've just posted, you didn't really try to use the DB::Fasta module, and you don't seem to understand the syntax for a while loop (you need parens around the conditional, and a block of code to be the body of the loop). As for doing a regex match: /regex/ by itself will test the contents of $_, whereas $var =~ /regex/ tests the contents of $var; what you have, blahblah && =~ /regex/ is a syntax error.use strict; use Bio::DB::Fasta; my $db = new Bio::DB::Fasta( "Library.fa" ) # this should be the bigg +er file or die "Failed to create Fasta DB object on Library.fa\n"; open( IDLIST, "Name.fa" ); # this is the list of ID strings while ( <IDLIST> ) { my ($id) = (/^>(\S+)/); # capture the id string (without the init +ial ">") print ">$id\n", $db->seq( $id ), "\n"; }
Also, you need to be aware that "@line1" is a completely different thing (different variable with different storage) from "$line1". To refer to an element of an array, you need square brackets and an array index: $line1[0] etc.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: comparing two fasta files
by nemo2 (Initiate) on Aug 02, 2008 at 14:51 UTC | |
by graff (Chancellor) on Aug 02, 2008 at 19:42 UTC | |
|
Re^4: comparing two fasta files
by nemo2 (Initiate) on Aug 02, 2008 at 08:34 UTC | |
|
Re^4: comparing two fasta files
by sesemin (Beadle) on Jul 13, 2010 at 18:18 UTC |