Skip to main content

Thank you for visiting You are using a browser version with limited support for CSS. To obtain the best experience, we recommend you use a more up to date browser (or turn off compatibility mode in Internet Explorer). In the meantime, to ensure continued support, we are displaying the site without styles and JavaScript.

Probabilistic variable-length segmentation of protein sequences for discriminative motif discovery (DiMotif) and sequence embedding (ProtVecX)


In this paper, we present peptide-pair encoding (PPE), a general-purpose probabilistic segmentation of protein sequences into commonly occurring variable-length sub-sequences. The idea of PPE segmentation is inspired by the byte-pair encoding (BPE) text compression algorithm, which has recently gained popularity in subword neural machine translation. We modify this algorithm by adding a sampling framework allowing for multiple ways of segmenting a sequence. PPE segmentation steps can be learned over a large set of protein sequences (Swiss-Prot) or even a domain-specific dataset and then applied to a set of unseen sequences. This representation can be widely used as the input to any downstream machine learning tasks in protein bioinformatics. In particular, here, we introduce this representation through protein motif discovery and protein sequence embedding. (i) DiMotif: we present DiMotif as an alignment-free discriminative motif discovery method and evaluate the method for finding protein motifs in three different settings: (1) comparison of DiMotif with two existing approaches on 20 distinct motif discovery problems which are experimentally verified, (2) classification-based approach for the motifs extracted for integrins, integrin-binding proteins, and biofilm formation, and (3) in sequence pattern searching for nuclear localization signal. The DiMotif, in general, obtained high recall scores, while having a comparable F1 score with other methods in the discovery of experimentally verified motifs. Having high recall suggests that the DiMotif can be used for short-list creation for further experimental investigations on motifs. In the classification-based evaluation, the extracted motifs could reliably detect the integrins, integrin-binding, and biofilm formation-related proteins on a reserved set of sequences with high F1 scores. (ii) ProtVecX: we extend k-mer based protein vector (ProtVec) embedding to variablelength protein embedding using PPE sub-sequences. We show that the new method of embedding can marginally outperform ProtVec in enzyme prediction as well as toxin prediction tasks. In addition, we conclude that the embeddings are beneficial in protein classification tasks when they are combined with raw amino acids k-mer features.


Bioinformatics and natural language processing (NLP) are research areas that have greatly benefited from each other since their beginnings and there have been always methodological exchanges between them. Levenshtein distance1 and Smith–Waterman2 algorithms for calculating string or sequence distances, the use of formal languages for expressing biological sequences3,4, training language model-based embeddings for biological sequences5, and using state-of-the-art neural named entity recognition architecture6 for secondary structure prediction7 are some instances of such influences. Similar to the complex syntax and semantic structures of natural languages, certain biophysical and biochemical grammars dictate the formation of biological sequences. This assumption has motivated a line of research in bioinformatics to develop and adopt language processing methods to gain a deeper understanding of how functions and information are encoded within biological sequences4,5,8. However, one of the apparent differences between biological sequences and many natural languages is that biological sequences (DNA, RNA, and proteins) often do not contain clear segmentation boundaries, unlike the existence of tokenizable words in many natural languages. This uncertainty in the segmentation of sequences has made overlapping k-mers one of the most popular representations in machine learning for all areas of bioinformatics research, including proteomics5,9, genomics10,11, epigenomics12,13, and metagenomics14,15. However, it is unrealistic to assume that fixed-length k-mers are units of biological sequences and that more meaningful units need to be introduced. This means that although choosing a fixed k value for sequence k-mers simplifies the problem of segmentation, it is an unrealistic assumption to assume that all important part of the sequences have the same length and we need to relax this assumption.

Although in some sequence-labeling tasks (e.g. secondary structure prediction or binding site prediction) sequences are implicitly divided into variable-length segments as the final output, methods to segment sequences into variable-length meaningful units as inputs of downstream machine learning tasks are needed. We recently proposed nucleotide pair encoding for phenotype and biomarker detection in 16S rRNA data16, which is extended in this work for protein informatics.

Here, we propose a segmentation approach for dividing protein sequences into frequent variable-length sub-sequences, called peptide-pair encoding (PPE). We took the idea of PPE from byte pair encoding (BPE) algorithm, which is a text compression algorithm introduced in 199417 that has been also used for compressed pattern matching in genomics18. Recently, BPE became a popular word segmentation method in machine translation in NLP for vocabulary size reduction, which also allows for open-vocabulary neural machine translation19. In contrast to the use of BPE in NLP for vocabulary size reduction, we used this idea to increase the size of symbols from 20 amino acids to a large set of variable-length frequent sub-sequences, which are potentially meaningful in bioinformatics tasks. In addition, as a modification to the original algorithm, we propose a probabilistic segmentation in a sampling framework allowing for multiple ways of segmenting a sequence into sub-sequences. In particular, we explore the use of PPE for protein sequence motif discovery as well as training embeddings for protein sequences.

De novo motif discovery

Protein short linear motif (SLiM) sequences are short sub-sequences of usually 3 to 20 amino acids that are presumed to have important biological functions; examples of such patterns are cleavage sites, degradation sites, docking sites, ligand binding sites, etc.20,21. Various computational methods have been proposed for the discovery of protein motifs using protein sequence information. Motif discovery is distinguished from searching for already known motifs in a set of unseen sequences (e.g., SLiMSearch22). Motif discovery can be done either in a discriminative or a non-discriminative manner. Most of the existing methods are framed as non-discriminative methods, i.e. finding overrepresented protein sub-sequences in a set of sequences of similar phenotype (positive sequences). Examples of non-discriminative methods are SLiMFinder23 (regular expression based approach), GLAM224 (simulated annealing algorithm for alignments of SLiMs), MEME25 (mixture model fitting by expectation-maximization), HH-MOTiF26 (retrieving short stretches of homology by comparison of Hidden Markov Models (HMMs) of closely related orthologs). Since other randomly conserved patterns may also exist in the positive sequences, reducing the false positive rate is a challenge for motif discovery27. In order to address this issue, some studies have proposed discriminative motif discovery, i.e. using negative samples or a background set to increase both the sensitivity and specificity of motif discovery. Some examples of discriminative motif miners are DEME28 (using a Bayesian framework over alignment columns), MotifHound29 (hypergeometric test on certain regular expressions in the input data), DLocalMotif30 (combining motif over-representation, entropy and spatial confinement in motif scoring).

Motif databases

General-purpose or specialized datasets are dedicated to maintaining a set of experimentally verified motifs from various resources (e.g., gene ontology). ELM21 as a general-purpose dataset of SLiM, and NLSdb31 as a specialized database for nuclear-specific motifs is instances of such efforts. Evaluation of mined motifs can be also subjective. Since the extracted motifs do not always exactly match the experimental motifs, residue-level or site-level evaluations have been proposed26,32. Despite great efforts in this area, computational motif mining has remained a challenging task and the state-of-the-art de novo approaches have reported relatively low precision and recall scores, especially at the residue level26.

Protein embedding

Word embedding has been one of the revolutionary concepts in NLP over the recent years and has been shown to be one of the most effective representations in NLP33,34,35. In particular, skip-gram neural networks combined with negative sampling36 has resulted in the state-of-the-art performance in a broad range of NLP tasks35. Recently, we introduced k-mer-based embedding of biological sequences using skip-gram neural network and negative sampling5, which became popular for protein feature extraction and has been extended for various classifications of biological sequences37,38,39,40,41,42,43.

In this work, inspired by unsupervised word segmentation in NLP, we propose a general-purpose segmentation of protein sequences in frequent variable-length sub-sequences called PPE, as a new representation for machine learning tasks. This segmentation is trained once over large protein sequences (Swiss-Prot) and then is applied to a given set of sequences. In this paper, we use this representation for developing a protein motif discovery framework as well as protein sequence embedding.


