void RGHashTable :: SaveAll (RGFile& f) const { RGPersistent::SaveAll (f); f.Write (NumberOfLists); f.Write (NumberOfEntries); for (int i=0; i<NumberOfLists; i++) ListArray [i]->SaveAll (f); }
void RGHashTable :: RestoreAll (RGFile& f) { RGPersistent::RestoreAll (f); ClearAndDelete (); int TempNumberOfLists; f.Read (TempNumberOfLists); RGDList** TempArray; if (TempNumberOfLists < NumberOfLists) { TempArray = new RGDList* [TempNumberOfLists]; for (int i=0; i<NumberOfLists; i++) { if (i >= TempNumberOfLists) delete ListArray [i]; else TempArray [i] = ListArray [i]; } delete[] ListArray; ListArray = TempArray; NumberOfLists = TempNumberOfLists; } else if (TempNumberOfLists > NumberOfLists) { TempArray = new RGDList* [TempNumberOfLists]; for (int i=0; i<TempNumberOfLists; i++) { if (i < NumberOfLists) TempArray [i] = ListArray [i]; else TempArray [i] = new RGDList; } delete[] ListArray; ListArray = TempArray; NumberOfLists = TempNumberOfLists; } f.Read (NumberOfEntries); for (int i=0; i<NumberOfLists; i++) ListArray [i]->RestoreAll (f); }
void DataInterval :: SaveAll (RGFile& f) const { RGPersistent::SaveAll (f); f.Write (Left); f.Write (Right); f.Write (Center); f.Write (Mass); f.Write (Height); f.Write (Mode); f.Write (MaxAtMode); f.Write (FixedLeft); f.Write (FixedRight); }
void DataInterval :: RestoreAll (RGFile& f) { RGPersistent::RestoreAll (f); f.Read (Left); f.Read (Right); f.Read (Center); f.Read (Mass); f.Read (Height); f.Read (Mode); f.Read (MaxAtMode); f.Read (FixedLeft); f.Read (FixedRight); }
void NoiseInterval :: SaveAll (RGFile& f) const { RGPersistent::SaveAll (f); f.Write (Left); f.Write (Right); f.Write (Maximum); f.Write (Minimum); f.Write (Average); f.Write (NumberOfMaxima); f.Write (NumberOfMinima); f.Write (NumberOfSamples); f.Write (Norm2); }
void NoiseInterval :: RestoreAll (RGFile& f) { RGPersistent::RestoreAll (f); f.Read (Left); f.Read (Right); f.Read (Maximum); f.Read (Minimum); f.Read (Average); f.Read (NumberOfMaxima); f.Read (NumberOfMinima); f.Read (NumberOfSamples); f.Read (Norm2); }
int CopyVolumeFile (const RGString& inputFileName, const RGString& outputFileName) { RGFile inputFile (inputFileName, "rt"); if (!inputFile.isValid ()) { cout << "Could not read " << inputFileName.GetData () << " for default volume...exiting" << endl; return -1; } RGString inputFileString; inputFileString.ReadTextFile (inputFile); RGTextOutput outputFile (outputFileName, FALSE); if (!outputFile.FileIsValid ()) { cout << "Could not create " << outputFileName.GetData () << "...exiting" << endl; return -1; } outputFile << inputFileString; return 0; }
void STRBaseAllele :: SaveAll (RGFile& f) const { BaseAllele::SaveAll (f); f.Write (BP); }
void STRBaseAllele :: RestoreAll (RGFile& f) { BaseAllele::RestoreAll (f); f.Read (BP); }
bool GenotypesForAMarkerSet :: AddCollectionToTables (const RGString& xmlString, const RGString& offLadderTag, const RGString& triallelesTag, const RGString& posTriTag) { RGString XMLString (xmlString); RGString positiveControlString; RGString pControlsString; RGString fullPathControlFileName = GenotypesForAMarkerSet::PathToStandardControlFile + "/LadderSpecifications/StandardPositiveControls.xml"; RGFile* allPositiveControls = new RGFile (fullPathControlFileName, "rt"); if (!allPositiveControls->isValid ()) { cout << "Could not find positive controls file: " << (char*)fullPathControlFileName.GetData () << endl; return false; } RGString posXMLString; posXMLString.ReadTextFile (*allPositiveControls); delete allPositiveControls; RGXMLTagSearch nameSearch ("MarkerSetName", XMLString); RGXMLTagSearch positiveControlsSearch ("PositiveControls", posXMLString); RGXMLTagSearch oldPositiveControlsSearch ("PositiveControls", XMLString); RGXMLTagSearch posCtrlSearch ("PositiveControl", pControlsString); RGXMLTagSearch offLadderSearch (offLadderTag, XMLString); RGXMLTagSearch trialleleSearch (triallelesTag, XMLString); RGXMLTagSearch posTriSearch (posTriTag, XMLString); size_t startOffset = 0; size_t endOffset = 0; RGString collectionString; RGString offLadderString; RGString triString; RGString posTriString; size_t startPControls = 0; size_t endPControls = 0; bool returnValue = true; RGString markerSetName; IndividualGenotype* nextGenotype; if (!nameSearch.FindNextTag (startOffset, endOffset, markerSetName)) return false; if (mMarkerSetName.Length () == 0) mMarkerSetName = markerSetName; else if (mMarkerSetName != markerSetName) return false; startOffset = endOffset; size_t startOffsetPos = 0; size_t endOffsetPos = 0; RGString temp; if (oldPositiveControlsSearch.FindNextTag (startOffset, endOffset, temp)) startOffset = endOffset; if (positiveControlsSearch.FindNextTag (startOffsetPos, endOffsetPos, pControlsString)) { posCtrlSearch.ResetSearch (); // cout << "Found positive controls in file" << endl; while (posCtrlSearch.FindNextTag (startPControls, endPControls, positiveControlString)) { // cout << "Found positive control..." << endl; startPControls = endPControls; nextGenotype = new IndividualGenotype (positiveControlString); if (!nextGenotype->isValid ()) { returnValue = false; delete nextGenotype; } else { if (!mGenotypes.Contains (nextGenotype)) { mGenotypes.Insert (nextGenotype); // cout << "Inserted genotype in list..." << endl; } else { returnValue = false; delete nextGenotype; } } } } startOffset = endOffset; if (offLadderSearch.FindNextTag (startOffset, endOffset, offLadderString)) { if (mOffLadderAlleles == NULL) { mOffLadderAlleles = new LocusCollection (offLadderString); if (!mOffLadderAlleles->isValid ()) returnValue = false; } else { if (!mOffLadderAlleles->AddLoci (offLadderString)) returnValue = false; } } startOffset = endOffset; if (trialleleSearch.FindNextTag (startOffset, endOffset, triString)) { if (mSampleTriAlleles == NULL) { mSampleTriAlleles = new LocusCollection (triString); if (!mSampleTriAlleles->isValid ()) returnValue = false; } else { if (!mSampleTriAlleles->AddLoci (triString)) returnValue = false; } } startOffset = endOffset; if (posTriSearch.FindNextTag (startOffset, endOffset, posTriString)) { if (mControlTriAlleles == NULL) { mControlTriAlleles = new LocusCollection (posTriString); if (!mControlTriAlleles->isValid ()) returnValue = false; } else { if (!mControlTriAlleles->AddLoci (posTriString)) returnValue = false; } } return returnValue; }
void RGXmlSizeRestriction :: SaveAll (RGFile& f) const { RGXmlDataRestriction::SaveAll (f); f.Write (SizeLimit); }
void STRTracePrequalification :: SaveAll (RGFile& f) const { TracePrequalification::SaveAll (f); f.Write (WindowWidth); }
int _tmain(int argc, _TCHAR* argv[]) { MEMDIFF(x); int nRtn = 1; // char *ps = strdup("ABCDEFG - ignore this"); #ifdef _DEBUG if(!fsaFileInput::TESTMEMSTR()) { cerr << "function fsaFileInput::MEMSTR() failed test." << endl; } #endif if(argc < 3) { cerr << "Usage: " << argv[0] << " <infilename> <outfilename>" << endl; //Pause(); return 1; } fsaFileInput fsa(argv[1],true); // fsaFileIO fsa ("E:/Users/goorrob/My Documents/ABI Info/DataFileConverter/20030707BCOF_B02_2002-011420_016.fsa"); if(fsa.Error()) { cerr << "Cannot open " << argv[1] << endl; Pause(); return 2; } RGFile file (argv [2], "wt"); // RGFile file ("E:/Users/goorrob/My Documents/ABI Info/DataFileConverter/Test.xml"); if (!file.isValid ()) { cerr << "Output file name invalid" << endl; return 5; } if(fsa.Warning()) { cerr << "File has problems, continuing" << endl; } fsa.WriteXML (file); file.Flush (); file.Close (); if (argc > 3) { RGFile notify (argv [3], "a+t"); if (!notify.isValid ()) { cerr << "Cannot open " << argv [3] << " to notify about " << argv [2] << endl; return 6; } RGString Notification = " <xml>Wrote "; Notification += argv [2]; Notification += "</xml>"; Notification.WriteTextLine (notify); notify.Close (); } return 0; }
void STRBaseLocus :: RestoreAll (RGFile& f) { BaseLocus::RestoreAll (f); f.Read (MinimumBP); f.Read (MaximumBP); }
void RGXmlSizeRestriction :: RestoreAll (RGFile& f) { RGXmlDataRestriction::RestoreAll (f); f.Read (SizeLimit); }
void STRBaseLocus :: SaveAll (RGFile& f) const { BaseLocus::SaveAll (f); f.Write (MinimumBP); f.Write (MaximumBP); }
void STRTracePrequalification :: RestoreAll (RGFile& f) { TracePrequalification::RestoreAll (f); f.Read (WindowWidth); }