/* @source coderet application ** ** Retrieves CDS, mRNA and translations from feature tables ** ** @author Copyright (C) Alan Bleasby (ableasby@hgmp.mrc.ac.uk) ** Last modified by Jon Ison Thu Jun 29 08:26:08 BST 2006 ** @@ ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public License ** as published by the Free Software Foundation; either version 2 ** of the License, or (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ******************************************************************************/ #include "emboss.h" static void coderet_put_seq(const AjPSeq seq, const AjPStr strseq, ajint n, const char *name, ajint type, AjPSeqout seqout); static void coderet_put_rest(const AjPSeq seq, const AjPStr copyseq, const char* name, AjPSeqout seqout); /* @prog coderet ************************************************************** ** ** Extract CDS, mRNA and translations from feature tables ** ******************************************************************************/ int main(int argc, char **argv) { AjPSeqall seqall = NULL; AjPSeq seq = NULL; AjPSeqout seqoutcds = NULL; AjPSeqout seqoutmrna = NULL; AjPSeqout seqoutprot = NULL; AjPSeqout seqoutrest = NULL; AjPFile logf = NULL; ajint ncds = 0; ajint nmrna = 0; ajint nrest = 0; ajint nrestall = 0; ajint ntran = 0; ajint i =0; AjPStr cds = NULL; AjPStr mrna = NULL; AjPStr usa = NULL; AjPStr copyseq = NULL; AjBool ret = ajFalse; AjPStr *cdslines = NULL; AjPStr *mrnalines = NULL; AjPStr *tranlines = NULL; AjPStr *restlines = NULL; embInit("coderet",argc,argv); seqall = ajAcdGetSeqall("seqall"); seqoutcds = ajAcdGetSeqoutall("cdsoutseq"); seqoutmrna = ajAcdGetSeqoutall("mrnaoutseq"); seqoutrest = ajAcdGetSeqoutall("restoutseq"); seqoutprot = ajAcdGetSeqoutall("translationoutseq"); logf = ajAcdGetOutfile("outfile"); cds = ajStrNew(); mrna = ajStrNew(); usa = ajStrNew(); /* ** Must get this so that embedded references in the same database ** can be resolved */ ajStrAssignS(&usa,ajSeqallGetUsa(seqall)); if(seqoutcds) ajFmtPrintF(logf, " CDS"); if(seqoutmrna) ajFmtPrintF(logf, " mRNA"); if(seqoutrest) ajFmtPrintF(logf, " non-c"); if(seqoutprot) ajFmtPrintF(logf, " Trans"); ajFmtPrintF(logf, " Total Sequence\n"); if(seqoutcds) ajFmtPrintF(logf, " ====="); if(seqoutmrna) ajFmtPrintF(logf, " ====="); if(seqoutrest) ajFmtPrintF(logf, " ====="); if(seqoutprot) ajFmtPrintF(logf, " ====="); ajFmtPrintF(logf, " ===== ========\n"); while(ajSeqallNext(seqall,&seq)) { if(seqoutcds) { ncds = ajFeatGetLocs(seq->TextPtr, &cdslines, "CDS"); for(i=0;iTextPtr, &mrnalines, "mRNA"); for(i=0;iTextPtr, &restlines, "CDS"); for(i=0;iTextPtr, &restlines, "mRNA"); for(i=0;iTextPtr, &restlines, "exon"); for(i=0;iTextPtr, &tranlines); for(i=0;i