We suggest a discriminative and alignment-free approach for motif discovery that is capable of finding co-occurred motifs. We do not use sequence alignment; instead, we propose the use of general-purpose segmentation of positive and negative input sequences into PPE sequence segments. Subsequently, we use statistical tests to identify the significant discriminative features associated with the positive class, which are our ultimate output motifs. Being alignment-free makes DiMotif, in particular, a favorable choice for the settings where the positive sequences are not necessarily homologous sequences. In the end, we create sets of multi-part motifs using information theoretic measures on the occurrence patterns of motifs on the positive set. We evaluate DiMotif in the detection of the motifs related to 20 types of experimentally verified motifs and also for searching experimentally verified nuclear localization signal (NLS) motifs. The DiMotif achieved a high recall and a reasonable F1 in comparison with the competitive approaches. In addition, we evaluate a shortlist of extracted motifs on the classification of reserved sequences of the same phenotype for integrins, integrin-binding proteins, and biofilm formation proteins, where the phenotype has been detected with a high F1 score. However, a detailed analysis of the motifs and their biophysical properties are beyond the scope of this study, as the main focus is on introducing the method.


We extend our previously proposed protein vector embedding (Protvec)5 trained on k-mer segments of the protein sequences to a method of training them on variable-length segments of protein sequences, called ProtVecX. We evaluate our embedding via three protein classification tasks: (i) toxin prediction (binary classification), (ii) subcellular location prediction (four-way classification), and (iii) prediction of enzyme proteins versus non-enzymes (binary classification). We show that concatenation of the raw k-mer distributions with the embedding representations can improve the sequence classification performance over the use of either of k-mers only or embeddings only. In addition, combining of ProtVecX with k-mer occurrence can marginally outperform the use of our originally proposed ProtVec embedding together with k-mer occurrences in toxin and enzyme prediction tasks.

Material and Methods


Motif discovery datasets

ELM dataset: The eukaryotic linear motif dataset (ELM) is a commonly used resource of experimentally verified SLiMs. The ELM dataset is usually served as the gold standard for the evaluations of de novo motif discovery approaches. Due to the long run-time of DLocalMotif (one of the competitive methods) on large datasets, we perform the evaluation on a subset of ELM. In order to cover a variety of settings, we perform the evaluation on 20 motif discovery problems of 5 different motif types: (i) targeting site (TRG), (ii) post-translational modification sites (MOD), (iii) ligand binding sites (LIG), (iv) docking sites (DOC), and (v) degradation sites (DEG). From each category we randomly select 4 sub-types, which are as distinctive as possible (based on the text similarities in their title). Since the ELM dataset only provides a few accession IDs for each motif sub-types, to obtain more data for the domain-specific segmentation, we expand the positive set using NCBI BLAST. Since our method (DiMotif) and DLocalMotif are both instances of discriminative motif discovery methods, we have to create a background/negative as well. For this purpose, we randomly select sequences from UniRef50 ending up with a dataset 10 times larger than the whole ELM sequence dataset. Then for each motif type, we calculate the sequence 3-mer representation distance between those randomly selected sequences and the positive set. Subsequently, we sample from the randomly selected sequences based on the cosine distance distribution (considering the same size for the positive and the negative classes). This way the farther sequences from the positive set are more likely to be selected in the background or negative set.

Integrin-binding proteins: Integrins are mechanosensitive receptor proteins attaching the cytoskeleton to the extracellular matrix (ECM)44. The important roles of integrins in cell growth, proliferation, adhesion, and migration, motivates studies on molecular mechanisms existing in integrin-mediated cell-matrix adhesion44,45,46,47,48,49,50, where the discovery of relevant sequence motifs in the integrin adhesome can be of interest.We extract two positive and negative lists for integrin-binding proteins using the gene ontology (GO) annotation in the UniProt database51. For the positive class, we select all proteins annotated with the GO term GO:0005178 (integrin-binding). Removing all redundant sequences results in 2966 protein sequences. We then use 10% of sequences as a reserved set for evaluation and 90% for motif discovery and training purposes. For the negative class, we select a list of proteins sequences which are annotated with the GO term GO:0005515 (protein binding), but they are annotated neither as integrin-binding proteins (GO:0005178) nor the integrin complex (GO:0008305). Since the resulting set are still large, we limit the selection to reviewed Swiss-Prot sequences and filtered redundant sequences, resulting in 20,117 protein sequences, where 25% of these sequences (5029 sequences) are considered as the negative instances for training and validation, and 297 randomly selected instances (equal to 10% of the positive reserved set) as the negative instances for the negative part of the reserved set.

Integrin proteins: We extract a list of integrin proteins from the UniProt database by selecting entries annotated with the GO term GO:8305 (integrin complex) that also have integrin as part of their entry name. Removing the redundant sequences results in 112 positive sequences. For the negative sequences, we select sequences which are annotated for transmembrane signaling receptor activity (to be similar to integrins) (GO:4888) but which are neither the integrin complex (GO:8305) nor integrin-binding proteins (GO:0005178). Selection of reviewed Swiss-Prot sequences and removal of redundant proteins results in 1155 negative samples. We use 10% of both the positive and negative sequences as the reserved set for evaluation and 90% for motif discovery and training purposes.

Biofilm formation: Similar to integrin-binding proteins, positive and negative lists for biofilm formation are extracted via their GO annotation in UniProt51. For the positive class, we select all proteins annotated with the GO term GO:0042710] (biofilm formation). Removing all redundant sequences results in 1450 protein sequences. For the negative class, we select a list of protein sequences annotated within the parent node of biofilm formation in the GO database that is classified as being for a multi-organism cellular process (GO:44764) but not biofilm formation. Since the number of resulting sequences is large, we limit the selection to reviewed Swiss-Prot sequences and filter the redundant sequences, resulting in 1626 protein sequences. Again, we use 10% of both the positive and negative sequences as a reserved set for evaluation and 90% for motif discovery and training purposes.

Nuclear localization signals: A nuclear localization signal or sequence (NLS) is a protein sequence motif, working as a tag, enabling large molecules to be import into the cell nucleus52,53. NLS mining is one of the prominent problem-settings in protein motif discovery31. We use the NLSdb dataset containing nuclear export signals and NLS along with experimentally annotated nuclear and non-nuclear proteins31. By using NLSdb annotations from nuclear proteins, we extract a list of proteins experimentally verified to have NLS, ending up with a list of 416 protein sequences. For the negative class, we use the protein sequences in NLSdb annotated as being non-nuclear proteins. NLSdb also contains a list of 3254 experimentally verified motifs, which we use for evaluation purposes.

Protein classification datasets

Sub-cellular location of eukaryotic proteins: The first dataset we use for protein classification is the TargetP 4-classes dataset of sub-cellular locations. The 4 classes in this dataset are (i) 371 mitochondrial proteins, (ii) 715 pathway or signal peptides, (iii) 1214 nuclear proteins, and (iv) 438 cytosolic protein sequences54, where the redundant proteins are removed.

Toxin prediction: The second dataset we use is the toxin dataset provided by ToxClassifier55. The positive set contains 8093 protein sequences annotated in Tox-Prot as being animal toxins and venoms56. For the negative class, we choose the ‘Hard’ setting of ToxClassifier55, where the negative instances are 7043 protein sequences in UniProt which are not annotated in Tox-Prot but are similar to Tox-Prot sequences to some extent.

Enzyme detection: On the third we use an enzyme classification dataset. We download two lists of enzyme and non-enzyme proteins (22,168 protein sequences per class) provided by the ‘NEW’ dataset of Deepre57.

