⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 set_sequence.c

📁 C-package of "Long Short-Term Memory" for Protein classification
💻 C
字号:
/* * Code one Sequence *  * $Id: set_sequence.c 1272 2007-05-09 16:26:20Z mhe $ **/#include <stdio.h>#include <stdlib.h>#include "lstm.h"#include "set_sequence.h"/*   ALA ARG ASN ASP CYS GLN GLU GLY HIS ILE LEU LYS MET PHE PRO SER THR    TRP TYR VAL ASX X GLX*/ const static char aaChars[AAS] = {'A', 'R', 'N', 'D', 'C', 'Q', 'E', 'G', 'H', 'I', 'L', 'K', 'M', 'F', 'P', 'S', 'T', 'W', 'Y', 'V', 'B', 'Z', 'X'}; const static double aaVal[AAS] =    { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.5, 0.5, 0.0 };const static int aaIdx[AAS] =    {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22}; /* return position of given char in aaChars array */int getAACharPos(char aa) {        int i;    for (i = 0; i < AAS; i++) {        if (aaChars[i] == aa) {            return i;        }    }    if (aa == 'x' || aa == 'U') {        return 22;    }    printf("Error in sequencegeneration, unknown AA Symbol\n");    printf("AA Symbol:%c\n", aa);    exit(-1);    }/* generate a matrix of input vectors (windows) from a sequence */void set_sequence(double **inp, int **inp_idx, char **aaSym, int length, int prot_current) {    int i,j, starti, iter, aaCharPos;        for (i = 0; i < length; i++) {                        starti = i - wside;                        /* amino coding */            for (j = 0; j < windowsize; j++) {                iter = starti + j;                if (iter < 0 || iter >= length) {                    inp[i][j] = 0;                    inp_idx[i][j] = 0;                          }                else {                    aaCharPos = getAACharPos(aaSym[prot_current][iter]);                    inp[i][j] = aaVal[aaCharPos];                    inp_idx[i][j] = j * AAS + aaIdx[aaCharPos];                }            }            }    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -