Пример #1
0
DycWarning * new_DycWarning_from_argstr(int * argc,char ** argv)
{
  DycWarning * out;
  boolean cwarn = TRUE;
  
  out = DycWarning_alloc();

  strip_out_boolean_def_argument(argc,argv,"cwarn",&cwarn);

  if( cwarn == TRUE ) {
    out->warn_extern = TRUE;
    out->warn_extern_method = TRUE;
    out->warn_c_type = TRUE;
  } else {
    out->warn_extern = FALSE;
    out->warn_c_type = FALSE;
    out->warn_extern_method = FALSE;
  }


  strip_out_boolean_def_argument(argc,argv,"extern",&out->warn_extern);
  strip_out_boolean_def_argument(argc,argv,"ctype",&out->warn_c_type);
  strip_out_boolean_def_argument(argc,argv,"methods",&out->warn_extern_method);
  
  return out;
}
int main(int argc,char ** argv)
{
  DnaMatchPara * para;
  HitListOutputImpl * hitoutput;
  HitList * hitlist;

  Sequence * reference;
  Sequence * swap;
  Sequence * trans;
  SequenceSet * amplimers;
  int show_hitlist = 0;
  int show_swapped = 1;

  hitoutput = new_HitListOutputImpl_from_argv(&argc,argv);
  para = new_DnaMatchPara_from_argv(&argc,argv);

  strip_out_boolean_def_argument(&argc,argv,"hitlist",&show_hitlist);
  strip_out_boolean_def_argument(&argc,argv,"swapped",&show_hitlist);

  strip_out_standard_options(&argc,argv,show_help,show_version);
  if( argc != 3 ) {
    show_help(stdout);
    exit(12);
  }

  reference = read_fasta_file_Sequence(argv[1]);
  amplimers = read_fasta_SequenceSet_file(argv[2]);

  hitlist = HitList_from_Sequence_SequenceSet_DNA(reference,amplimers,para);
  
  if( show_hitlist ) {
    show_HitList_HitListOutputImpl(hitoutput,hitlist,stdout);
  }

  swap  = swapped_Sequence(reference,hitlist);
  trans = translate_swapped(swap);


  if( show_swapped ) {
    write_fasta_Sequence(swap,stdout);
    write_fasta_Sequence(trans,stdout);
  }

}
Пример #3
0
DPImplementation * new_DPImplementation_from_argstr(int * argc,char ** argv)
{
  DPImplementation * out;
  char * temp;

  out = DPImplementation_alloc();
  
  if( (strip_out_boolean_argument(argc,argv,"pthreads")) == TRUE ) {
    out->do_threads = TRUE;
  }
  if( (temp=strip_out_assigned_argument(argc,argv,"dbtrace")) != NULL ) {
    if( is_integer_string(temp,&out->db_trace_level) == FALSE ) {
      warn("%s is not an integer argument for dbtrace",temp);
    }
  }

  if( strip_out_boolean_argument(argc,argv,"O") == TRUE ) {
    out->largemem= TRUE;
    /* other optimisations */
  }

  strip_out_boolean_def_argument(argc,argv,"largemem",&out->largemem);

  strip_out_boolean_def_argument(argc,argv,"onemodel",&out->doone);
    
  if( strip_out_boolean_argument(argc,argv,"prob") == TRUE ) {
    out->doprob = TRUE;
  }

  if( strip_out_boolean_argument(argc,argv,"g") == TRUE ) {
    out->dydebug = TRUE;
  }

  if( (temp=strip_out_assigned_argument(argc,argv,"logsum")) != NULL ) {
    out->calcfunc = stringalloc(temp);
  } else {
    out->calcfunc = stringalloc("Probability_logsum");
  }
  out->dycw = new_DycWarning_from_argstr(argc,argv);

  /*  fprintf(stderr,"And %d is extern warning",out->dycw->warn_extern);*/
  return out;
}
Пример #4
0
GeneModelParam * new_GeneModelParam_from_argv(int * argc,char ** argv)
{
  GeneModelParam * out;
  char * temp;

  out = std_GeneModelParam();
  
  if( (temp=strip_out_assigned_argument(argc,argv,"splice_min_collar")) != NULL ) {
    if( is_double_string(temp,&out->min_collar) == FALSE ) {
      warn("%s is not a floating point number. Can't be a splice_min_collar",temp);
      free_GeneModelParam(out);
      return NULL;
    } 
  }

  strip_out_boolean_def_argument(argc,argv,"splice_gtag",&out->use_gtag_splice);

  if( (temp=strip_out_assigned_argument(argc,argv,"splice_max_collar")) != NULL ) {
    if( is_double_string(temp,&out->max_collar) == FALSE ) {
      warn("%s is not a floating point number. Can't be a splice_max_collar",temp);
      free_GeneModelParam(out);
      return NULL;
    } 
  }

  if( (temp=strip_out_assigned_argument(argc,argv,"splice_score_offset")) != NULL ) {
    if( is_double_string(temp,&out->score_offset) == FALSE ) {
      warn("%s is not a floating point number. Can't be a splice_score_offset",temp);
      free_GeneModelParam(out);
      return NULL;
    } 
  }

  if( (temp=strip_out_assigned_argument(argc,argv,"genestats")) != NULL ) {
    if( out->gene_stats_file != NULL ) {
      ckfree(out->gene_stats_file);
    }

    out->gene_stats_file = stringalloc(temp);
  }

  if( (temp=strip_out_assigned_argument(argc,argv,"splice_gtag_prob")) != NULL ) {
    if( is_double_string(temp,&out->prob_for_gtag) == FALSE ) {
      warn("%s is not a floating pointer number. Can't be a probability for gtag",temp);
      free_GeneModelParam(out);
      return NULL;
    }
  }


  return out;

}
Пример #5
0
int main (int argc,char ** argv)
{
  EditString * q;
  EditString * t;

  PackAln * pal;
  AlnBlock * alb;

  int match = 1;
  int mismatch = -1;
  int gap = -1;

  boolean show_pretty = FALSE;

  DPRunImpl * dpri = NULL;
  StandardOutputOptions * std_opt = NULL;

  strip_out_boolean_def_argument(&argc,argv,"pretty",&show_pretty);


  dpri = new_DPRunImpl_from_argv(&argc,argv);
  std_opt = new_StandardOutputOptions_from_argv(&argc,argv);

  if( dpri == NULL ) {
    fatal("Unable to build DPRun implementation. Bad arguments");
  }

  if( argc != 3 ) {
    show_help(stdout);
    exit(12);
  }

  q = new_EditString(argv[1]);
  t = new_EditString(argv[2]);

  pal = PackAln_bestmemory_EditDistance(q,t,match,mismatch,gap,NULL,dpri);
  alb = convert_PackAln_to_AlnBlock_EditDistance(pal);

  fprintf(stdout,"Score %d\n",pal->score);
  if( show_pretty == TRUE ) {
    write_pretty_str_align(alb,"string1",q->string,"string2",t->string,12,60,stdout);
  }

  show_StandardOutputOptions(std_opt,alb,pal,"//",stdout);

  return 0;
}
Пример #6
0
HSP2HitListImpl * new_HSP2HitListImpl_from_argv(int * argc,char ** argv)
{
  HSP2HitListImpl * out;
  char * temp;

  out = malloc(sizeof(HSP2HitListImpl));
  out->type = HSP2HitList_Heuristic;

  if( (temp = strip_out_assigned_argument(argc,argv,"hspconvert")) != NULL ) {
    out->type = HSP2HitListType_string_convert(temp);
  }

  strip_out_boolean_def_argument(argc,argv,"hspthread",&out->threaded);

  out->no_threads = 4;
  strip_out_integer_argument(argc,argv,"hspthreadno",&out->no_threads);

  return out;

}
Пример #7
0
int main(int argc,char ** argv)
{
  Sequence   * gen;
  Genomic    * genomic;
  CodonTable * ct = NULL;
  GenomeEvidenceSet * ges = NULL;
  RandomCodonScore * rcs;
  FILE * ifp = NULL;
  ComplexSequence * cs = NULL;
  ComplexSequenceEvalSet * cses = NULL;
  AlnBlock * alb;
  PackAln * pal;
  GenomicRegion * gr;
  int i;
  Protein * trans;
  cDNA    * cdna;
  int kbyte                = 10000;
  int stop_codon_pen  = 200;
  int start_codon_pen = 30;
  int new_gene        = 5000;
  int switch_cost     = 100;
  int smell           = 8;
  DPRunImpl * dpri = NULL;
    
  EstEvidence * est;

  boolean show_trans = TRUE;
  boolean show_cdna  = FALSE;
  boolean show_genes = TRUE;
  boolean show_alb   = FALSE;
  boolean show_pal   = FALSE;
  boolean show_gff   = TRUE;
  boolean show_debug = FALSE;
  boolean show_geneu = TRUE;
  char * divide_string = "//";

  strip_out_boolean_def_argument(&argc,argv,"geneutr",&show_geneu);
  strip_out_boolean_def_argument(&argc,argv,"genes",&show_genes);
  strip_out_boolean_def_argument(&argc,argv,"trans",&show_trans);
  strip_out_boolean_def_argument(&argc,argv,"gff",&show_gff);
  strip_out_boolean_def_argument(&argc,argv,"alb",&show_alb);
  strip_out_boolean_def_argument(&argc,argv,"pal",&show_pal);
  strip_out_boolean_def_argument(&argc,argv,"debug",&show_debug);
  strip_out_boolean_def_argument(&argc,argv,"cdna",&show_cdna);
  strip_out_integer_argument(&argc,argv,"stop",&stop_codon_pen);
  strip_out_integer_argument(&argc,argv,"start",&start_codon_pen);
  strip_out_integer_argument(&argc,argv,"gene",&new_gene);
  strip_out_integer_argument(&argc,argv,"switch",&switch_cost);
  strip_out_integer_argument(&argc,argv,"smell",&smell);
  
  dpri = new_DPRunImpl_from_argv(&argc,argv);
  if( dpri == NULL ) {
    fatal("Unable to build DPRun implementation. Bad arguments");
  }


  strip_out_standard_options(&argc,argv,show_help,show_version);
  if( argc != 3 ) {
    show_help(stdout);
    exit(12);
  }

    

  ct  = read_CodonTable_file("codon.table");
  gen = read_fasta_file_Sequence(argv[1]);
  ifp = openfile(argv[2],"r");
  ges = read_est_evidence(ifp,ct);

  for(i=0;i<ges->len;i++) {
    est = (EstEvidence *) ges->geu[i]->data;
    est->in_smell = smell;
  }


  rcs= RandomCodonScore_alloc();
  for(i=0;i<125;i++) {
    if( is_stop_codon(i,ct) ) {
      rcs->codon[i] = -1000000;
    } else {
      rcs->codon[i] = 0;
    }
    /*    fprintf(stderr,"Got %d for %d\n",rcs->codon[i],i); */
  }

 

  cses = default_genomic_ComplexSequenceEvalSet();
  cs   = new_ComplexSequence(gen,cses);

 
  pal  = PackAln_bestmemory_GenomeWise9(ges,cs,-switch_cost,-new_gene,-start_codon_pen,-stop_codon_pen,rcs,NULL,dpri);
  alb  = convert_PackAln_to_AlnBlock_GenomeWise9(pal);


  genomic = Genomic_from_Sequence(gen);
  gr = new_GenomicRegion(genomic);

  add_Genes_to_GenomicRegion_GeneWise(gr,1,gen->len,alb,gen->name,0,NULL);

  if( show_genes ) {
    show_pretty_GenomicRegion(gr,0,stdout);
    fprintf(stdout,"%s\n",divide_string);
  }

  if( show_gff ) {
    show_GFF_GenomicRegion(gr,gen->name,"genomwise",stdout);
    fprintf(stdout,"%s\n",divide_string);
  }

  if( show_trans ) {
    for(i=0;i<gr->len;i++) {
      if( gr->gene[i]->ispseudo == TRUE ) {
	fprintf(stdout,"#Gene %d is a pseudo gene - no translation possible\n",i);
      } else {
	trans = get_Protein_from_Translation(gr->gene[i]->transcript[0]->translation[0],ct);
	write_fasta_Sequence(trans->baseseq,stdout);
      }
    } 
    fprintf(stdout,"%s\n",divide_string);
  }

  if( show_cdna ) {
    for(i=0;i<gr->len;i++) {
      cdna = get_cDNA_from_Transcript(gr->gene[i]->transcript[0]);
      write_fasta_Sequence(cdna->baseseq,stdout);
    } 
    fprintf(stdout,"%s\n",divide_string);
  }

  if( show_geneu ) {
    show_utr_exon_genomewise(alb,stdout);
    fprintf(stdout,"%s\n",divide_string);
  }

  if( show_alb ) {
    mapped_ascii_AlnBlock(alb,id,1,stdout);
    fprintf(stdout,"%s\n",divide_string);
  }

  if( show_debug ) {
    debug_genomewise(alb,ges,ct,gen,stdout);
    fprintf(stdout,"%s\n",divide_string);
  }
    
  if( show_pal ) {
    show_simple_PackAln(pal,stdout);
    fprintf(stdout,"%s\n",divide_string);
  }

  return 0;
}
Пример #8
0
int main (int argc,char ** argv)
{
  MappedCloneSet * trusted;
  MappedCloneSet * weak;
  MappedCloneMatch * match;


  FILE * in;
  int kbyte = 10000;
  PackAln  * pal;
  AlnBlock * alb;

  int spread = 30;

  boolean show_alb = 0;
  boolean show_pal = 0;
  boolean show_zip = 1;
  boolean show_path = 0;

  char * alg_string = "local";
  char * temp;
  char * divide_string = "//";

  strip_out_boolean_def_argument(&argc,argv,"alb",&show_alb);
  strip_out_boolean_def_argument(&argc,argv,"pal",&show_pal);
  strip_out_boolean_def_argument(&argc,argv,"zip",&show_zip);
  strip_out_boolean_def_argument(&argc,argv,"path",&show_path);

  strip_out_integer_argument(&argc,argv,"wgap",&query_gap_start);
  strip_out_integer_argument(&argc,argv,"wext",&query_gap_extend);
  strip_out_integer_argument(&argc,argv,"wswitch",&query_switch_cost);
  strip_out_integer_argument(&argc,argv,"tgap",&target_gap_start);
  strip_out_integer_argument(&argc,argv,"text",&target_gap_extend);
  strip_out_integer_argument(&argc,argv,"match",&match_score);
  strip_out_integer_argument(&argc,argv,"mismatch",&mismatch_score);
  temp =strip_out_assigned_argument(&argc,argv,"alg");
  if( temp != NULL ) {
    alg_string = temp;
  }

  strip_out_integer_argument(&argc,argv,"spread",&spread);
  strip_out_integer_argument(&argc,argv,"kbyte",&kbyte);

  strip_out_standard_options(&argc,argv,show_help,show_version);
  if( argc != 3 ) {
    show_help(stdout); 
    exit(12);
  }

  in = fopen(argv[1],"r");
  if( in == NULL ) {
    fatal("Unable to open %s",argv[1]);
  }
  trusted = read_MappedCloneSet(in);

  /*  fprintf(stderr,"first start %d\n",trusted->clone[0]->start);*/

  in = fopen(argv[2],"r");
  if( in == NULL ) {
    fatal("Unable to open %s",argv[2]);
  }

  change_max_BaseMatrix_kbytes(kbyte);

  weak = read_MappedCloneSet(in);

  synchronise_MappedCloneSets(trusted,weak);

  /*  fprintf(stderr,"score for 2,2 is %d\n",MappedCloneSet_match(weak,trusted,2,2,0,10,-5)); */
  
  match = new_MappedCloneMatch(weak,trusted,match_score,mismatch_score);

  fprintf(stderr,"Match matrix calculated\n");

  if( strcmp(alg_string,"global") == 0 ) {
    pal = PackAln_bestmemory_CloneWise(weak,trusted,match,-query_gap_start,-query_gap_extend,-target_gap_start,-target_gap_extend,spread,-query_switch_cost,NULL);
    alb = convert_PackAln_to_AlnBlock_CloneWise(pal);
  } else if ( strcmp(alg_string,"local") == 0 ) {
    pal = PackAln_bestmemory_LocalCloneWise(weak,trusted,match,-query_gap_start,-query_gap_extend,-target_gap_start,-target_gap_extend,spread,-query_switch_cost,NULL);
    alb = convert_PackAln_to_AlnBlock_LocalCloneWise(pal);
  } else {
    /* keep gcc happy */
    pal = NULL;
    alb = NULL;
    fatal("Not a proper algorithm string %s",alg_string);
  }

  if( show_path ) {
    extended_path(alb,weak,trusted,stdout);
    fprintf(stdout,"%s\n",divide_string);
  }

  if( show_zip ) {
    debug_zip(alb,weak,trusted,stdout);
    fprintf(stdout,"%s\n",divide_string);
  }

  if( show_alb ) {
    mapped_ascii_AlnBlock(alb,id,1,stdout);
    fprintf(stdout,"%s\n",divide_string);
  }

  if( show_pal ) {
    show_simple_PackAln(pal,stdout);
    fprintf(stdout,"%s\n",divide_string);
  }

  return 0;
}
Пример #9
0
int main(int argc,char ** argv)
{
  DPRunImpl * dpri = NULL;
  ScanWiseHSPImpl * scani = NULL;
  HSP2HitListImpl * hsp2hiti = NULL;
  HitListOutputImpl * hloi = NULL;
  ProteinIndexConstructor * pic = NULL;
 


  HSPScanInterface * hsi;
  HSPScanInterfacePara * para;
  SearchStatInterface * ssi;
  SearchStatInterface * ssl;
  SeqLookupLoadPara * slp;

  HSPset2HitPairPara * hsp2hit;
  CompMat * mat;
  SequenceDB * db;
  Sequence * seq;
  int ret;
  int i;
  int effective_db_size = 300000;
  int kk;
  
  int count = 0;

  LinearHSPmanager * lm;
  HitList * hl;

  boolean use_mott = 1;

  boolean trunc_best_hsp = 0;
  boolean verbose = 0;
  static struct rusage use;

  struct timeval t0, t1;

  gettimeofday(&t0, NULL);


  dpri      = new_DPRunImpl_from_argv(&argc,argv);

  dpri->memory = DPIM_Explicit;

  scani     = new_ScanWiseHSPImpl_from_argv(&argc,argv);
  
  hsp2hiti  = new_HSP2HitListImpl_from_argv(&argc,argv);

  hloi = new_HitListOutputImpl_from_argv(&argc,argv);

  slp = new_SeqLookupLoadPara_from_argv(&argc,argv);

  pic = new_ProteinIndexConstructor_from_argv(&argc,argv);

  hsp2hit = new_HSPset2HitPairPara_from_argv(&argc,argv);

  para = new_HSPScanInterfacePara_from_argv(&argc,argv);

  verbose = strip_out_boolean_argument(&argc,argv,"verbose") ;


  strip_out_boolean_def_argument(&argc,argv,"mott",&use_mott);

  strip_out_boolean_def_argument(&argc,argv,"besthsp",&trunc_best_hsp);

  strip_out_integer_argument(&argc,argv,"dbsize",&effective_db_size);

  

#ifdef SCAN_CORBA
  sorb = get_Wise2Corba_Singleton(&argc,argv,"orbit-local-orb");
#endif

  if( dpri == NULL ) {
    fatal("Unable to build DPRun implementation. Bad arguments");
  }

  strip_out_standard_options(&argc,argv,show_help,show_version);
  if( argc != 2 ) {
    show_help(stdout);
    exit(12);
  }

  /* ugly, but we don't want to bounce matrices around the network... */

  mat = read_Blast_file_CompMat("BLOSUM62.bla");
  
  erroroff(REPORT);

  hsi = new_HSPScanInterface_from_ScanWiseHSPImpl(scani,pic,slp);

  ssi = new_Mott_SearchStatInterface();

  ssl = new_lookup_SearchStatInterface(40,2.3);


  if( verbose ) {
    info("contacted database");
  }

  db = single_fasta_SequenceDB(argv[1]);

  if( db == NULL ) {
    fatal("Could not open sequence db...\n");
  }

  for(seq = init_SequenceDB(db,&ret); seq != NULL;seq = get_next_SequenceDB(db) ) {

	count++;

    for(i=0;i<seq->len;i++) {
      if( !isalpha(seq->seq[i]) ) {
	fatal("Sequence position %d [%c] is not valid",i,seq->seq[i]);
      }
      seq->seq[i] = toupper(seq->seq[i]);
    }

    info("Processing %s",seq->name);

    getrusage(RUSAGE_SELF,&use);
    
    /*    info("Before query %s %.3fu %.3fs\n", seq->name,
	 use.ru_utime.tv_sec + use.ru_utime.tv_usec*MICROSECOND,
	 use.ru_stime.tv_sec + use.ru_stime.tv_usec*MICROSECOND
	);
    */

    lm = (*hsi->scan_query)(hsi->data,seq,para);


    fprintf(stderr,"Got linear manager is %d entries\n",lm->len);

    if( lm->mat == NULL ) {
      lm->mat = hard_link_CompMat(mat);
    }

    getrusage(RUSAGE_SELF,&use);
    /*
    info("After query %s %.3fu %.3fs\n", seq->name,
	 use.ru_utime.tv_sec + use.ru_utime.tv_usec*MICROSECOND,
	 use.ru_stime.tv_sec + use.ru_stime.tv_usec*MICROSECOND
	);
    */
    sort_LinearHSPmanager(lm,compare_HSPset_score);


    if( trunc_best_hsp == 1 ) {
      for(kk=1;kk<lm->len;kk++) {
	free_HSPset(lm->set[kk]);
	lm->set[kk] = NULL;
      }
      lm->len = 1;
    }

    getrusage(RUSAGE_SELF,&use);
    
    /*
    info("After sort %s %.3fu %.3fs\n", seq->name,
	 use.ru_utime.tv_sec + use.ru_utime.tv_usec*MICROSECOND,
	 use.ru_stime.tv_sec + use.ru_stime.tv_usec*MICROSECOND
	);
    */
    hl   = HitList_from_HSP_HSP2HitListImpl(hsp2hiti,lm,dpri,hsp2hit);


    getrusage(RUSAGE_SELF,&use);
    /*
    info("After conversion %s %.3fu %.3fs\n", seq->name,
	 use.ru_utime.tv_sec + use.ru_utime.tv_usec*MICROSECOND,
	 use.ru_stime.tv_sec + use.ru_stime.tv_usec*MICROSECOND
	);
    */
    free_LinearHSPmanager(lm);

    if( use_mott == 1 ) {
      apply_SearchStat_to_HitList(hl,ssi,effective_db_size);
    } else {
      for(kk=0;kk<hl->len;kk++) {
	hl->pair[kk]->bit_score = hl->pair[kk]->raw_score / 2.0; 
      }
    }

    sort_HitList_by_score(hl);

    show_HitList_HitListOutputImpl(hloi,hl,stdout);

    getrusage(RUSAGE_SELF,&use);
    /*
    info("After output %s %.3fu %.3fs\n", seq->name,
	 use.ru_utime.tv_sec + use.ru_utime.tv_usec*MICROSECOND,
	 use.ru_stime.tv_sec + use.ru_stime.tv_usec*MICROSECOND
	);
    */

    free_HitList(hl);
    free_Sequence(seq);
  }
    

  free_DPRunImpl(dpri);
  free_HSPScanInterface(hsi);

  gettimeofday(&t1, NULL);
  fprintf(stderr, "[client stats] queries, time (s): %d %f\n",
                count,
		(t1.tv_sec - t0.tv_sec) +
                (t1.tv_usec - t0.tv_usec) * 1e-6);

  return 0;

}
Пример #10
0
ScanWiseHSPImpl * new_ScanWiseHSPImpl_from_argv(int * argc,char ** argv)
{
  ScanWiseHSPImpl * out;
  char * temp;

  out = malloc(sizeof(ScanWiseHSPImpl));
  out->use_corba = FALSE;
  out->use_mysql = FALSE;
  out->use_compress = FALSE;
  out->use_multiscan = FALSE;
  out->ior_file = NULL;
  out->direct_sequence = NULL;
  out->matrix_file = "BLOSUM62.bla";
  out->step = 32;
  out->host = "localhost";
  out->port = 4050;
  

  strip_out_boolean_def_argument(argc,argv,"corba",&out->use_corba);

  strip_out_boolean_def_argument(argc,argv,"mysql",&out->use_mysql);

  strip_out_boolean_def_argument(argc,argv,"wiseserver",&out->use_wiseserver);

  strip_out_boolean_def_argument(argc,argv,"compress",&out->use_compress);

  strip_out_boolean_def_argument(argc,argv,"multi",&out->use_multiscan);
  
  if( (temp = strip_out_assigned_argument(argc,argv,"iorfile")) != NULL ) {
    out->ior_file = temp;
  }

  if( (temp = strip_out_assigned_argument(argc,argv,"multiserver")) != NULL ) {
    out->multiscan_file = temp;
  }

  if( (temp = strip_out_assigned_argument(argc,argv,"scan_host")) != NULL ) {
    out->host = temp;
  }
  strip_out_integer_argument(argc,argv,"scan_port",&out->port);

  if( (temp = strip_out_assigned_argument(argc,argv,"scan_dbname")) != NULL ) {
    out->dbname = temp;
  }
  if( (temp = strip_out_assigned_argument(argc,argv,"scan_username")) != NULL ) {
    out->username = temp;
  }
  if( (temp = strip_out_assigned_argument(argc,argv,"scan_password")) != NULL ) {
    out->password = temp;
  }

  strip_out_integer_argument(argc,argv,"scan_step",&out->step);

  if( (temp = strip_out_assigned_argument(argc,argv,"seqdb")) != NULL ) {
    out->direct_sequence = temp;
  }

  if( (temp = strip_out_assigned_argument(argc,argv,"seqdbmat")) != NULL ) {
    out->matrix_file = temp;
  }


  return out;

}
Пример #11
0
int main(int argc,char ** argv)
{
  int i;
  SequenceSet * in;
  Sequence * trans;
  ThreeStateDB * tsd;

  DPRunImpl * dpri;
  CodonTable * ct;

  int return_status;
  ThreeStateModel * tsm;
  ThreeStateScore * tss;
  Protein * hmmp;
  ComplexSequence * cs;
  ComplexSequenceEvalSet * cses;

  PackAln * pal;
  AlnBlock * alb;

  int show_align = 0;
  int show_alb   = 0;
  int show_verbose = 1;
  int show_trans = 0;

  ct = read_CodonTable_file("codon.table");

  cses = default_aminoacid_ComplexSequenceEvalSet();
  
  dpri = new_DPRunImpl_from_argv(&argc,argv);

  strip_out_boolean_def_argument(&argc,argv,"pretty",&show_align);

  strip_out_boolean_def_argument(&argc,argv,"alb",&show_alb);

  strip_out_boolean_def_argument(&argc,argv,"trans",&show_trans);

  if( argc != 3 ) {
    show_help(stdout);
    exit(63);
  }


  in = read_fasta_SequenceSet_file(argv[1]);

  tsd = HMMer2_ThreeStateDB(argv[2]);

  assert(in);
  assert(tsd);
  assert(in->len == 2);

  trans = translate_Sequence(in->set[0],ct);

  if( show_trans ) {
    write_fasta_Sequence(trans,stdout);
  }

  cs = new_ComplexSequence(trans,cses);

  open_ThreeStateDB(tsd);

  while( (tsm = read_TSM_ThreeStateDB(tsd,&return_status)) != NULL ) {
    fold_RandomModel_into_ThreeStateModel(tsm,tsm->rm);
    set_startend_policy_ThreeStateModel(tsm,TSM_local,10,1.0);

    tss = ThreeStateScore_from_ThreeStateModel(tsm);
    hmmp = pseudo_Protein_from_ThreeStateModel(tsm);

    pal = PackAln_bestmemory_ThreeStateLoop(tss,cs,NULL,dpri);
    alb = convert_PackAln_to_AlnBlock_ThreeStateLoop(pal);

    if( show_alb ) {
      show_flat_AlnBlock(alb,stdout);
    }

    if( show_align ) {
      write_pretty_seq_align(alb,hmmp->baseseq,trans,15,50,stdout);      
    }
    if( show_verbose ) {
      show_verbose_evo(alb,tsm,in->set[0],in->set[1],ct,stdout);
    }
      
  }
  

}