Peptide-pair encoding

PPE training

The input to the PPE algorithm is a set of sequences and the output would be segmented sequences and segmentation operations, an ordered list of amino acid merging operations to be applied for segmenting new sequences. At the beginning of the algorithm, we treat each sequence as a list of amino acids. As detailed in Algorithm 1, we then search for the most frequently occurring pair of adjacent amino acids in all input sequences. In the next step, the select pairs of amino acids are replaced by the merged version of the selected pair as a new symbol (a short peptide). This process is continued until we could not find a frequent pattern or we reach a certain vocabulary size (Algorithm 1).

In order to train a general-purpose segmentation of protein sequences, we train the segmentation over the most recent version of the Swiss-Prot database58, which contained 557,012 protein sequences (step (i) in Fig. 1). We continue the merging steps for T iterations of Algorithm 1, which ensures that we capture the motifs present with a minimum frequency f in all Swiss-Prot sequences (we set the threshold to a minimum of f = 10 times, resulting in T ≈ 1 million iterations). Subsequently, the merging operations can be applied to any given protein sequences as a general-purpose splitter. Although there exist larger sequence datasets than Swiss-Prot (e.g., UniProt and RefSeq), we decided to use the Swiss-Prot database, due to the high quality, and as computational requirements were less demanding. Principally, PPE segmentations can be generated from any database of interested, given enough time and computational resources.

Algorithm 1
figure a

Adapted Byte-pair algorithm (BPE) for segmentation of protein sequences.

Figure 1
figure 1

The main steps of DiMotif computational workflow: (i) The PPE segmentation steps can be learned from Swiss-Prot or a domain-specific set of sequences. (ii) These operations are then applied to positive and negative sequences and segment them into smaller sub-sequences. This means that all part of sequences are used till this part. A two-sided and FDR corrected χ2 test is then applied to find the sub-sequences (potential motifs) which are significantly related to the positive class, with a threshold p-value < 0.05. We rank the motifs based on their significance and retrieve the top-k (in the evaluation on the ELM dataset kmax = 30). (iii) The motifs, their structural and biophysical properties, and their co-occurrence information will be used for visualization.

Monte Carlo PPE segmentation

The PPE algorithm for a given vocabulary size (which is analogous to the number of merging steps in the training) divides a protein sequence into a unique sequence of sub-sequences. Further merging steps result in enlargement of sub-sequences, which results in having fewer sub-sequences. Such variations can be viewed as multiple valid schemes of sequence segmentation. For certain tasks, it might be useful to consider a protein sequence as a chain of residues and, in some cases, as a chain of large protein domains. Thus, sticking to a single segmentation scheme will result in ignoring important information for the task of interest. In order to address this issue, we propose a sampling framework for estimating the segmentation of a sequence in a probabilistic manner. We sample from the space of possible segmentations for both motif discovery and embedding creation.

Different segmentation schemes for a sequence can be obtained by a varying number of merging steps (N) in the PPE algorithm. However, since the algorithm is trained over a large number of sequences, a single merging step will not necessarily affect all sequences, and as we go further with merging steps, fewer sequences are affected by the newly introduced symbol. We estimate the probability density function of possible segmentation schemes with respect to N by averaging the segmentation alternatives over 1000 random sequences in Swiss-Prot for N [10000, 1000000], with a step size of 10000. For each N, we count the average number of introduced symbols relative to the previous step; the average is shown in Fig. 2. We use this distribution to draw samples from the vocabulary sizes that affected more sequences (i.e. those introducing more alternative segmentation schemes). To estimate this empirical distribution with a theoretical distribution, we fit a variety of distributions (Gaussian; Laplacian; and Alpha, Beta, and Gamma distributions) using maximum likelihood and found the Alpha that fitted the empirical distribution the best. Subsequently, we use the fitted Alpha distribution to draw segmentation samples from a sequence in a Monte Carlo scheme. Consider Φi,j as the l1 normalized “bag-of-word” representations in sequence i, using the jth sample from the fitted Alpha distribution. Thus, if we have M samples, the “bag-of-sub-sequences” representation of the sequence i can be estimated as \({{\rm{\Phi }}}_{i}=\frac{1}{M}\sum _{j}^{M}{{\rm{\Phi }}}_{i,j}\).

Figure 2
figure 2

Average number of segmentation alternation per merging steps for 1000 Swiss-prot sequences.

For detecting sequence motifs, we represented each sequence as an average over the count distribution of M samples of segmentation (M = 100) drawn from the Alpha distribution. The alternative is to use only the vocabulary size (e.g., the median of Alpha), referred to as the non-probabilistic segmentation in this paper.

DiMotif protein sequence motif discovery

Our proposed method for motif detection, called DiMotif, finds motifs in a discriminative setting over PPE features (step (ii) in Fig. 1). We segment all the sequences in the datasets (ignoring their labels or their membership of the train or the test set) with the learned PPE segmentation steps from Swiss-Prot (§2.2) (general-purpose segmentation) or with the learned PPE segmentation steps from a set of positive sequences (domain-specific segmentation). After segmentation, each sequence is represented as bag-of-PPE units. We use a two-sided and FDR corrected χ2 test to identify significant discriminative features between the positive and the negative (or background) sets. We discard insignificant motifs using a threshold for the p-value of <0.05. Since we are looking for sequence motifs related to the positive class, we exclude motifs related to the negative class.

Evaluation on ELM dataset

We compare the DiMotif performance with two recent motif discovery tools: (i) HH-Motif26 as an instance of non-discriminative methods and (ii) DLocalMotif30 as an instance of discriminative approaches. We evaluate the performances over the 20 problem settings related to 5 types of motifs in the ELM database. We measure precision and recall of the above methods for detection of the experimentally verified motifs (as true positive). From each method, we use the maximum top 30 retrieved motifs ranked based on their scores. Since finding exact matches are very unlikely and the motifs are only correct to some extent. We report precision and recall for different thresholds on motif sequence matching (50% and 70%). Then we calculate the average precision, recall, and F1 on these different settings. In order to investigate the performance of general-purpose versus domain-specific segmentations in DiMotif, once we used Swiss-Prot segmentation and once we learned the segmentation steps from the set of positive sequences and for both used the probabilistic segmentation schemes.

Classification-based evaluation of integrins, integrin-binding proteins, and biofilm formation motifs

In order to evaluate the obtained motifs, we train linear support vector machine classifiers over the training instances but only use motifs related to the positive class among the top 1000 motifs as well as a short list of features. Next, we test the predictive model on a reserved test set. Since the training and testing sets are disjoint, the classification results are indications of motif discovery quality. We use both probabilistic and non-probabilistic segmentation methods to obtain PPE representations of the sequences. We report the precision, recall, and F1 of each classifier’s performance. The average sequence similarities for the top hits between positive samples in the test set and the train set for integrins, integrin binding, and biofilm formation were 35.50 ± 14.41, 40.47 ± 18.15, and 40.13 ± 8.76 respectively. In addition, the average sequence similarities for the best hits for integrins, integrin binding, and biofilm formation were 83.96 ± 11.96, 91.64 ± 11.37, and 71.75 ± 15.79 respectively.

NLS motifs search

In the case of NLS motifs, we use the list of 3254 experimentally or manually verified motifs from NLSdb. Thus, in order to evaluate our extracted motifs, we directly compare our motifs with those found in earlier verification. As we cannot evaluate any true positive other than NLSdb this task can be considered as a motif search task. Since for long motifs, finding exact matches is challenging, we report three metrics, the number of motifs with at least three consecutive amino acid overlaps, the number of sequences in the baseline that had a hit with more than 70% overlap (A to B and B to A), and finally the number of exact matches. In addition to Swiss-Prot-based segmentation, in order to see the effect of a specialized segmentation, we also train PPE segmentation over a set of 8421 nuclear protein sequences provided by NLSdb31 and perform the same evaluation.

