Skip to content

Sequence ID Extraction & Mapping

Extract unique sequence IDs from a collection of alignments and map them to the corresponding loci.

import pysegul
def extract_sequence_id():
ids = pysegul.IDExtraction(
input_fmt='nexus',
datatype='dna',
output_path='tests/output',
map_id=True,
output_prefix='ids',
)
ids.from_dir('tests/align-data')

To use a list of files, call from_files instead of from_dir:

ids.from_files(['tests/align-data/alignment1.nex', 'tests/align-data/alignment2.nex'])
OptionDefaultDescription
input_fmtRequired'auto', 'fasta', 'nexus', 'phylip'
datatypeRequired'dna', 'aa', 'ignore'
output_pathRequiredOutput directory
map_idFalseAlso write a file mapping each ID to the files that contain it
output_prefixNoneName of the output files
MethodDescription
from_dir(input_dir)Extract IDs from the sequence files in a directory
from_files(input_files)Extract IDs from a list of sequence files

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.