Created
November 11, 2024 11:38
-
-
Save epaule/314aab91945ba1cb0cf27fd0393b0d34 to your computer and use it in GitHub Desktop.
remove ids from a fasta file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# usage: ruby remove_id_from_fasta.rb FILE_WITH_IDS FASTA_FILE | |
require 'bio' | |
ids = [] | |
File.foreach(ARGV.shift, chomp: true) do |line| | |
ids << line | |
end | |
Bio::FlatFile.auto(ARGF) do |ff| | |
ff.each do |entry| | |
puts entry.seq.to_fasta(entry.definition) unless ids.include?(entry.entry_id) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment