1 2%{ 3#include "dyna.h" 4#include "geneutil.h" 5 6 7 8%} 9 10 11struct GeneOutputData 12AlnBlock * alb; 13PackAln * pal; 14GenomicRegion * gr; 15Genomic * gen; 16CodonTable * ct; 17 18struct GeneOutputPara 19boolean show_genes !def="0" 20boolean show_gff !def="0" 21boolean show_trans !def="0" 22boolean show_cdna !def="0" 23boolean show_geneutr !def="0" 24boolean show_alb !def="0" 25boolean show_pal !def="0" 26boolean show_debug !def="0" 27char * divide_string 28 29 30 31%{ 32#include "geneoutput.h" 33 34 35void show_GeneOutput(GeneOutputData * data,GeneOutputPara * para,FILE * ofp) 36{ 37 Protein * trans; 38 cDNA * cdna; 39 int i; 40 41 assert(data); 42 assert(data->ct); 43 assert(data->gr); 44 assert(data->gen); 45 46 47 if( para->show_genes ) { 48 show_pretty_GenomicRegion(data->gr,0,ofp); 49 fprintf(stdout,"%s\n",para->divide_string); 50 } 51 52 if( para->show_gff ) { 53 show_GFF_GenomicRegion(data->gr,data->gen->baseseq->name,"genomwise",stdout); 54 fprintf(stdout,"%s\n",para->divide_string); 55 } 56 57 if( para->show_trans ) { 58 for(i=0;i<data->gr->len;i++) { 59 if( data->gr->gene[i]->ispseudo == TRUE ) { 60 fprintf(stdout,"#Gene %d is a pseudo gene - no translation possible\n",i); 61 } else { 62 trans = get_Protein_from_Translation(data->gr->gene[i]->transcript[0]->translation[0],data->ct); 63 write_fasta_Sequence(trans->baseseq,ofp); 64 } 65 } 66 fprintf(stdout,"%s\n",para->divide_string); 67 } 68 69 if( para->show_cdna ) { 70 for(i=0;i<data->gr->len;i++) { 71 cdna = get_cDNA_from_Transcript(data->gr->gene[i]->transcript[0]); 72 write_fasta_Sequence(cdna->baseseq,ofp); 73 } 74 fprintf(stdout,"%s\n",para->divide_string); 75 } 76 77 if( para->show_geneutr ) { 78 show_utr_exon_genomewise(data->alb,ofp); 79 fprintf(stdout,"%s\n",para->divide_string); 80 } 81 82 83 84} 85 86double id_map_func(int i) 87{ 88 return (double)i; 89} 90 91GeneOutputPara * new_GeneOutputPara_from_argv(int * argc,char ** argv) 92{ 93 GeneOutputPara * out; 94 95 out = GeneOutputPara_alloc(); 96 out->show_genes = 1; 97 out->show_trans = 1; 98 out->divide_string = stringalloc("//"); 99 100 strip_out_boolean_def_argument(argc,argv,"geneutr",&out->show_geneutr); 101 strip_out_boolean_def_argument(argc,argv,"genes",&out->show_genes); 102 strip_out_boolean_def_argument(argc,argv,"trans",&out->show_trans); 103 strip_out_boolean_def_argument(argc,argv,"gff",&out->show_gff); 104 strip_out_boolean_def_argument(argc,argv,"cdna",&out->show_cdna); 105 strip_out_boolean_def_argument(argc,argv,"genedebug",&out->show_debug); 106 107 return out; 108} 109 110 111void show_help_GeneOutputPara(FILE * ofp) 112{ 113 114 fprintf(ofp,"Gene Output\n"); 115 fprintf(ofp," -[no]genes show gene structure (default yes)\n"); 116 fprintf(ofp," -[no]geneutr show gene structure with utrs (default no)\n"); 117 fprintf(ofp," -[no]trans show protein translation (default yes)\n"); 118 fprintf(ofp," -[no]gff show gff (default no)\n"); 119 fprintf(ofp," -[no]genedebug show gene debug\n"); 120 121} 122 123 124 125 126 127