/***************************************************************************** # Copyright (C) 1994-2008 by David Gordon. # All rights reserved. # # This software is part of a beta-test version of the Consed/Autofinish # package. It should not be redistributed or # used for any commercial purpose, including commercially funded # sequencing, without written permission from the author and the # University of Washington. # # This software is provided ``AS IS'' and any express or implied # warranties, including, but not limited to, the implied warranties of # merchantability and fitness for a particular purpose, are disclaimed. # In no event shall the authors or the University of Washington be # liable for any direct, indirect, incidental, special, exemplary, or # consequential damages (including, but not limited to, procurement of # substitute goods or services; loss of use, data, or profits; or # business interruption) however caused and on any theory of liability, # whether in contract, strict liability, or tort (including negligence # or otherwise) arising in any way out of the use of this software, even # if advised of the possibility of such damage. # # Building Consed from source is error prone and not simple which is # why I provide executables. Due to time limitations I cannot # provide any assistance in building Consed. Even if you do not # modify the source, you may introduce errors due to using a # different version of the compiler, a different version of motif, # different versions of other libraries than I used, etc. For this # reason, if you discover Consed bugs, I can only offer help with # those bugs if you first reproduce those bugs with an executable # provided by me--not an executable you have built. # # Modifying Consed is also difficult. Although Consed is modular, # some modules are used by many other modules. Thus making a change # in one place can have unforeseen effects on many other features. # It may takes months for you to notice these other side-effects # which may not seen connected at all. It is not feasable for me to # provide help with modifying Consed sources because of the # potentially huge amount of time involved. # #*****************************************************************************/ #include #include "consedParameters.h" #include "rwcstring.h" #include "rwcregexp.h" #include "mbt_exception.h" #include "fileDefines.h" #include "filGetUniqueFilename.h" void openAutoFinishOutputFiles( const RWCString& soAceFileToOpen, const FileName& soFilenamesFile ) { pCP->filAutoFinishFilenamesFile_ = soFilenamesFile; if ( pCP->filAutoFinishFilenamesFile_.isNull() ) { pCP->filAutoFinishFilenamesFile_ = "autofinish.fof"; } // find project name RWCString soProjectName = soAceFileToOpen; RWCRegexp regFasta("\\.fasta\\.screen\\..*$"); soProjectName( regFasta ) = ""; RWCString soUniquePrefix = filGetUniqueFilename( soProjectName ); pCP->filAutoFinishReversesSummary_ = soUniquePrefix + ".univReverses"; pCP->filAutoFinishForwardsSummary_ = soUniquePrefix + ".univForwards"; pCP->filAutoFinishCustomPrimersSummary_ = soUniquePrefix + ".customPrimers"; pCP->filAutoFinishSortedSummary_ = soUniquePrefix + ".sorted"; pCP->filAutoFinishFullOutput_ = soUniquePrefix + ".out"; pCP->filAutoFinishCustomNavigation_ = soUniquePrefix + ".nav"; pCP->filAutoFinishMinilibrariesSummary_ = soUniquePrefix + ".minilibraries"; pFORWARDS = fopen( (const char*) pCP->filAutoFinishForwardsSummary_, "w" ); if ( ! pFORWARDS ) { PANIC_OST( ost ) << "cannot open file: " << pCP->filAutoFinishForwardsSummary_ << ends; throw SysRequestFailed( ost.str() ); } pREVERSES = fopen( (const char*) pCP->filAutoFinishReversesSummary_, "w" ); if ( ! pREVERSES ) { PANIC_OST( ost ) << "cannot open file: " << pCP->filAutoFinishReversesSummary_ << ends; throw SysRequestFailed( ost.str() ); } pCUSTOM_PRIMERS = fopen( (const char*) pCP->filAutoFinishCustomPrimersSummary_, "w" ); if ( ! pCUSTOM_PRIMERS ) { PANIC_OST( ost ) << "cannot open file: " << pCP->filAutoFinishCustomPrimersSummary_ << ends; throw SysRequestFailed( ost.str() ); } pSORTED_SUMMARY = fopen( (const char*) pCP->filAutoFinishSortedSummary_, "w" ); if ( !pSORTED_SUMMARY ) { PANIC_OST( ost ) << "cannot open file: " << pCP->filAutoFinishSortedSummary_ << ends; throw SysRequestFailed( ost.str() ); } pAO = fopen( (const char*) pCP->filAutoFinishFullOutput_, "w" ); if ( ! pAO ) { PANIC_OST( ost ) << "cannot open file: " << pCP->filAutoFinishFullOutput_ << ends; throw SysRequestFailed( ost.str() ); } pCUSTOM_NAVIGATION = fopen( (const char*) pCP->filAutoFinishCustomNavigation_, "w" ); if ( !pCUSTOM_NAVIGATION ) { PANIC_OST( ost ) << "cannot open file: " << pCP->filAutoFinishCustomNavigation_ << ends; throw SysRequestFailed( ost.str() ); } if ( pCP->bAutoFinishPrintMinilibrariesSummaryFile_ ) { pMINILIBRARIES = fopen( (const char*) pCP->filAutoFinishMinilibrariesSummary_, "w" ); if ( !pMINILIBRARIES ) { PANIC_OST( ost ) << "cannot open file: " << pCP->filAutoFinishMinilibrariesSummary_ << ends; throw SysRequestFailed( ost.str() ); } } pFILE = pAO; pCP->pAutoFinishFilenamesFile_ = fopen( (const char*) pCP->filAutoFinishFilenamesFile_, "w" ); if ( ! pCP->pAutoFinishFilenamesFile_ ) { PANIC_OST( ost ) << "cannot open file: " << pCP->filAutoFinishFilenamesFile_ << ends; throw SysRequestFailed( ost.str() ); } fprintf( pCP->pAutoFinishFilenamesFile_, "%s\n", (const char*) pCP->filAutoFinishFullOutput_ ); fprintf( pCP->pAutoFinishFilenamesFile_, "%s\n", (const char*) pCP->filAutoFinishForwardsSummary_ ); fprintf( pCP->pAutoFinishFilenamesFile_, "%s\n", (const char*) pCP->filAutoFinishReversesSummary_ ); fprintf( pCP->pAutoFinishFilenamesFile_, "%s\n", (const char*) pCP->filAutoFinishCustomPrimersSummary_ ); fprintf( pCP->pAutoFinishFilenamesFile_, "%s\n", (const char*) pCP->filAutoFinishSortedSummary_ ); if ( pCP->bAutoFinishPrintMinilibrariesSummaryFile_ ) { fprintf( pCP->pAutoFinishFilenamesFile_, "%s\n", (const char*) pCP->filAutoFinishMinilibrariesSummary_ ); } fclose( pCP->pAutoFinishFilenamesFile_ ); }