#!/usr/bin/perl -w use strict; open (IDS, '<', "fastaIds") or #with your data 2056360012 2056360013 die "cannot open fastaIds $!\n"; #-------------# my %ids; while (<IDS>) #process first file with only ID's { chomp; $ids{$_}=1; } #-------------# $/='>'; #input record separator is now '>' while (<DATA>) { chomp; # now works on '>' not \n next if /^\s*$/; # first record will be blank my ($id) = /^\s*(\d+)/; print ">$_" if $ids{$id}; #print all lines for this id } #-------------# =prints > 2056360012 1047627436237 yyyacgagchagshgashcgahcgac acsasasasacsacsasasacaca ascassacsaascascascascac > 2056360013 1047627436238 xxxxcgagchagshgashcgahcgac acsasasasacsacsasasacaca ascassacsaascascascascac =cut __DATA__ > 2056360012 1047627436237 yyyacgagchagshgashcgahcgac acsasasasacsacsasasacaca ascassacsaascascascascac > 2056360013 1047627436238 xxxxcgagchagshgashcgahcgac acsasasasacsacsasasacaca ascassacsaascascascascac
In reply to Re^7: fasta hash
by Marshall
in thread fasta hash
by morio56
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |