Skip to content

Sequence Filtering

Filter sequences across many sequence files by length or proportion of gaps.

Set the input with input_dir or input_files, then call a filtering method.

import pysegul
def filter_sequences():
filter = pysegul.SequenceFiltering(
input_fmt='nexus',
datatype='dna',
output_path='tests/output',
output_fmt='fasta',
)
filter.input_dir = 'tests/align-data'
filter.minimal_length(100)
OptionDefaultDescription
input_fmtRequired'auto', 'fasta', 'nexus', 'phylip'
datatypeRequired'dna', 'aa', 'ignore'
output_pathRequiredOutput directory
output_fmtRequired'fasta', 'nexus', 'phylip', or interleaved 'fasta-int', 'nexus-int', 'phylip-int'
AttributeDescription
input_dirDirectory of input sequence files
input_filesList of input sequence files
MethodRemove sequences
minimal_length(min_length)shorter than min_length, gaps excluded
maximal_length(max_length)longer than max_length, gaps excluded
maximal_gap(max_gap)with more than max_gap (0.0–1.0) gaps

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.