Kulback-Leibler divergence to find multi-part motifs: As discussed in §1, protein motifs can be multi-part patterns, which is ignored by many motif-finding methods. In order to connect the separated parts, we propose to calculate the symmetric Kullback–Leibler (KL) divergence59 between motifs based on their co-occurrences in the positive sequences as follows:

$${D}_{{{\rm{KL}}}_{{\rm{sym}}}}({M}_{p}||{M}_{q})={\sum }_{i}^{N}{M}_{p}(i)\,\mathrm{log}\,\frac{{M}_{p}(i)}{{M}_{q}(i)}+{M}_{q}(i)\mathrm{log}\,\frac{{M}_{q}(i)}{{M}_{p}(i)},$$

where Mp and Mq are, respectively, the normalized occurrence distributions of motif p and motif q across all positive samples and N is the number of positive sequences. Next, we use the condition of \(({D}_{{{\rm{KL}}}_{{\rm{sym}}}}=\mathrm{0)}\) to find co-occurring motifs splitting the motifs into equivalence classes. Each equivalent class indicates a multi-part or a single-part motif. Since we considered a “bag of motifs” assumption, the parts of multi-part motifs are allowed to be far from each other in the primary sequence.

Secondary structure assignment: Using the trained segmentation over the Swiss-Prot sequences, we segment all 385, 937 protein sequences in the current version of the PDB60, where their secondary structure was provided. By segmenting all secondary structures at the same positions as the corresponding sequences, we obtain a mapping from each sequence segment to all its possible secondary structures in the PDB. We use this information in coloring in the visualization of motifs (see the visualizations in §3.1).

Motif visualization

For visualization purposes DiMotif clusters motifs based on their co-occurrences in the positive class by using hierarchical clustering over the pairwise symmetric KL divergence. The motifs are then colored based on the most frequent secondary structure they assume in the sequences in the Protein Data Bank (PDB) (step (iii) in Fig. 1). For each motif, it visualizes their mean molecular weight, mean flexibility61, mean instability62, mean surface accessibility63, mean kd hydrophobicity64, and mean hydrophilicity65 with standardized scores (zero mean and unit variance), where the dark blue is the lowest and the dark red is the highest possible value (see the visualizations in §3.1).

ProtVecX: Extended variable-length protein vector embeddings

We trained the embedding on segmented sequences obtained from Monte Carlo sampling segmentation on the most recent version of the Swiss-Prot database58, which contains 557, 012 protein sequences. Since this embedding is the extended version of ProtVec (a brief introduction to the ProtVec is provided in the Supp. §1), we call it ProtVecX. As explained in §2.2 we segment each sequence with the vocabulary size samples drawn from an Alpha distribution. This ensures that we consider multiple ways of segmenting sequences during the embedding training. Subsequently, we train a skip-gram neural network for embedding on the segmented sequences36. The skip-gram neural network is analogous to language modeling, which predicts the surroundings (context) for a given textual unit (shown in Fig. 3). The skip-gram’s objective is to maximize the following log-likelihood:

$${\sum }_{t=1}^{M}{\sum }_{c\in [t-N,t+N]}\mathrm{log}\,p({w}_{c}|{w}_{t}),$$

where N is the surrounding window size around word wt, c is the context indices around index t, and M is the corpus size in terms of the number of available words and context pairs. We parameterize this probability of observing a context word wc given wt by using word embedding:

$$p({w}_{c}|{w}_{t};\theta )=\frac{{e}^{{v}_{c}\cdot {v}_{t}}}{{\sum }_{c^{\prime} \in {\mathscr{C}}}{e}^{{v}_{c^{\prime} }\cdot {v}_{t}}},$$

where \({\mathscr{C}}\) denotes all existing contexts in the training data. However, iterating over all existing contexts is computationally expensive. This issue can be efficiently addressed by using negative sampling. In a negative sampling framework, we can rewrite Equation 2 as follows:

$$\sum _{t\mathrm{=1}}^{T}[\sum _{c\in [t-N,t+N]}\mathrm{log}(1+{e}^{-s({w}_{t},{w}_{c})})+\sum _{{w}_{r}\in {{\mathscr{N}}}_{t,c}}\mathrm{log}(1+{e}^{s({w}_{t},{w}_{r})})],$$

where \({{\mathscr{N}}}_{t,c}\) denotes a set of randomly selected negative examples sampled from the vocabulary collection as non-contexts of wt and \(s({w}_{t},{w}_{c})={{v}_{t}}^{\top }\cdot {v}_{c}\) (parameterization with the word vector vt and the context vector vc). For training embeddings on PPE units, we used the sub-word level skip-gram, known as fasttext66. Fasttext embedding improves the word representations by taking character k-mers of the sub-words into consideration in calculating the embedding of a given word. For instance, if we take the PPE unit fggagvg and k = 3 as an example, it will be represented by the following character 3-mers and the whole word, where ‘<’ and ‘>’ denote the start and the end of a PPE unit:

$${{\mathscr{S}}}_{fggagvg}=\{{\mathtt{^{\prime} }}\langle {\mathtt{f}}{\mathtt{g}}{\mathtt{^{\prime} }}{\mathtt{,}}{\mathtt{^{\prime} }}{\mathtt{\text{fg}}}{\mathtt{g}}{\mathtt{^{\prime} }}{\mathtt{,}}{\mathtt{^{\prime} }}{\mathtt{\text{gg}}}{\mathtt{a}}{\mathtt{^{\prime} }}{\mathtt{,}}{\mathtt{^{\prime} }}{\mathtt{\text{ga}}}{\mathtt{g}}{\mathtt{^{\prime} }}{\mathtt{,}}{\mathtt{^{\prime} }}{\mathtt{agv}}{\mathtt{,}}{\mathtt{^{\prime} }}{\mathtt{\text{gv}}}{\mathtt{g}}{\mathtt{^{\prime} }}{\mathtt{,}}{\mathtt{^{\prime} }}{\mathtt{vg}}\rangle {\mathtt{^{\prime} }}{\mathtt{,}}{\mathtt{^{\prime} }}\langle {\mathtt{fggagvg}}\rangle {\mathtt{^{\prime} }}\}$$
Figure 3
figure 3

Skip-gram neural network for training language model-based embedding. In this framework the inputs are the segmented sequences and the network is trained to predict the surroundings PPE units.

In the fasttext model, the scoring function will be based on the vector representation of k-mers (2 ≤ k ≤ 6) that exist in textual units (PPE units in this case), \(s({w}_{t},{w}_{c})={\sum }_{x\in {{\mathscr{S}}}_{{w}_{t}}}\,{v}_{x}^{\top }{v}_{c}\).

We used a vector dimension of 500 for the embedding (vt’s) and a window size of 20 (the vector size and the window size have been selected based on a systematic exploration of parameters in protein classification tasks). A k-mer-based ProtVec of the same vector size and the same window size trained on Swiss-Prot is used for comparison.

Embedding-based classification

For the classification, we use a Multi-Layer-Perceptrons (MLP) neural network architecture with five hidden layers using Rectified Linear Unit (ReLU) as the nonlinear activation function. We use the softmax activation function at the last layer to produce the probability vector that could be regarded as representing posterior probabilities. To avoid overfitting, we perform early stopping and also use dropout at hidden layers. As baseline representations, we use k-mers, ProtVec5, ProtVecX, and their combinations. For both ProtVec and ProtVecX, the embedding of a sequence is calculated as the summation of its k-mers or PPE unit vectors. We evaluate these representation in three protein classification tasks: (i) toxin prediction (binary classification) with the ‘Hard’ setting in the ToxClassifier database55, (ii) subcellular location prediction (four-way classification) using the dataset provided by TargetP54, and (iii) prediction of enzyme proteins versus non-enzymes (binary classification) using the NEW dataset57. We report macro- precision, recall, and F-1 score. Macro averaging computes the metrics for each class separately and then simply averages over classes. This metric gives equal importance to all categories. In particular, we are interested in macro-F1, which makes a trade-off between precision and recall in addition to treating all classes equally.


