main() { int i; Sequence * out; RandomModel * rm; RandomProteinDB * rdp; RandomDNADB * rddp; RandomModelDNA * rmd; rm = default_RandomModel(); rmd = RandomModelDNA_std(); rdp = new_flat_RandomProteinDB(rm,50); for(i=0;i<5;i++) { out = Sequence_from_RandomProteinDB(rdp); write_fasta_Sequence(out,stdout); free_Sequence(out); } rddp = new_flat_RandomDNADB(rmd,50); for(i=0;i<5;i++) { out = Sequence_from_RandomDNADB(rddp); write_fasta_Sequence(out,stdout); free_Sequence(out); } }
void write_fasta_PhasedProtein(PhasedProtein * pp,FILE * ofp) { int i; int j; int line; assert(pp != NULL); write_fasta_Sequence(pp->protein,ofp); fprintf(ofp,">%s\n",pp->protein->name); for(i=0,j=0,line = 0;i<pp->protein->len;i++) { if( line != 0 && line % 50 == 0 ) { fputc('\n',ofp); } fputc(pp->protein->seq[i],ofp); line++; if( j < pp->list->len && pp->list->intron[j]->position == i ) { fputc('0'+pp->list->intron[j]->phase,ofp); line++; j++; } } }
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); } }
int main(int argc,char ** argv) { Sequence * in; Sequence * rev; while( in = read_fasta_Sequence(stdin) ) { in->type = SEQUENCE_DNA; rev = reverse_complement_Sequence(in); write_fasta_Sequence(rev,stdout); free_Sequence(in); free_Sequence(rev); } }
int main(int argc,char ** argv) { char buffer[MAXLINE]; Sequence * in; DnaNumberSequence * dns; LinkNumberArray * lna; LinkNumberArrayDebug lnad; int i; lnad.placement_stream = 10; lnad.add_stream = 10; lnad.extraction = 10; lnad.ofp = stderr; lna = new_LinkNumberArray(11); while( (in = read_fasta_Sequence(stdin)) != NULL ) { dns = new_DnaNumberSequence(in,11); if( is_new_stream_LinkNumberArray(lna,&lnad,dns) == TRUE ) { write_new_LinkStream(lna,&lnad,dns); } else { write_existing_LinkStream(lna,&lnad,dns); } } for(i=0;i<lna->array_len;i++) { if( lna->array[i] != NULL && (lna->array[i]->stream[0]->a == NULL || lna->array[i]->stream[0]->b == NULL) && lna->array[i]->stream[0]->have_seen == 0 ) { in = extract_dna_LinkStream(lna->array[i]->stream[0],&lnad,lna->nmer_size); sprintf(buffer,"Sequence_%d",i); in->name = stringalloc(buffer); write_fasta_Sequence(in,stdout); } } }
boolean show_output(void) { int i; cDNA * cdna; Protein * trans; GenomicOverlapResults * gor; AlnColumn * alt; if( show_pretty == TRUE ) { show_pretty_aln(); } if( show_match_sum == TRUE ) { show_MatchSummary_genewise_header(ofp); show_MatchSummarySet_genewise(mss,ofp); fprintf(ofp,"%s\n",divide_str); } if( show_pretty_gene == TRUE ) { show_pretty_GenomicRegion(gr,0,ofp); fprintf(ofp,"%s\n",divide_str); } if( show_supp_gene == TRUE ) { show_pretty_GenomicRegion(gr,1,ofp); fprintf(ofp,"%s\n",divide_str); } if( show_embl == TRUE ) { write_Embl_FT_GenomicRegion(gr,ofp); fprintf(ofp,"%s\n",divide_str); } if( show_diana == TRUE ) { write_Diana_FT_GenomicRegion(gr,ofp); fprintf(ofp,"%s\n",divide_str); } if( show_overlap == TRUE ) { gor = Genomic_overlap(gr,embl); show_GenomicOverlapResults(gor,ofp); fprintf(ofp,"%s\n",divide_str); } if( show_trans == TRUE ) { for(i=0;i<gr->len;i++) { if( gr->gene[i]->ispseudo == TRUE ) { fprintf(ofp,"#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,ofp); } } fprintf(ofp,"%s\n",divide_str); } if( show_pep == TRUE ) { alt = alb->start; for(;alt != NULL;) { trans = Protein_from_GeneWise_AlnColumn(gen->baseseq,alt,1,&alt,ct,is_random_AlnColumn_genewise); if ( trans == NULL ) break; write_fasta_Sequence(trans->baseseq,ofp); free_Protein(trans); } fprintf(ofp,"%s\n",divide_str); } if( show_cdna == TRUE ) { for(i=0;i<gr->len;i++) { cdna = get_cDNA_from_Transcript(gr->gene[i]->transcript[0]); write_fasta_Sequence(cdna->baseseq,ofp); } fprintf(ofp,"%s\n",divide_str); } if( show_ace == TRUE ) { show_ace_GenomicRegion(gr,gen->baseseq->name,ofp); fprintf(ofp,"%s\n",divide_str); } if( show_gff == TRUE ) { show_GFF_GenomicRegion(gr,gen->baseseq->name,"GeneWise",ofp); fprintf(ofp,"%s\n",divide_str); } if( show_gene_plain == TRUE ) { show_GenomicRegion(gr,ofp); fprintf(ofp,"%s\n",divide_str); } if( show_AlnBlock == TRUE ) { mapped_ascii_AlnBlock(alb,Score2Bits,0,ofp); fprintf(ofp,"%s\n",divide_str); } if( show_cumlative_PackAln == TRUE ) { show_bits_and_cumlative_PackAln(pal,ofp); fprintf(ofp,"%s\n",divide_str); } if( show_PackAln == TRUE ) { show_simple_PackAln(pal,ofp); fprintf(ofp,"%s\n",divide_str); } return TRUE; }
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; }
boolean show_output(void) { int i,k; ThreeStateModel * temptsm; AlnBlock * alb; PackAln * pal; MatchSummarySet * mss; Protein * ps; cDNA * cdna; double bits; boolean fitted_res = FALSE; AlnBlockList * alist; AlnBlock * anchored; SequenceSet * set; AlnColumn * alt; Protein * trans; /* sort by bit score first */ sort_Hscore_by_score(hs); if( search_mode == PC_SEARCH_S2DB ) { if( hs->his == NULL || hs->his->total < 1000 ) { info("Cannot fit histogram to a db smaller than 1,000"); fprintf(ofp,"[Warning: Can't fit histogram to a db smaller than 1,000]\n\n"); show_histogram = FALSE; } else { fitted_res = TRUE; fit_Hscore_to_EVD(hs,20); } } /* deal with initialising anchored alignment. * Could be done for either single HMMs or single proteins, * but we will only do it for HMMs at the moment */ if( make_anchored_aln == TRUE ) { if( tsm == NULL ) { warn("Attempting to make an achored alignment without a HMM. impossible!"); make_anchored_aln = FALSE; } else { anchored = single_unit_AlnBlock(tsm->len,"MATCH_STATE"); set = SequenceSet_alloc_std(); } } /* dofus catcher */ if( aln_alg != alg ) { fprintf(ofp,"\n#\n#WARNING!\n#\n# Your alignment algorithm is different from your search algorithm.\n# This is probably quite sensible but will lead to differing scores.\n# Use the search score as an indicator of the significance of the match\n# Read the docs for more information\n#\n"); } fprintf(ofp,"\n\n#High Score list\n"); fprintf(ofp,"#Protein ID DNA Str ID Bits Evalue\n"); fprintf(ofp,"--------------------------------------------------------------------------\n"); for(i=0;i<hs->len;i++) { bits = Score2Bits(hs->ds[i]->score); if( bits < search_cutoff ) { break; } if( fitted_res == TRUE && evalue_search_str != NULL ) { if( hs->ds[i]->evalue > evalue_search_cutoff ) break; } if( fitted_res == TRUE) fprintf(ofp,"Protein %-20sDNA [%c] %-24s %.2f %.2g\n",hs->ds[i]->query->name,hs->ds[i]->target->is_reversed == TRUE ? '-' : '+',hs->ds[i]->target->name,bits,hs->ds[i]->evalue); else fprintf(ofp,"Protein %-20sDNA [%c] %-24s %.2f\n",hs->ds[i]->query->name,hs->ds[i]->target->is_reversed == TRUE ? '-' : '+',hs->ds[i]->target->name,bits); } if( search_mode == PC_SEARCH_S2DB && show_histogram == TRUE ) { fprintf(ofp,"\n\n#Histogram\n"); fprintf(ofp,"-----------------------------------------------------------------------\n"); PrintASCIIHistogram(hs->his,ofp); } fprintf(ofp,"\n\n#Alignments\n"); fprintf(ofp,"-----------------------------------------------------------------------\n"); for(i=0;i<hs->len;i++) { bits = Score2Bits(hs->ds[i]->score); if( bits < search_cutoff ) { break; } if( i >= aln_number ) { break; } if( fitted_res == TRUE && evalue_search_str != NULL ) { if( hs->ds[i]->evalue > evalue_search_cutoff ) break; } fprintf(ofp,"\n\n>Results for %s vs %s (%s) [%d]\n",hs->ds[i]->query->name,hs->ds[i]->target->name,hs->ds[i]->target->is_reversed == TRUE ? "reverse" : "forward",i+1 ); cdna = get_cDNA_from_cDNADB(cdb,hs->ds[i]->target); temptsm = indexed_ThreeStateModel_ThreeStateDB(tsmdb,hs->ds[i]->query); alb = AlnBlock_from_TSM_estwise_wrap(temptsm,cdna,cps,cm,ct,rmd,aln_alg,use_syn,allN,flat_insert,dpri,&pal); if( alb == NULL ) { warn("Got a NULL alignment. Exiting now due to presumed problems"); fprintf(ofp,"\n\n*Got a NULL alignment. Exiting now due to presumed problems*\n\n"); return FALSE; } if( use_single_pro == FALSE) mss = MatchSummarySet_from_AlnBlock_genewise(alb,temptsm->name,1,cdna->baseseq); else mss = MatchSummarySet_from_AlnBlock_genewise(alb,pro->baseseq->name,pro->baseseq->offset,cdna->baseseq); if( show_pretty == TRUE ) { fprintf(ofp,"\n%s output\nScore %4.2f bits over entire alignment.\nThis will be different from per-alignment scores. See manual for details\nFor computer parsable output, try %s -help or read the manual\n",program_name,Score2Bits(pal->score),program_name); if( use_syn == FALSE ) { fprintf(ofp,"Scores as bits over a flat simple random model\n\n"); } else { fprintf(ofp,"Scores as bits over a synchronous coding model\n\n"); } ps = pseudo_Protein_from_ThreeStateModel(temptsm); protcdna_ascii_display(alb,ps->baseseq->seq,ps->baseseq->name,ps->baseseq->offset,cdna,ct,15,main_block,TRUE,ofp); free_Protein(ps); fprintf(ofp,"%s\n",divide_str); } if( show_match_sum == TRUE ) { show_MatchSummary_genewise_header(ofp); show_MatchSummarySet_genewise(mss,ofp); fprintf(ofp,"%s\n",divide_str); } if( show_pep == TRUE ) { alt = alb->start; for(;alt != NULL;) { trans = Protein_from_GeneWise_AlnColumn(cdna->baseseq,alt,1,&alt,ct,is_random_AlnColumn_genewise); if ( trans == NULL ) break; write_fasta_Sequence(trans->baseseq,ofp); free_Protein(trans); } fprintf(ofp,"%s\n",divide_str); } if( show_AlnBlock == TRUE ) { mapped_ascii_AlnBlock(alb,Score2Bits,0,ofp); fprintf(ofp,"%s\n",divide_str); } if( show_PackAln == TRUE ) { show_simple_PackAln(pal,ofp); fprintf(ofp,"%s\n",divide_str); } /* * This goes at the end because it destroys the alb structure */ if( make_anchored_aln == TRUE ) { /* attach sequence to als in alb, so we have it for later use */ alb->seq[1]->data = (void *) cdna->baseseq; /* add to SequenceSet so we can destroy the memory */ add_SequenceSet(set,hard_link_Sequence(cdna->baseseq)); alist = split_AlnBlock(alb,is_random_AlnColumn_genewise); for(k=0;k<alist->len;k++) { /* actually produce the anchored alignment */ /*mapped_ascii_AlnBlock(alist->alb[k],Score2Bits,stderr);*/ add_to_anchored_AlnBlock(anchored,alist->alb[k]); /* dump_ascii_AlnBlock(anchored,stderr);*/ } } alb = free_AlnBlock(alb); pal = free_PackAln(pal); mss = free_MatchSummarySet(mss); cdna = free_cDNA(cdna); temptsm = free_ThreeStateModel(temptsm); } if( do_complete_analysis == TRUE ) { fprintf(ofp,"\n\n#Complete Analysis\n"); fprintf(ofp,"-------------------------------------------------------------\n\n"); /* ok - end of loop over relevant hits. If we have an * anchored alignment, print it out! */ if( make_anchored_aln == TRUE ) { /*dump_ascii_AlnBlock(anchored,stderr);*/ write_mul_estwise_AlnBlock(anchored,ct,ofp); fprintf(ofp,"%s\n",divide_str); } } return TRUE; }
int main(int argc,char ** argv) { int i; DPRunImpl * dpri = NULL; GeneModelParam * gmp = NULL; GeneModel * gm = NULL; Sequence * seq; RandomCodon * rc; RandomModelDNA * rmd; RandomCodonScore * rcs; ComplexSequenceEval * splice5; ComplexSequenceEval * splice3; ComplexSequenceEvalSet * cses; ComplexSequence * cseq; SyExonScore * exonscore; PackAln * pal; AlnBlock * alb; Genomic * genomic; GenomicRegion * gr; Protein * trans; dpri = new_DPRunImpl_from_argv(&argc,argv); if( dpri == NULL ) { fatal("Unable to build DPRun implementation. Bad arguments"); } gmp = new_GeneModelParam_from_argv(&argc,argv); ct= read_CodonTable_file("codon.table"); strip_out_standard_options(&argc,argv,show_help,show_version); if( argc != 2 ) { show_help(stdout); exit(12); } if((gm=GeneModel_from_GeneModelParam(gmp)) == NULL ) { fatal("Could not build gene model"); } seq = read_fasta_file_Sequence(argv[1]); assert(seq); cses = new_ComplexSequenceEvalSet_from_GeneModel(gm); cseq = new_ComplexSequence(seq,cses); rc = flat_RandomCodon(ct); rmd = RandomModelDNA_std(); fold_in_RandomModelDNA_into_RandomCodon(rc,rmd); rcs = RandomCodonScore_from_RandomCodon(rc); exonscore = SyExonScore_flat_model(200,250,0.1,0.1); /* for(i=0;i<cseq->length;i++) { fprintf(stdout,"%d PairSeq is %d score %d\n",i,CSEQ_PAIR_PAIRBASE(cseq,i),nonc_score->base[CSEQ_PAIR_PAIRBASE(cseq,i)]); } exit(0); */ /* show_RandomCodonScore(rcs,stdout); for(i=3;i<seq->len;i++) { fprintf(stdout,"seq %d is %c with score %d\n",i,aminoacid_from_seq(ct,seq->seq+i-2),rcs->codon[CSEQ_GENOMIC_CODON(cseq,i)]); } exit(0); */ pal = PackAln_bestmemory_StatWise10(exonscore,cseq,rcs,Probability2Score(1.0/10.0),Probability2Score(1.0/10.0),NULL,dpri); alb = convert_PackAln_to_AlnBlock_StatWise10(pal); mapped_ascii_AlnBlock(alb,id,1,stdout); genomic = Genomic_from_Sequence(seq); gr = new_GenomicRegion(genomic); add_Genes_to_GenomicRegion_GeneWise(gr,1,seq->len,alb,"bollocks",0,NULL); 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); } } return 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); } } }
int main(int argc,char ** argv) { Sequence * cdna; Sequence * gen; Sequence * active_gen; Sequence * active_cdna; int i; int dstart = -1; int dend = -1; int cstart = -1; int cend = -1; CodonTable * ct = NULL; CodonMatrixScore * cm = NULL; RandomCodon * rndcodon = NULL; RandomCodonScore * rndcodonscore = NULL; DnaMatrix * dm = NULL; DPRunImpl * dpri = NULL; GeneModel * gm; GeneModelParam * gmp; GeneStats * gs; GeneParser21 * gp21; GeneParser21Score * gp21s; GeneParser4Score * gp; ComplexSequenceEvalSet * cdna_cses; ComplexSequenceEvalSet * gen_cses; ComplexSequence * cs_cdna; ComplexSequence * cs_gen; Genomic * gent; GenomicRegion * gr; CompMat * cmat; CompProb * cprob; char * matfile = "blosum62.bla"; Protein * trans; PackAln * pal; AlnBlock * alb; FILE * ofp = stdout; dpri = new_DPRunImpl_from_argv(&argc,argv); gmp = new_GeneModelParam_from_argv(&argc,argv); strip_out_integer_argument(&argc,argv,"u",&dstart); strip_out_integer_argument(&argc,argv,"v",&dend); strip_out_integer_argument(&argc,argv,"s",&cstart); strip_out_integer_argument(&argc,argv,"t",&cend); strip_out_standard_options(&argc,argv,show_help,show_version); ct = read_CodonTable_file(codon_file); cmat = read_Blast_file_CompMat(matfile); cprob = CompProb_from_halfbit(cmat); cm = naive_CodonMatrixScore_from_prob(ct,cprob); gm = GeneModel_from_GeneModelParam(gmp); cdna = read_fasta_file_Sequence(argv[1]); gen = read_fasta_file_Sequence(argv[2]); if( dstart != -1 || dend != -1 ) { if( dstart == -1 ) { dstart = 1; } if( dend == -1 ) { dend = gen->len; } active_gen = magic_trunc_Sequence(gen,dstart,dend); } else { active_gen = hard_link_Sequence(gen); } if( cstart != -1 || cend != -1 ) { if( cstart == -1 ) { cstart = 1; } if( cend == -1 ) { cend = gen->len; } active_cdna = magic_trunc_Sequence(gen,cstart,cend); } else { active_cdna = hard_link_Sequence(gen); } rndcodon = RandomCodon_from_raw_CodonFrequency(gm->codon,ct); fold_in_RandomModelDNA_into_RandomCodon(rndcodon,gm->rnd); rndcodonscore = RandomCodonScore_from_RandomCodon(rndcodon); assert(active_cdna); assert(active_gen); cdna_cses = default_cDNA_ComplexSequenceEvalSet(); gen_cses = new_ComplexSequenceEvalSet_from_GeneModel(gm); cs_cdna = new_ComplexSequence(active_cdna,cdna_cses); cs_gen = new_ComplexSequence(active_gen,gen_cses); gp21 = std_GeneParser21(); GeneParser21_fold_in_RandomModelDNA(gp21,gm->rnd); gp21s = GeneParser21Score_from_GeneParser21(gp21); gp = GeneParser4Score_from_GeneParser21Score(gp21s); dm = identity_DnaMatrix(Probability2Score(halfbit2Probability(1)),Probability2Score(halfbit2Probability(-1))); assert(cs_cdna); assert(cs_gen); assert(gp); assert(rndcodonscore); assert(dm); assert(dpri); /* show_CodonMatrixScore(cm,ct,ofp);*/ pal = PackAln_bestmemory_CdnaWise10(cs_cdna,cs_gen,gp,cm,rndcodonscore,dm, Probability2Score(halfbit2Probability(-12)), Probability2Score(halfbit2Probability(-2)), Probability2Score(halfbit2Probability(-5)), Probability2Score(halfbit2Probability(0)), NULL, dpri); alb = convert_PackAln_to_AlnBlock_CdnaWise10(pal); gent = Genomic_from_Sequence(gen); assert(gent); gr = new_GenomicRegion(gent); assert(gr); add_Genes_to_GenomicRegion_GeneWise(gr,active_gen->offset,active_gen->end,alb,cdna->name,0,NULL); mapped_ascii_AlnBlock(alb,Score2Bits,0,ofp); show_pretty_GenomicRegion(gr,0,ofp); for(i=0;i<gr->len;i++) { if( gr->gene[i]->ispseudo == TRUE ) { fprintf(ofp,"#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,ofp); } } }