pulsatrix 1.1.0
Loading...
Searching...
No Matches
protein_sequences.hpp File Reference

Protein sequence input (PLM-2): ESM's tokenizer from its vocab.txt, and FASTA files. More...

#include <string>
#include <string_view>
#include <vector>
#include "pulsatrix/text_tokenizer.hpp"
Include dependency graph for protein_sequences.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pulsatrix::FastaRecord
 One FASTA record. More...
 

Namespaces

namespace  pulsatrix
 

Functions

TextTokenizer pulsatrix::MakeEsmTokenizer (const std::vector< std::string > &vocab)
 ESM's tokenizer (Hugging Face's EsmTokenizer) over a vocabulary listed one token per line, by id: <cls> <pad> <eos> <unk> L A G V ... <mask> for ESM-2.
 
TextTokenizer pulsatrix::LoadEsmTokenizer (const std::string &vocab_path)
 MakeEsmTokenizer on a vocab.txt.
 
std::vector< FastaRecord > pulsatrix::ParseFasta (std::string_view text)
 Parses FASTA text: records start with >, sequences may span lines, and blank lines and ; comment lines are skipped. Line endings may be \n or \r\n.
 
std::vector< FastaRecord > pulsatrix::ReadFasta (const std::string &path)
 ParseFasta on a file.
 
std::string pulsatrix::WriteFasta (const std::vector< FastaRecord > &records, size_t width=60)
 FASTA text for records, sequences wrapped at width residues (0: one line).
 

Detailed Description

Protein sequence input (PLM-2): ESM's tokenizer from its vocab.txt, and FASTA files.