Sequence motifs and evaluation results

Detection of experimentally verified motifs in the ELM dataset

A comparison of DiMotif with two existing motif discovery tools, HH-Motif (non-discriminative) and DLocalMotif (discriminative), is provided in Table 1. Since the discovered motifs only partially match the experimentally verified motifs, we measured precision, recall, and F1 scores for two minimum ratios of 50% and 70% sequence matching between the computationally discovered and the experimentally verified motifs (two sets of rows in Table 1 for two minimum sequence matching ratios). DiMotif was used with two different schemes of segmentation: (i) general-purpose segmentation (based-on Swiss-Prot) and (ii) domain-specific segmentation (learned over the sequences in the positive class). Overall, HH-Motif achieved the best F1 scores of 0.39 for 50% sequence matching and F1 of 0.24 for 70% sequence matching. The domain-specific DiMotif obtained F1 of 0.30 for 50% sequence matching and F1 of 0.07 for 70% sequence matching. The general-purpose DiMotif obtained F1 of 0.24 for 50% sequence matching and F1 of 0.05 for 70% sequence matching, while DLocalMotif obtained F1 of 0.16 for 50% sequence matching and F1 of 0.04 for 70% sequence matching. The domain-specific DiMotif achieved the maximum recall of 0.80 for 50% sequence matching and F1 of 0.32 for 70% sequence matching. Having high recall suggests that the DiMotif can be used for short-list creation for further experimental investigations on motifs.

Table 1 Comparison of DiMotif, HH-Motif, and DLocalMotif (four sets of columns) performances in detection of experimentally verified motifs in the ELM dataset.

Classification-based evaluation of integrins, integrin-binding, and biofilm formation motifs: The performances of machine learning classifiers in phenotype prediction using the extracted motifs as features are provided in Table 2 evaluated in both 10-fold cross-validation scheme, as well as in classifying unseen reserved sequences. Both probabilistic and non-probabilistic segmentation methods have been used to obtain PPE motifs. However, from the top extracted motifs only motifs associated with the positive class are used as features (representation column). For each classification setting, we report precision, recall, and F1 scores. The trained classifiers over the extracted motifs associated with the positive class could reliably predict the reserved integrins, integrin-binding proteins, and biofilm formation proteins with F1 scores of 0.89, 0.89, and 0.75 respectively. As described in §2.1 the sequences with certain degrees of redundancy were already removed and the training data and the reserved sets do not overlap. Thus, being able to predict the phenotype over the reserved sets with high F1 scores shows the quality of motifs extracted by DiMotif. This confirms that the extracted motifs are specific and inclusive enough to detect the phenotype of interest among an unseen set of sequences.

Table 2 Evaluation of protein sequence motifs mined via PPE motif discovery for classification of integrin-binding proteins and biofilm formation-associated proteins.

For integrin and biofilm formation, the probabilistic segmentation helps in predictions of the reserved dataset. This suggests that multiple views of segmenting sequences allows the statistical feature selection model to be more inclusive in observing possible motifs. Picking a smaller fraction of positive class motifs still resulted in a high F1 for the test sets. For biofilm formation, the probabilistic segmentation improved the classification F1 score from 0.72 to 0.73 when only 48 motifs were used, where single segmentation even using more features obtained an F1 score of 0.70 (Table 2). This classification result suggests that the only 48 motifs mined from the training set are enough to detect bioform formation proteins in the test set. Thus, such a combination can be a good representative of biofilm formation motifs.

Literature-based evaluation of NLS motifs: Since NLSdb provided us with an extensive list of experimentally verified NLS motifs, we evaluated the extracted motifs by measuring their overlap with NLSdb instead of using a classification-based evaluation. However, as discussed in §1 such a comparison can be very challenging. One reason is that different methods and technologies vary in their resolutions in specifying the motif boundaries. In addition, the motifs extracted by the computational methods may also contain some degrees of false negatives and false positives. Thus, instead of reporting exact matches in the experimentally verified set, we report how many of 3254 motifs in NLSdb are verified by our approach using three different degrees of similarity (medium overlap, large overlap, and exact match). The performance of DiMotif for both probabilistic segmentation and non-probabilistic segmentation are provided in Table 3. In order to investigate the performance of phenotype-specific versus general purpose segmentation, we also report the results based on segmentation that is learned from nuclear proteins, in addition to Swiss-Prot based segmentation (which is supposed to general purpose). Training the segmentation on nuclear proteins resulted in slightly better, but still competitive to the general-purpose Swiss-Prot segmentation. This result shows that the segmentation steps learned from Swiss-Prot can be considered as a general segmentation, which is important for low resource settings, i.e. the problem setting that the number of positive samples is relatively small. Similar to integrins and biofilm formation related proteins, the probabilistic segmentation has been more successful in detecting experimentally verified NLS motifs as well (Table 3).

Table 3 Evaluation of the significant nuclear localization signal (NLS) patterns against 3254 experimentally identified motifs.

DiMotif Visualization: The top extracted motifs are visualized using DiMotif software and are provided for interested readers, related to integrin-binding proteins (Fig. 4), biofilm formation (Fig. 5), and integrin complexes (Fig. 6). In these visualizations, motifs are clustered according to their co-occurrences within the positive set, i.e. if two motifs tend to occur together (not necessarily close in the linear chain) in these hierarchical clustering they are in a close proximity. In addition, each motif is colored based on the most frequent secondary structure that this motif can assume in all existing PDB structures (described in §2.3), the blue background shows loop, hydrogen bound or irregular structures, the yellow background shows β-sheet or β-bridge conformations, and red background shows helical structures. Furthermore, to facilitate the interpretation of the found motifs, DiMotif provides a heatmap representation of biophysical properties related to each motif, namely molecular weight, flexibility, instability, surface accessibility, kd hydrophobicity, and mean hydrophilicity with standardized scores (zero mean and unit variance) the dark blue is the lowest and the dark red is the highest possible value. Normalized scores allow for an easier visual comparison. For instance, interestingly in most cases in the trees (Figs 46), the neighbor motifs (co-occurring motifs) agree in their frequent secondary structures. Furthermore, some neighbor motifs agree in some provided biophysical properties. Such information can assist biologists and biophysicists to make hypotheses about the underlying motifs and mechanisms for further experiments. A detailed serious biophysical investigation of the extracted motifs is beyond the scope of this study. However, as an example, for integrin-binding proteins, the RGD motif, the most well-known integrin-binding motif was among the most significant motifs in our approach67,68,69. Other known integrin-binding motifs were also among the most significant ones, such as RLD68, KGD (the binding site for the αIIβ3 integrins70), GPR (the binding site for αxβ269), LDT (the binding site for α4β769), QIDS (the binding site for α4β169), DLLEL (the binding site for αvβ669), [tldv, rldvv, gldvs] (similar motifs to LDV, the binding site for α4β167), RGDS71, as well as the PEG motif72.

Figure 4
figure 4

Clustering of integrin-binding-specific motifs based on their occurrence in the annotation proteins. Each motif is colored based on the most frequent secondary structure it assumes in the Protein Data Bank (PDB) structure out of all PDB sequences. For each motif the biophysical properties are provided in a heatmap visualization, which shows from outer ring to inner ring: the mean molecular weight, mean flexibility, mean instability, mean surface accessibility, mean kd hydrophobicity, and mean hydrophilicity with standardized scores (zero mean and unit variance), where the dark blue is the lowest and the dark red is the highest possible value. Motifs are clustered based on their co-occurrences in the integrin-binding proteins.

