I have a fasta file and an ID list file. I try to subset fasta sequences from the fasta file based on ID list using
seqtk subseq <fastafile> ID_list > out_file
However in the output file the order of the sequences is not preserved. I need the sequences in the outfile in the same order as in the ID list . Thanks
Thanks prakash but it produces an unusual result It doesn't subset properly
If I am not wrong you need fasta sequence for selected Id ? right?
yes I have fasta sequence file and an ID file. THe sequences need to be extracted from the sequence file according to the entries in the ID file but the order of sequences in the outfile shall be same as ID file entries.
can you please provide few example of Id ?
sequence file
Now filter according to Ids list like
I have edited the script, I hope its working fine now
I tried it but it produces the same contents as ID file. NO sequences are extracted.
I think your Id file contains sequence id as >abc , >jkl. So accordingly i have edited the script. If that is the case , then the script should give intended result.
My ID file entries are like
the script says Died at script.pl line 14.
The above script should work for input file provided below:
Fasta_file
Sequence_id_file
Output_filename
Follow below usage to avoid any error