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

📄 pssm_asn_subs.c

📁 序列对齐 Compare a protein sequence to a protein sequence database or a DNA sequence to a DNA sequenc
💻 C
📖 第 1 页 / 共 3 页
字号:
    }    else if ( ABP == ASN_IS_INT ) {      ABP_INC2;      ABPP = get_astr_int(asnp, &tmp) + 2;    }    else if ( ABP == ASN_IS_STR ) {      ABP_INC2;      ABPP = get_astr_str(asnp, string, sizeof(string)-1) + 2;    }  }  while (seq_cnt-- > 0) ABP_INC2;  return asnp->abp;}#define ASN_SEQINST_NCBIEAA 167#define ASN_SEQINST_NCBISTDAA 169unsigned char *get_astr_iseqd(struct asn_bstruct *asnp,	       unsigned char *query,	       int nq) {  int q_len, v_len;  asnp->abp = chk_asn_buf(asnp,2);  /* check for the sequence type - NCBIstdaa or NCBIstdeaa */  if (ABP == ASN_SEQINST_NCBIEAA) {    ABP_INC2;    return get_astr_str(asnp, (char *)query, nq) + 2;  }  else if (ABP == ASN_SEQINST_NCBISTDAA) {    ABP_INC2;    return get_astr_octstr(asnp, query, nq) + 2;  }  else {    return asn_error("get_astr_iseqd","",-1,asnp,4);  }}unsigned char *get_astr_objid(struct asn_bstruct *asnp, int *type, int *val, char *text, int t_len) {  int local_ival;  int v_len;  asnp->abp = chk_asn_buf(asnp,16);  if (text != NULL) text[0] = '\0';  if (val != NULL) *val = 0;  *type = 0;  /* object could be text, or could be int */  if (ABP == ASN_OBJ_INT) {    ABP_INC2;    asnp->abp = get_astr_int(asnp, &local_ival)+2;    if (val != NULL) *val = local_ival;    *type = 1;  }  else if (ABP == ASN_OBJ_STR) {    ABP_INC2;    asnp->abp = get_astr_str(asnp, text, t_len)+2;    *type = 2;  }  else {    return asn_error("get_astr_objid","ASN_OBJ_STR",ASN_OBJ_STR,asnp,4);  }  return asnp->abp;}#define ASN_BIOSEQ_SEQ 160#define ASN_BIOSEQ_ID  160#define ASN_BIOSEQ_ID_VAL 160#define ASN_BIOSEQ_ID_OBJ 160#define ASN_BIOSEQ_ID_LOCAL 161#define ASN_BIOSEQ_ID_GIBBSQ 162#define ASN_BIOSEQ_ID_GIBBMT 163#define ASN_BIOSEQ_ID_GB 164#define ASN_BIOSEQ_ID_EMBL 165#define ASN_BIOSEQ_ID_PIR 166#define ASN_BIOSEQ_ID_SP 167#define ASN_BIOSEQ_ID_PATENT 168#define ASN_BIOSEQ_ID_OTHER 169#define ASN_BIOSEQ_ID_GEN 170#define ASN_BIOSEQ_ID_GI 171#define ASN_BIOSEQ_ID_DDBJ 172#define ASN_BIOSEQ_ID_PDB 173#define ASN_BIOSEQ_ID_TPG 174#define ASN_BIOSEQ_ID_TPE 175#define ASN_BIOSEQ_ID_TPD 176#define ASN_BIOSEQ_TEXTID_NAME 160#define ASN_BIOSEQ_TEXTID_ACC 161#define ASN_BIOSEQ_TEXTID_REL 162#define ASN_BIOSEQ_TEXTID_VER 163#define ASN_BIOSEQ_DESCR  161#define ASN_BIOSEQ_INST  162#define ASN_BIOSEQ_D_NAME  163#define ASN_BIOSEQ_D_TITLE  164#define ASN_BIOSEQ_D_PIR  169#define ASN_BIOSEQ_D_GB   170#define ASN_BIOSEQ_D_USER 173#define ASN_BIOSEQ_D_SP 174#define ASN_BIOSEQ_INST_REPR  160#define ASN_BIOSEQ_INST_MOL  161#define ASN_BIOSEQ_INST_LEN  162#define ASN_BIOSEQ_INST_SEQD  166#define ASN_USERFLD_D_STR 160#define ASN_USERFLD_D_INT 161#define ASN_USERFLD_D_REAL 162#define ASN_USERFLD_D_BOOL 163#define ASN_USERFLD_D_OS 164#define ASN_USERFLD_D_USER 165#define ASN_USERFLD_D_STRS 166#define ASN_USERFLD_D_INTS 167#define ASN_USERFLD_D_REALS 168#define ASN_USERFLD_D_OSS 169#define ASN_USERFLD_D_FIELDS 170#define ASN_USERFLD_D_OBJS 171unsigned char *get_astr_userfld_data(struct asn_bstruct *asnp) {  double real;  int ival;  int bool;    ABPP = chk_asn_buf(asnp, 16);  switch (ABP) {  case ASN_USERFLD_D_STR :    ABP_INC2;    ABPP = get_astr_str(asnp, NULL, 0) + 2;    break;  case ASN_USERFLD_D_INT :    ABP_INC2;    ABPP = get_astr_int(asnp, &ival) + 2;    break;  case ASN_USERFLD_D_REAL :    ABP_INC2;    ABPP = get_astr_real(asnp, &real) + 2;    break;  case ASN_USERFLD_D_BOOL :    ABP_INC2;    ABPP = get_astr_bool(asnp, &bool) + 2;    break;  case ASN_USERFLD_D_OS :    ABP_INC2;    ABPP = get_astr_octstr(asnp, NULL, 0)+2;    break;  case ASN_USERFLD_D_OSS :    asnp->abp += 4;    ABPP = get_astr_octstr(asnp, NULL, 0)+4;    break;  default:     return asn_error("get_astr_userfld_data","",0,asnp,4);  }  return asnp->abp;}#define ASN_USERFLD_LABEL 160#define ASN_USERFLD_NUM 161#define ASN_USERFLD_DATA 162unsigned char *get_astr_userfld(struct asn_bstruct *asnp) {  char *func = "get_astr_userfld";  int num, type, in_seq=0;  asnp->abp = chk_asn_buf(asnp, 16);  if (ABP == ASN_SEQ) { in_seq = 1; ABP_INC2;}  if (ABP != ASN_USERFLD_LABEL) {    return asn_error(func, "ASN_USERFLD_LABEL", ASN_USERFLD_LABEL, asnp, 4);  }  else {    ABP_INC2;    asnp->abp = get_astr_objid(asnp, &type, NULL, NULL, 0)+2;  }    if (ABP == ASN_USERFLD_NUM) {    asnp->abp +=2;    asnp->abp = get_astr_int(asnp, &num)+2;  }  if (ABP != ASN_USERFLD_DATA) {    return asn_error(func, "ASN_USERFLD_DATA", ASN_USERFLD_DATA, asnp, 4);  }  else {    ABP_INC2;    asnp->abp = get_astr_userfld_data(asnp)+2;  }  if (in_seq) ABP_INC2;  return asnp->abp;}#define ASN_USER_CLASS 160#define ASN_USER_TYPE 161#define ASN_USER_DATA 162unsigned char *get_astr_user(struct asn_bstruct *asnp) {  int type;    char *func = "get_astr_user";  asnp->abp = chk_asn_buf(asnp,16);  ABP_INC2;	/* skip SEQ */  if (ABP == ASN_USER_CLASS) {    ABP_INC2;    asnp->abp = get_astr_str(asnp, NULL, 0) + 2;  }  if (ABP != ASN_USER_TYPE) {    return asn_error(func, "ASN_USER_TYPE", ASN_USER_TYPE, asnp, 4);  }  else {    ABP_INC2;    asnp->abp = get_astr_objid(asnp, &type, NULL, NULL, 0) + 2;  }  if (ABP != ASN_USER_DATA) {    return asn_error(func,"ASN_USER_DATA", ASN_USER_DATA, asnp, 4);  }  else {    asnp->abp += 4;	/* skip over, data, SEQ */    asnp->abp = chk_asn_buf(asnp,8);    asnp->abp = get_astr_userfld(asnp);    asnp->abp += 4;  }  return asnp->abp;}unsigned char *get_astr_seqdescr(struct asn_bstruct *asnp,		 char *descr) {  int end_seq=0;    /* get seqof '1' */  /* get 164/128 -  title */  /* get string */  /* pop nulls */  asnp->abp = chk_asn_buf(asnp,6);  if (ABP == ASN_SEQOF) {    end_seq++;    ABP_INC2;  }  else {    fprintf(stderr, " missing ASN_SEQOF '1': %0x %0x\n",ABP, asnp->abp[1]);  }  while (ABP != '\0') {    if (ABP == ASN_BIOSEQ_D_TITLE) {       ABP_INC2;	/* skip token */      asnp->abp = get_astr_str(asnp, descr, MAX_STR) + 2;    }    else if (ABP == ASN_BIOSEQ_D_USER) {      ABP_INC2;      asnp->abp = get_astr_user(asnp);    }    else {      fprintf(stderr, "Un-parsed Seq-descr: %x %x\n",asnp->abp[0],asnp->abp[1]);      return asnp->abp;    }  }  asnp->abp = chk_asn_buf(asnp,4);  if (end_seq) ABP_INC2;  return asnp->abp;}unsigned char *get_astr_seqinst(struct asn_bstruct *asnp,		unsigned char **query,		int *nq) {  int end_seq=0, tmp;  /* get sequence '0' */  /* get 160/128/10/len/val -  repr enum raw val */  /* get 161/128/10/len/val -  mol enum aa val */  /* get 162/128/02/len/val -  length int val */  /* get 166/128 - topology (empty) */  /* get 167/128 - seq-data */  /* get 65/len+128/len/octet_string */  /* pop nulls */  asnp->abp = chk_asn_buf(asnp,12);  if (ABP == ASN_SEQ) {    end_seq++;    ABP_INC2;  }  else {    fprintf(stderr, " missing ASN_SEQ '0': %0x %0x\n",ABP, asnp->abp[1]);  }  if (ABP == ASN_BIOSEQ_INST_REPR && *(asnp->abp+1) == 128) {    ABP_INC2;    asnp->abp = get_astr_enum(asnp, &tmp)+2;  }  else {    fprintf(stderr, " missing ASN_BIOSEQ_INST_REPR 160: %0x %0x\n",ABP, asnp->abp[1]);  }  if (ABP == ASN_BIOSEQ_INST_MOL && *(asnp->abp+1) == 128) {    ABP_INC2;    asnp->abp = get_astr_enum(asnp, &tmp)+2;  }  else {    fprintf(stderr, " missing ASN_BIOSEQ_INST_MOL 161: %0x %0x\n",ABP, asnp->abp[1]);  }  if (ABP == ASN_BIOSEQ_INST_LEN) {    ABP_INC2;    asnp->abp = get_astr_int(asnp, nq)+2;  }  else {    fprintf(stderr, " missing ASN_BIOSEQ_INST_LEN 161: %0x %0x\n",ABP, asnp->abp[1]);    return asnp->abp;  }  if ((*query = (unsigned char *)calloc(*nq + 1, sizeof(char)))==NULL) {    fprintf(stderr, " cannot read %d char query\n", *nq+1);  }  if (ABP == ASN_BIOSEQ_INST_SEQD) {    ABP_INC2;    asnp->abp = get_astr_iseqd(asnp, *query, *nq+1 ) + 2;  }  else {    fprintf(stderr, " missing ASN_BIOSEQ_INST_SEQD 166: %0x %0x\n",ABP, asnp->abp[1]);    return asnp->abp;  }  if (end_seq) ABP_INC2;  return asnp->abp;}unsigned char *get_astr_textid( struct asn_bstruct *asnp,		char *name,		char *acc) {  int end_seq = 0;  int ver;  char this_func[]="get_astr_textid";  chk_asn_buf(asnp,16);  if (ABP != ASN_SEQ) {    fprintf(stderr, " %s - Expected ASN_SEQ: %0x %0x\n",this_func,ABP, asnp->abp[1]);  }  else {ABP_INC2; end_seq++;}  name[0] = acc[0] = '\0';    if (ABP == ASN_BIOSEQ_TEXTID_NAME) {    ABP_INC2;    asnp->abp = get_astr_str(asnp, name, MAX_SSTR) + 2;  }  if (ABP == ASN_BIOSEQ_TEXTID_ACC) {    ABP_INC2;    asnp->abp = get_astr_str(asnp, acc, MAX_SSTR) + 2;  }  if (ABP == ASN_BIOSEQ_TEXTID_REL) {    ABP_INC2;    asnp->abp = get_astr_str(asnp, NULL, 0) + 2;  }  if (ABP == ASN_BIOSEQ_TEXTID_VER) {    ABP_INC2;    asnp->abp = get_astr_int(asnp, &ver)+2;  }  if (end_seq) ABP_INC2;  return asnp->abp;}unsigned char *get_astr_seqid (struct asn_bstruct *asnp,		int *gi,		char *name,		char *acc) {  int type, val;  *gi = 0;  acc[0] = '\0';  while (ABP != '\0') {    switch (ABP) {    case ASN_BIOSEQ_ID_OBJ:      ABP_INC2;      asnp->abp = get_astr_objid(asnp, &type, &val, name, MAX_SSTR) + 2;      break;    case ASN_BIOSEQ_ID_LOCAL:      ABP_INC2;      asnp->abp = get_astr_str(asnp, name, MAX_SSTR) + 2;      break;    case ASN_BIOSEQ_ID_GI:      ABP_INC2;      asnp->abp = get_astr_int(asnp, gi) + 2;      break;    case ASN_BIOSEQ_ID_GB:    case ASN_BIOSEQ_ID_EMBL:    case ASN_BIOSEQ_ID_PIR:    case ASN_BIOSEQ_ID_SP:    case ASN_BIOSEQ_ID_OTHER:      ABP_INC2;      asnp->abp = get_astr_textid(asnp, name, acc)  + 2;      break;    default:       return asn_error("get_atr_seqid", "", -1, asnp,4);    }  }  return asnp->abp;}/*Bioseq ::= SEQUENCE {    id SET OF Seq-id ,            -- equivalent identifiers    descr Seq-descr OPTIONAL , -- descriptors    inst Seq-inst }            -- the sequence data*/unsigned char *get_astr_bioseq(struct asn_bstruct *asnp,		int *gi,		char *name,		char *acc,		char *descr,		unsigned char **query,		int *nq		) {  int end_seq = 0;  asnp->abp = chk_asn_buf(asnp,32);  if (ABP == ASN_SEQ) {    end_seq++;    ABP_INC2;  }  if (ABP != ASN_BIOSEQ_ID) {    fprintf(stderr, "Bioseq - missing ID tag: %2x %2x\n",ABP, asnp->abp[1]);    return asnp->abp;  }  else {  /* skip over bioseq-id tag */    ABP_INC2;    if (ABP == ASN_SETOF) {	/* jump over ASN_SETOF */      ABP_INC2;      asnp->abp = get_astr_seqid(asnp, gi, name, acc);      ABP_INC2; 		/* close ASN_SETOF */    }    else {      return asn_error("get_astr_bioseq","ASN_SEQOF", ASN_SEQOF, asnp, 4);    }    ABP_INC2;	/* jump over seq-id tag end */  }

⌨️ 快捷键说明

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