Figure 5
figure 5

Clustering of biofilm formation-specific motifs based on their occurrence in the annotation proteins. Each motif is colored based on the most frequent secondary structure it assumes in the Protein Data Bank (PDB) structure out of all PDB sequences. For each motif the biophysical properties are provided in a heatmap visualization, which shows from outer ring to inner ring: the mean molecular weight, mean flexibility, mean instability, mean surface accessibility, mean kd hydrophobicity, and mean hydrophilicity with standardized scores (zero mean and unit variance), where the dark blue is the lowest and the dark red is the highest possible value. Motifs are clustered based on their co-occurrences in the biofilm formation proteins.

Figure 6
figure 6

Clustering of integrin-related motifs based on their occurrence in the annotation proteins. Each motif is colored based on the most frequent secondary structure it assumes in the Protein Data Bank (PDB) structure out of all PDB sequences. For each motif the biophysical properties are provided in a heatmap visualization, which shows from outer ring to inner ring: the mean molecular weight, mean flexibility, mean instability, mean surface accessibility, mean kd hydrophobicity, and mean hydrophilicity with standardized scores (zero mean and unit variance), where the dark blue is the lowest and the dark red is the highest possible value. Motifs are clustered based on their co-occurrences in the integrin proteins.

Results of protein classification tasks using embedding

Protein classification results for venom toxins, subcellular location, and enzyme predictions using deep MLP neural network on top of different combinations of features are provided in Table 4. In all these three tasks, combining the embeddings with raw k-mer distributions improves the classification performances (Table 4). This result suggests that k-mers can be more specific than embeddings for protein classification. However, embeddings can provide complementary information to the k-mers and improve the classification performances. Combining 3-mers with either ProtVecX or ProtVec embedding performed very competitively; even for sub-cellular prediction tasks, ProtVec performs slightly better. However, combining 3-mers with ProtVecX resulted in higher F1 scores for enzyme classification and toxin protein prediction. In our previously proposed ProtVec paper5 as well as other embedding-based protein classification papers43, embeddings have been used as the only representation. The presented results in Table 4 suggest that (i) k-mer representation is a tough-to-beat baseline in protein classification problems. (ii) The k-mer baseline alone outperforms ProtVec embeddings in many tasks. (iii) The ProtVec and ProtVecX embeddings only have added value when they are combined with the raw k-mer representations.

Table 4 Comparing k-mers, ProtVec, and ProtVecX and their combinations in protein classification tasks.


We proposed a new unsupervised method of feature extraction from protein sequences. Instead of fixed-length k-mers, we segmented sequences into the most frequent variable-length sub-sequences, inspired by BPE, a data compression algorithm. These sub-sequences were then used as features for downstream machine learning tasks. As a modification to the original BPE algorithm, we defined a probabilistic segmentation by sampling from the space of possible vocabulary sizes. This allows for considering multiple ways of segmenting a sequence into sub-sequences. The main purpose of this work was to introduce a variable-length segmentation of sequences, similar to word tokenization in natural languages. In particular, we introduced (i) DiMotif as an alignment-free discriminative protein sequence motif miner, as well as (ii) ProtVecX, a variable-length extension of protein sequence embedding.

We compared DiMotif against two recent existing tools for motif discovery: HH-Motif as an instance of non-discrminative methods, and DLocalMotif as an instance of discriminative methods. We compared the performances in the detection of 20 distinct sub-types of experimentally verified motifs. HH-Motif comparing HMMs of orthologs for retrieving SLiMs, achieved the best average F1 and the DiMotif with domain-specific segmentation achieved the second best F1. DiMotif achieved the highest recall, making it an ideal tool for finding a list of candidates for further experimental verification. Furthermore, we evaluated DiMotif by extracting motifs related to (i) integrins, (ii) integrin-binding proteins, and (iii) biofilm formation. We showed that the extracted motifs could reliably detect reserved sequences of the same phenotypes, as indicated by their high F1 scores. We also showed that DiMotif could reasonably detect experimentally identified motifs related to nuclear localization signals. By using KL divergence between the distribution of motifs in the positive sequences, DiMotif is capable of outputting multi-part motifs. A detailed biophysical interpretation of the motifs is beyond the scope of this work. However, the tree visualization of DiMotif as a tool can help biologists to come up with hypotheses about the motifs for further experiments. In addition, although homologous sequences in Swiss-Prot have indirectly contributed in DiMotif segmentation scheme, unlike conventional motif discovery algorithms, DiMotif does not directly use multiple sequence alignment information. Thus, it can be widely used in cases motifs need to be found from a set of non-homologous sequences.

We proposed ProtVecX embedding trained on sub-sequences in the Swiss-Prot database. We demonstrated that combining the raw k-mer distributions with the embedding representations can improve the sequence classification performance compared with using either k-mers only or embeddings only. In addition, combining ProtVecX with k-mer occurrences outperformed ProtVec embedding combined with k-mer occurrences for toxin and enzyme prediction tasks. Our results suggest that the recent works in the literature including our previously proposed ProtVec missed serving k-mer representation as a baseline, which is a tough-to-beat baseline. We show that embedding can be used as complementary information to the raw k-mer distribution and their added value is expressed when they are combined with k-mer features.

In this paper, we briefly touched motif discovery and protein classification tasks as use cases of peptide pair encoding representation. However, the application of this work is not limited to motif discovery or embedding training, and we expect this representation to be widely used in bioinformatics tasks as general purpose variable-length representation of protein sequences.

Data Availability

Implementations of our method is available under the Apache 2 licence at and


  1. Levenshtein, V. I. Binary codes capable of correcting deletions, insertions, and reversals. In Soviet Physics Doklady 10, 707–710 (1966).

    ADS  MathSciNet  Google Scholar 

  2. Waterman, M. S., Smith, T. F. & Beyer, W. A. Some biological sequence metrics. Adv. Math. (NY) 20, 367–387 (1976).

    MathSciNet  Article  Google Scholar 

  3. Searls, D. B. The computational linguistics of biological sequences. Artif. intelligence molecular biology 2, 47–120 (1993).

    Google Scholar 

  4. Searls, D. B. The language of genes. Nat. 420, 211 (2002).

    ADS  CAS  Article  Google Scholar 

  5. Asgari, E. & Mofrad, M. R. Continuous distributed representation of biological sequences for deep proteomics and genomics. PloS One 10, e0141287 (2015).

    Article  Google Scholar 

  6. Lample, G., Ballesteros, M., Subramanian, S., Kawakami, K. & Dyer, C. Neural architectures for named entity recognition. arXiv preprint arXiv:1603.01360 (2016).

  7. Johansen, A. R., Sønderby, C. K., Sønderby, S. K. & Winther, O. Deep recurrent conditional random field network for protein secondary prediction. In Proceedings of the 8th ACM International Conference on Bioinformatics, Computational Biology, and Health Informatics, 73–78 (ACM, 2017).

  8. Yandell, M. D. & Majoros, W. H. Genomics and natural language processing. Nat. Rev. Genet. 3, 601 (2002).

    CAS  Article  Google Scholar 

  9. Grabherr, M. G. et al. Full-length transcriptome assembly from rna-seq data without a reference genome. Nat. Biotechnol. 29, 644–652 (2011).

    CAS  Article  Google Scholar 

  10. Jolma, A. et al. Dna-binding specificities of human transcription factors. Cell 152, 327–339 (2013).

    CAS  Article  Google Scholar 

  11. Alipanahi, B., Delong, A., Weirauch, M. T. & Frey, B. J. Predicting the sequence specificities of dna-and rna-binding proteins by deep learning. Nat. Biotechnol. 33, 831–838 (2015).

    CAS  Article  Google Scholar 

  12. Awazu, A. Prediction of nucleosome positioning by the incorporation of frequencies and distributions of three different nucleotide segment lengths into a general pseudo k-tuple nucleotide composition. Bioinforma. 33, 42–48 (2016).

    Article  Google Scholar 

  13. Giancarlo, R., Rombo, S. E. & Utro, F. Epigenomic k-mer dictionaries: shedding light on how sequence composition influences in vivo nucleosome positioning. Bioinforma. 31, 2939–2946 (2015).

    CAS  Article  Google Scholar 

  14. Wood, D. E. & Salzberg, S. L. Kraken: Ultrafast metagenomic sequence classification using exact alignments. Genome Biol. 15, R46 (2014).

    Article  Google Scholar 

  15. Asgari, E., Garakani, K., McHardy, A. C. & Mofrad, M. R. K. Micropheno: predicting environments and host phenotypes from 16s rrna gene sequencing using a k-mer based representation of shallow sub-samples. Bioinforma. 34, i32–i42, (2018).

    Article  Google Scholar 

  16. Asgari, E., Münch, P. C., Lesker, T. R., McHardy, A. C. & Mofrad, M. R. DiTaxa: Nucleotide-pair encoding of 16S rRNA for host phenotype and biomarker detection. Bioinforma. bty954, (2018).

  17. Gage, P. A new algorithm for data compression. The C Users J. 12, 23–38 (1994).

    Google Scholar 

  18. Chen, L., Lu, S. & Ram, J. Compressed pattern matching in dna sequences. In Computational Systems Bioinformatics Conference, 2004. CSB 2004. Proceedings. 2004 IEEE, 62–68 (IEEE, 2004).

  19. Sennrich, R., Haddow, B. & Birch, A. Neural machine translation of rare words with subword units. arXiv preprintarXiv:1508.07909 (2015).

  20. Prytuliak, R. Recognition of short functional motifs in protein sequences. Ph.D. thesis, lmu (2018).

  21. Dinkel, H. et al. Elm—the database of eukaryotic linear motifs. Nucleic Acids Res. 40, D242–D251 (2011).

    Article  Google Scholar 

  22. Davey, N. E., Haslam, N. J., Shields, D. C. & Edwards, R. J. Slimsearch 2.0: biological context for short linear motifs in proteins. Nucleic Acids Res. 39, W56–W60 (2011).

    CAS  Article  Google Scholar 

  23. Edwards, R. J., Davey, N. E. & Shields, D. C. Slimfinder: a probabilistic method for identifying over-represented, convergently evolved, short linear motifs in proteins. PloS one 2, e967 (2007).

    ADS  Article  Google Scholar 

  24. Frith, M. C., Saunders, N. F., Kobe, B. & Bailey, T. L. Discovering sequence motifs with arbitrary insertions and deletions. PLoS Compu. Biol. 4, e1000071 (2008).

    ADS  MathSciNet  Article  Google Scholar 

  25. Bailey, T. L. et al. Meme suite: Tools for motif discovery and searching. Nucleic Acids Res. 37, W202–W208 (2009).

    CAS  Article  Google Scholar 

  26. Prytuliak, R., Volkmer, M., Meier, M. & Habermann, B. H. Hh-motif: de novo detection of short linear motifs in proteins by hidden markov model comparisons. Nucleic Acids Res. gkx341 (2017).

  27. Liu, B., Yang, J., Li, Y., McDermaid, A. & Ma, Q. An algorithmic perspective of de novo cis-regulatory motif finding based on chip-seq data. Brief. Bioinform. bbx026 (2017).

  28. Redhead, E. & Bailey, T. L. Discriminative motif discovery in dna and protein sequences using the deme algorithm. BMC Bioinforma. 8, 385 (2007).

    Article  Google Scholar 

  29. Kelil, A., Dubreuil, B., Levy, E. D. & Michnick, S. W. Fast and accurate discovery of degenerate linear motifs in protein sequences. PLoS One 9, e106081 (2014).

    ADS  Article  Google Scholar 

  30. Mehdi, A. M., Sehgal, M. S. B., Kobe, B., Bailey, T. L. & Bodén, M. Dlocalmotif: A discriminative approach for discovering local motifs in protein sequences. Bioinforma. 29, 39–46 (2013).

    CAS  Article  Google Scholar 

  31. Bernhofer, M. et al. Nlsdb—major update for database of nuclear localization signals and nuclear export signals. Nucleic Acids Res. 46, D503–D508 (2017).

    Article  Google Scholar 

  32. Prytuliak, R., Pfeiffer, F. & Habermann, B. H. Slalom, a flexible method for the identification and statistical analysis of overlapping continuous sequence elements in sequence-and time-series data. BMC bioinformatics 19, 24 (2018).

    Article  Google Scholar 

  33. Collobert, R. et al. Natural language processing (almost) from scratch. J. Mach. Learn. Res. 12, 2493–2537 (2011).

    MATH  Google Scholar 

  34. Tang, D. et al. Learning sentiment-specific word embedding for twitter sentiment classification. Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers) 1, 1555–1565 (2014).

    Article  Google Scholar 

  35. Levy, O. & Goldberg, Y. Neural word embedding as implicit matrix factorization. In Advances in Neural Information Processing systems, 2177–2185 (2014).

  36. Mikolov, T., Sutskever, I., Chen, K., Corrado, G. S. & Dean, J. Distributed representations of words and phrases and their compositionality. In Advances in Neural Information Processing Systems, 3111–3119 (2013).

  37. Asgari, E. & Mofrad, M. R. Comparing fifty natural languages and twelve genetic languages using word embedding language divergence (weld) as a quantitative measure of language distance. In In Proceedings of the NAACL-HLT Workshop on Multilingual and Cross-lingual Methods in NLP, San Diego, CA, 65–74 (Association for Computational Linguistics, 2016).

  38. Islam, S. A., Heil, B. J., Kearney, C. M. & Baker, E. J. Protein classification using modified n-grams and skip-grams. Bioinforma. 1481–1487 (2017).

  39. Min, S., Lee, B. & Yoon, S. Deep learning in bioinformatics. Brief. Bioinform. 18, 851–869 (2017).

    PubMed  PubMed Central  Google Scholar 

  40. Kim, S., Lee, H., Kim, K. & Kang, J. Mut2vec: Distributed representation of cancerous mutations. BMC Med. Genomics 11, 33 (2018).

    Article  Google Scholar 

  41. Jaeger, S., Fulle, S. & Turk, S. Mol2vec: Unsupervised machine learning approach with chemical intuition. J. Chem. Inf. Model. 58, 27–35 (2018).

    CAS  Article  Google Scholar 

  42. Du, J. et al. Gene2vec: Distributed representation of genes based on co-expression. bioRxiv 286096 (2018).

  43. Hamid, M. N. & Friedberg, I. Identifying antimicrobial peptides using word embedding with deep recurrent neural networks. bioRxiv 255505 (2018).

  44. Shams, H., Hoffman, B. D. & Mofrad, M. R. K. The ‘stressful’ life of cell adhesion molecules: On the mechanosensitivity of integrin adhesome. ASME Journal of Biomechanical Engineering, 2017 Dec 22

  45. Mehrbod, M., Trisno, S. & Mofrad, M. R. K. On the Activation of Integrin αIIbβ3: Outside-In and Inside-Out Pathways. Biophysical Journal, 2013 Sept, 105(6).

  46. Jamali, Y., Jamali, T. & Mofrad, M. R. K. An Agent Based Model of Integrin Clustering: Exploring the Role of Ligand Clustering, Integrin Homo-Oligomerization, Integrin-Ligand Affinity, Membrane Crowdedness and Ligand Mobility. Journal of Computational Physics 244, 264–278 (2012).

    ADS  Article  Google Scholar 

  47. Shams, H. & Mofrad, M. R. K. Interaction with α-actinin induces a structural kink in the transmembrane domain of β3-integrin and impairs signal transduction. Biophysical Journal 113(4), 948–956 (2017).

    ADS  CAS  Article  Google Scholar 

  48. Truong, T., Shams, H. & Mofrad, M. R. K. Mechanisms of integrin and filamin binding and their interplay with talin during early focal adhesion formation Integrative Biology. 2015.

  49. Mehrbod, M. & Mofrad, M. R. K. Localized Lipid Packing of Transmembrane Domains Impedes Integrin Clustering. PLoS Computational Biology 9(3), e1002948 (2013).

    ADS  CAS  Article  Google Scholar 

  50. Chen, H. S., Kolahi, K. S. & Mofrad, M. R. K. Phosphorylation Facilitates the Integrin Binding of Filamin Under Force. Biophysical Journal 97(12), 3095–104 (2009).

    ADS  CAS  Article  Google Scholar 

  51. Consortium, U. Uniprot: the universal protein knowledgebase. Nucleic Acids Res. 45, D158–D169 (2016).

    Google Scholar 

  52. Jahed, Z., Soheilypour, M., Peyro, M. & Mofrad, M. R. K. The LINC and NPC relationship: it’s complicated! Journal of Cell Science. J Cell Sci 129.17, 3219–3229 (2016).

    Article  Google Scholar 

  53. Jamali, T., Jamali, Y., Mehrbod, M. & Mofrad, M. R. K. Nuclear Pore Complex: Biochemistry and Biophysics of Nucleocytoplasmic Transport in Health and Disease. International Review of Cell and Molecular Biology 287, 233–286 (2011).

    CAS  Article  Google Scholar 

  54. Emanuelsson, O., Brunak, S., Von Heijne, G. & Nielsen, H. Locating proteins in the cell using targetp, signalp and related tools. Nat. Protoc. 2, 953–971 (2007).

    CAS  Article  Google Scholar 

  55. Gacesa, R., Barlow, D. J. & Long, P. F. Machine learning can differentiate venom toxins from other proteins having non-toxic physiological functions. PeerJ Comput. Sci. 2, e90 (2016).

    Article  Google Scholar 

  56. Jungo, F. & Bairoch, A. Tox-prot, the toxin protein annotation program of the swiss-prot protein knowledgebase. Toxicon 45, 293–301 (2005).

    CAS  Article  Google Scholar 

  57. Li, Y. et al. Deepre: Sequence-based enzyme ec number prediction by deep learning. Bioinforma. 1, 760–769 (2017).

    Google Scholar 

  58. Boutet, E. et al. Uniprotkb/swiss-prot, the manually annotated section of the uniprot knowledgebase: How to use the entry view. In Plant Bioinformatics, 23–54 (Springer, 2016).

  59. Kullback, S. & Leibler, R. A. On information and sufficiency. The annals mathematical statistics 22, 79–86 (1951).

    MathSciNet  Article  Google Scholar 

  60. Rose, P. W. et al. The rcsb protein data bank: Integrative view of protein, gene and 3d structural information. Nucleic Acids Res. gkw1000 (2016).

  61. Vihinen, M., Torkkila, E. & Riikonen, P. Accuracy of protein flexibility predictions. Proteins 19, 141–149 (1994).

    CAS  Article  Google Scholar 

  62. Guruprasad, K., Reddy, B. B. & Pandit, M. W. Correlation between stability of a protein and its dipeptide composition: a novel approach for predicting in vivo stability of a protein from its primary sequence. Protein Eng. Des. Sel. 4, 155–161 (1990).

    CAS  Article  Google Scholar 

  63. Emini, E. A., Hughes, J. V., Perlow, D. & Boger, J. Induction of hepatitis a virus-neutralizing antibody by a virus-specific synthetic peptide. J. Virol. 55, 836–839 (1985).

    CAS  PubMed  PubMed Central  Google Scholar 

  64. Kyte, J. & Doolittle, R. F. A simple method for displaying the hydropathic character of a protein. J. Mol. Biol. 157, 105–132 (1982).

    CAS  Article  Google Scholar 

  65. Hopp, T. P. & Woods, K. R. Prediction of protein antigenic determinants from amino acid sequences. Proc. Natl. Acad. Sci. USA 78, 3824–3828 (1981).

    ADS  CAS  Article  Google Scholar 

  66. Bojanowski, P., Grave, E., Joulin, A. & Mikolov, T. Enriching word vectors with subword information. arXiv preprint arXiv:1607.04606 (2016).

  67. Guan, J.-L. & Hynes, R. O. Lymphoid cells recognize an alternatively spliced segment of fibronectin via the integrin receptor a4b1. Cell 60, 53–61 (1990).

    CAS  Article  Google Scholar 

  68. Ruoslahti, E. RGD and other recognition sequences for integrins. Annu. Rev. Cell Dev. Biol. 12, 697–715 (1996).

    CAS  Article  Google Scholar 

  69. Plow, E. F., Haas, T. A., Zhang, L., Loftus, J. & Smith, J. W. Ligand binding to integrins. J. Biol. Chem. 275, 21785–21788 (2000).

    CAS  Article  Google Scholar 

  70. Plow, E. F., Pierschbacher, M. D., Ruoslahti, E., Marguerie, G. A. & Ginsberg, M. H. The effect of arg-gly-asp-containing peptides on fibrinogen and von willebrand factor binding to platelets. Proc. Natl. Acad. Sci. USA 82, 8057–8061 (1985).

    ADS  CAS  Article  Google Scholar 

  71. Kapp, T. G. et al. A comprehensive evaluation of the activity and selectivity profile of ligands for RGD-binding integrins. Sci. Rep. 7, 39805 (2017).

    ADS  CAS  Article  Google Scholar 

  72. Ochsenhirt, S. E., Kokkoli, E., McCarthy, J. B. & Tirrell, M. Effect of RGD secondary structure and the synergy site phsrn on cell adhesion, spreading and specific integrin engagement. Biomater. 27, 3863–3874 (2006).

    CAS  Article  Google Scholar 

Download references


Fruitful discussions with Hengameh Shams, Hinrich Schuetze, Benjamin Roth, Nina Poerner, Iddo Friedberg, and Ardavan Saeedi are gratefully acknowledged.

Author information




E.A. and M.R.K.M. conceived the project. E.A. implemented the method and wrote the main manuscript text. E.A., A.C.M., and M.R.K.M. contributed to the evaluations. All authors reviewed the manuscript.

Corresponding author

Correspondence to Mohammad R. K. Mofrad.

Ethics declarations

Competing Interests

The authors declare no competing interests.

Additional information

Publisher’s note: Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Supplementary information

Rights and permissions

Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this license, visit

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Asgari, E., McHardy, A. & Mofrad, M.R.K. Probabilistic variable-length segmentation of protein sequences for discriminative motif discovery (DiMotif) and sequence embedding (ProtVecX). Sci Rep 9, 3577 (2019).

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI:

Further reading


By submitting a comment you agree to abide by our Terms and Community Guidelines. If you find something abusive or that does not comply with our terms or guidelines please flag it as inappropriate.


Quick links

Nature Briefing

Sign up for the Nature Briefing newsletter — what matters in science, free to your inbox daily.

Get the most important science stories of the day, free in your inbox. Sign up for Nature Briefing