Skip to content

Sequence Removal

Parts of a SEGUL commandThe command segul sequence remove --dir alignments/ --re="^Mus" has five parts: the program segul, the command sequence for the task group, the subcommand remove for the task, the input --dir alignments/ (folder or files), and the option --re="^Mus" (IDs to remove).segulProgramsequenceCommandtask groupremoveSubcommandtask--dir alignments/Inputfolder or files--re="^Mus"OptionsIDs to remove

Based on a list of IDs, you can remove sequences in a collection of alignments. This feature is the opposite of the segul sequence extract feature. Removing less than half of the sequences is faster than segul sequence extract.

You can remove sequences based on a list of sequence IDs. Input a list of IDs as a string separated by semi-colons.

Terminal window
segul sequence remove --dir [alignment-dir] -f [sequence-format-keyword] --id="[list-of-id]"

Example:

Terminal window
segul sequence remove --dir ./data/ -f fasta --id="seq_1;seq_2;seq_3"

Remove sequences based on a regular expression

Section titled “Remove sequences based on a regular expression”

Using regular expression:

Terminal window
segul sequence remove --dir [alignment-dir] -f [sequence-format-keyword] --re="[regex]"

Example:

The command below will remove all sequences whose IDs with the name started with Mus.

Terminal window
segul sequence remove --dir ./data/ -f fasta --re="^Mus"
OptionDescription
-d, --dirDirectory with alignments
-i, --inputAlignment files. Allows wildcards
-f, --input-formatInput format: auto (default), fasta, nexus, or phylip
--datatypeData type: dna (default), aa, or ignore
--id=Sequence IDs to remove, separated by semicolons
--re=Regular expression that matches the sequence IDs to remove
-F, --output-formatOutput format: nexus (default), phylip, fasta, nexus-int, phylip-int, or fasta-int
-o, --outputOutput directory. Default: Sequence-Remove
--forceOverwrite an existing output directory
--logLog file path. Default: segul.log

This material is based upon work supported by the National Science Foundation under grant numbers: DEB-1754393 and DEB-2244754. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the National Science Foundation.