MayaChemTools

   1 #!/usr/bin/perl -w
   2 #
   3 # File: AtomTypesFingerprints.pl
   4 # Author: Manish Sud <msud@san.rr.com>
   5 #
   6 # Copyright (C) 2019 Manish Sud. All rights reserved.
   7 #
   8 # This file is part of MayaChemTools.
   9 #
  10 # MayaChemTools is free software; you can redistribute it and/or modify it under
  11 # the terms of the GNU Lesser General Public License as published by the Free
  12 # Software Foundation; either version 3 of the License, or (at your option) any
  13 # later version.
  14 #
  15 # MayaChemTools is distributed in the hope that it will be useful, but without
  16 # any warranty; without even the implied warranty of merchantability of fitness
  17 # for a particular purpose.  See the GNU Lesser General Public License for more
  18 # details.
  19 #
  20 # You should have received a copy of the GNU Lesser General Public License
  21 # along with MayaChemTools; if not, see <http://www.gnu.org/licenses/> or
  22 # write to the Free Software Foundation Inc., 59 Temple Place, Suite 330,
  23 # Boston, MA, 02111-1307, USA.
  24 #
  25 
  26 use strict;
  27 use FindBin; use lib "$FindBin::Bin/../lib";
  28 use Getopt::Long;
  29 use File::Basename;
  30 use Text::ParseWords;
  31 use Benchmark;
  32 use FileUtil;
  33 use TextUtil;
  34 use SDFileUtil;
  35 use MoleculeFileIO;
  36 use FileIO::FingerprintsSDFileIO;
  37 use FileIO::FingerprintsTextFileIO;
  38 use FileIO::FingerprintsFPFileIO;
  39 use AtomTypes::AtomicInvariantsAtomTypes;
  40 use AtomTypes::FunctionalClassAtomTypes;
  41 use Fingerprints::AtomTypesFingerprints;
  42 
  43 my($ScriptName, %Options, $StartTime, $EndTime, $TotalTime);
  44 
  45 # Autoflush STDOUT
  46 $| = 1;
  47 
  48 # Starting message...
  49 $ScriptName = basename($0);
  50 print "\n$ScriptName: Starting...\n\n";
  51 $StartTime = new Benchmark;
  52 
  53 # Get the options and setup script...
  54 SetupScriptUsage();
  55 if ($Options{help} || @ARGV < 1) {
  56   die GetUsageFromPod("$FindBin::Bin/$ScriptName");
  57 }
  58 
  59 my(@SDFilesList);
  60 @SDFilesList = ExpandFileNames(\@ARGV, "sdf sd");
  61 
  62 # Process options...
  63 print "Processing options...\n";
  64 my(%OptionsInfo);
  65 ProcessOptions();
  66 
  67 # Setup information about input files...
  68 print "Checking input SD file(s)...\n";
  69 my(%SDFilesInfo);
  70 RetrieveSDFilesInfo();
  71 
  72 # Process input files..
  73 my($FileIndex);
  74 if (@SDFilesList > 1) {
  75   print "\nProcessing SD files...\n";
  76 }
  77 for $FileIndex (0 .. $#SDFilesList) {
  78   if ($SDFilesInfo{FileOkay}[$FileIndex]) {
  79     print "\nProcessing file $SDFilesList[$FileIndex]...\n";
  80     GenerateAtomTypesFingerprints($FileIndex);
  81   }
  82 }
  83 print "\n$ScriptName:Done...\n\n";
  84 
  85 $EndTime = new Benchmark;
  86 $TotalTime = timediff ($EndTime, $StartTime);
  87 print "Total time: ", timestr($TotalTime), "\n";
  88 
  89 ###############################################################################
  90 
  91 # Generate fingerprints for a SD file...
  92 #
  93 sub GenerateAtomTypesFingerprints {
  94   my($FileIndex) = @_;
  95   my($CmpdCount, $IgnoredCmpdCount, $SDFile, $MoleculeFileIO, $Molecule, $AtomTypesFingerprints, $NewFPSDFileIO, $NewFPTextFileIO, $NewFPFileIO);
  96 
  97   $SDFile = $SDFilesList[$FileIndex];
  98 
  99   # Setup output files...
 100   #
 101   ($NewFPSDFileIO, $NewFPTextFileIO, $NewFPFileIO) = SetupAndOpenOutputFiles($FileIndex);
 102 
 103   $MoleculeFileIO = new MoleculeFileIO('Name' => $SDFile);
 104   $MoleculeFileIO->Open();
 105 
 106   $CmpdCount = 0;
 107   $IgnoredCmpdCount = 0;
 108 
 109   COMPOUND: while ($Molecule = $MoleculeFileIO->ReadMolecule()) {
 110     $CmpdCount++;
 111 
 112     # Filter compound data before calculating fingerprints...
 113     if ($OptionsInfo{Filter}) {
 114       if (CheckAndFilterCompound($CmpdCount, $Molecule)) {
 115         $IgnoredCmpdCount++;
 116         next COMPOUND;
 117       }
 118     }
 119 
 120     $AtomTypesFingerprints = GenerateMoleculeFingerprints($Molecule);
 121     if (!$AtomTypesFingerprints) {
 122       $IgnoredCmpdCount++;
 123       ProcessIgnoredCompound('FingerprintsGenerationFailed', $CmpdCount, $Molecule);
 124       next COMPOUND;
 125     }
 126 
 127     WriteDataToOutputFiles($FileIndex, $CmpdCount, $Molecule, $AtomTypesFingerprints, $NewFPSDFileIO, $NewFPTextFileIO, $NewFPFileIO);
 128   }
 129   $MoleculeFileIO->Close();
 130 
 131   if ($NewFPSDFileIO) {
 132     $NewFPSDFileIO->Close();
 133   }
 134   if ($NewFPTextFileIO) {
 135     $NewFPTextFileIO->Close();
 136   }
 137   if ($NewFPFileIO) {
 138     $NewFPFileIO->Close();
 139   }
 140 
 141   WriteFingerprintsGenerationSummaryStatistics($CmpdCount, $IgnoredCmpdCount);
 142 }
 143 
 144 # Process compound being ignored due to problems in fingerprints geneation...
 145 #
 146 sub ProcessIgnoredCompound {
 147   my($Mode, $CmpdCount, $Molecule) = @_;
 148   my($CmpdID, $DataFieldLabelAndValuesRef);
 149 
 150   $DataFieldLabelAndValuesRef = $Molecule->GetDataFieldLabelAndValues();
 151   $CmpdID = SetupCmpdIDForOutputFiles($CmpdCount, $Molecule, $DataFieldLabelAndValuesRef);
 152 
 153   MODE: {
 154     if ($Mode =~ /^ContainsNonElementalData$/i) {
 155       warn "\nWarning: Ignoring compound record number $CmpdCount with ID $CmpdID: Compound contains atom data corresponding to non-elemental atom symbol(s)...\n\n";
 156       next MODE;
 157     }
 158 
 159     if ($Mode =~ /^ContainsNoElementalData$/i) {
 160       warn "\nWarning: Ignoring compound record number $CmpdCount with ID $CmpdID: Compound contains no atom data...\n\n";
 161       next MODE;
 162     }
 163 
 164     if ($Mode =~ /^FingerprintsGenerationFailed$/i) {
 165       warn "\nWarning: Ignoring compound record number $CmpdCount with ID $CmpdID: Fingerprints generation didn't succeed...\n\n";
 166       next MODE;
 167     }
 168     warn "\nWarning: Ignoring compound record number $CmpdCount with ID $CmpdID: Fingerprints generation didn't succeed...\n\n";
 169   }
 170 }
 171 
 172 # Check and filter compounds....
 173 #
 174 sub CheckAndFilterCompound {
 175   my($CmpdCount, $Molecule) = @_;
 176   my($ElementCount, $NonElementCount);
 177 
 178   ($ElementCount, $NonElementCount) = $Molecule->GetNumOfElementsAndNonElements();
 179 
 180   if ($NonElementCount) {
 181     ProcessIgnoredCompound('ContainsNonElementalData', $CmpdCount, $Molecule);
 182     return 1;
 183   }
 184 
 185   if (!$ElementCount) {
 186     ProcessIgnoredCompound('ContainsNoElementalData', $CmpdCount, $Molecule);
 187     return 1;
 188   }
 189 
 190   return 0;
 191 }
 192 
 193 # Write out compounds fingerprints generation summary statistics...
 194 #
 195 sub WriteFingerprintsGenerationSummaryStatistics {
 196   my($CmpdCount, $IgnoredCmpdCount) = @_;
 197   my($ProcessedCmpdCount);
 198 
 199   $ProcessedCmpdCount = $CmpdCount - $IgnoredCmpdCount;
 200 
 201   print "\nNumber of compounds: $CmpdCount\n";
 202   print "Number of compounds processed successfully during fingerprints generation: $ProcessedCmpdCount\n";
 203   print "Number of compounds ignored during fingerprints generation: $IgnoredCmpdCount\n";
 204 }
 205 
 206 # Open output files...
 207 #
 208 sub SetupAndOpenOutputFiles {
 209   my($FileIndex) = @_;
 210   my($NewFPSDFile, $NewFPFile, $NewFPTextFile, $NewFPSDFileIO, $NewFPTextFileIO, $NewFPFileIO, %FingerprintsFileIOParams);
 211 
 212   ($NewFPSDFileIO, $NewFPTextFileIO, $NewFPFileIO) = (undef) x 3;
 213 
 214   # Setup common parameters for fingerprints file IO objects...
 215   #
 216   %FingerprintsFileIOParams = ();
 217   if ($OptionsInfo{Mode} =~ /^AtomTypesBits$/i) {
 218     %FingerprintsFileIOParams = ('Mode' => 'Write', 'Overwrite' => $OptionsInfo{OverwriteFiles}, 'FingerprintsStringMode' => 'FingerprintsBitVectorString', 'BitStringFormat' => $OptionsInfo{BitStringFormat}, 'BitsOrder' => $OptionsInfo{BitsOrder});
 219   }
 220   elsif ($OptionsInfo{Mode} =~ /^AtomTypesCount$/i) {
 221     %FingerprintsFileIOParams = ('Mode' => 'Write', 'Overwrite' => $OptionsInfo{OverwriteFiles}, 'FingerprintsStringMode' => 'FingerprintsVectorString', 'VectorStringFormat' => $OptionsInfo{VectorStringFormat});
 222   }
 223 
 224   if ($OptionsInfo{SDOutput}) {
 225     $NewFPSDFile = $SDFilesInfo{SDOutFileNames}[$FileIndex];
 226     print "Generating SD file $NewFPSDFile...\n";
 227     $NewFPSDFileIO = new FileIO::FingerprintsSDFileIO('Name' => $NewFPSDFile, %FingerprintsFileIOParams, 'FingerprintsFieldLabel' => $OptionsInfo{FingerprintsLabel});
 228     $NewFPSDFileIO->Open();
 229   }
 230 
 231   if ($OptionsInfo{FPOutput}) {
 232     $NewFPFile = $SDFilesInfo{FPOutFileNames}[$FileIndex];
 233     print "Generating FP file $NewFPFile...\n";
 234     $NewFPFileIO = new FileIO::FingerprintsFPFileIO('Name' => $NewFPFile, %FingerprintsFileIOParams);
 235     $NewFPFileIO->Open();
 236   }
 237 
 238   if ($OptionsInfo{TextOutput}) {
 239     my($ColLabelsRef);
 240 
 241     $NewFPTextFile = $SDFilesInfo{TextOutFileNames}[$FileIndex];
 242     $ColLabelsRef = SetupFPTextFileCoulmnLabels($FileIndex);
 243 
 244     print "Generating text file $NewFPTextFile...\n";
 245     $NewFPTextFileIO = new FileIO::FingerprintsTextFileIO('Name' => $NewFPTextFile, %FingerprintsFileIOParams, 'DataColLabels' => $ColLabelsRef, 'OutDelim' => $OptionsInfo{OutDelim}, 'OutQuote' => $OptionsInfo{OutQuote});
 246     $NewFPTextFileIO->Open();
 247   }
 248 
 249   return ($NewFPSDFileIO, $NewFPTextFileIO, $NewFPFileIO);
 250 }
 251 
 252 # Write fingerpritns and other data to appropriate output files...
 253 #
 254 sub WriteDataToOutputFiles {
 255   my($FileIndex, $CmpdCount, $Molecule, $AtomTypesFingerprints, $NewFPSDFileIO, $NewFPTextFileIO, $NewFPFileIO) = @_;
 256   my($DataFieldLabelAndValuesRef);
 257 
 258   $DataFieldLabelAndValuesRef = undef;
 259   if ($NewFPTextFileIO || $NewFPFileIO) {
 260     $DataFieldLabelAndValuesRef = $Molecule->GetDataFieldLabelAndValues();
 261   }
 262 
 263   if ($NewFPSDFileIO) {
 264     my($CmpdString);
 265 
 266     $CmpdString = $Molecule->GetInputMoleculeString();
 267     $NewFPSDFileIO->WriteFingerprints($AtomTypesFingerprints, $CmpdString);
 268   }
 269 
 270   if ($NewFPTextFileIO) {
 271     my($ColValuesRef);
 272 
 273     $ColValuesRef = SetupFPTextFileCoulmnValues($FileIndex, $CmpdCount, $Molecule, $DataFieldLabelAndValuesRef);
 274     $NewFPTextFileIO->WriteFingerprints($AtomTypesFingerprints, $ColValuesRef);
 275   }
 276 
 277   if ($NewFPFileIO) {
 278     my($CompoundID);
 279 
 280     $CompoundID = SetupCmpdIDForOutputFiles($CmpdCount, $Molecule, $DataFieldLabelAndValuesRef);
 281     $NewFPFileIO->WriteFingerprints($AtomTypesFingerprints, $CompoundID);
 282   }
 283 }
 284 
 285 # Generate approriate column labels for FPText output file...
 286 #
 287 sub SetupFPTextFileCoulmnLabels {
 288   my($FileIndex) = @_;
 289   my($Line, @ColLabels);
 290 
 291   @ColLabels = ();
 292   if ($OptionsInfo{DataFieldsMode} =~ /^All$/i) {
 293     push @ColLabels, @{$SDFilesInfo{AllDataFieldsRef}[$FileIndex]};
 294   }
 295   elsif ($OptionsInfo{DataFieldsMode} =~ /^Common$/i) {
 296     push @ColLabels, @{$SDFilesInfo{CommonDataFieldsRef}[$FileIndex]};
 297   }
 298   elsif ($OptionsInfo{DataFieldsMode} =~ /^Specify$/i) {
 299     push @ColLabels, @{$OptionsInfo{SpecifiedDataFields}};
 300   }
 301   elsif ($OptionsInfo{DataFieldsMode} =~ /^CompoundID$/i) {
 302     push @ColLabels, $OptionsInfo{CompoundIDLabel};
 303   }
 304   # Add fingerprints label...
 305   push @ColLabels, $OptionsInfo{FingerprintsLabel};
 306 
 307   return \@ColLabels;
 308 }
 309 
 310 # Generate column values FPText output file..
 311 #
 312 sub SetupFPTextFileCoulmnValues {
 313   my($FileIndex, $CmpdCount, $Molecule, $DataFieldLabelAndValuesRef) = @_;
 314   my(@ColValues);
 315 
 316   @ColValues = ();
 317   if ($OptionsInfo{DataFieldsMode} =~ /^CompoundID$/i) {
 318     push @ColValues, SetupCmpdIDForOutputFiles($CmpdCount, $Molecule, $DataFieldLabelAndValuesRef);
 319   }
 320   elsif ($OptionsInfo{DataFieldsMode} =~ /^All$/i) {
 321     @ColValues = map { exists $DataFieldLabelAndValuesRef->{$_} ? $DataFieldLabelAndValuesRef->{$_} : ''} @{$SDFilesInfo{AllDataFieldsRef}[$FileIndex]};
 322   }
 323   elsif ($OptionsInfo{DataFieldsMode} =~ /^Common$/i) {
 324     @ColValues = map { exists $DataFieldLabelAndValuesRef->{$_} ? $DataFieldLabelAndValuesRef->{$_} : ''} @{$SDFilesInfo{CommonDataFieldsRef}[$FileIndex]};
 325   }
 326   elsif ($OptionsInfo{DataFieldsMode} =~ /^Specify$/i) {
 327     @ColValues = map { exists $DataFieldLabelAndValuesRef->{$_} ? $DataFieldLabelAndValuesRef->{$_} : ''} @{$OptionsInfo{SpecifiedDataFields}};
 328   }
 329 
 330   return \@ColValues;
 331 }
 332 
 333 # Generate compound ID for FP and FPText output files..
 334 #
 335 sub SetupCmpdIDForOutputFiles {
 336   my($CmpdCount, $Molecule, $DataFieldLabelAndValuesRef) = @_;
 337   my($CmpdID);
 338 
 339   $CmpdID = '';
 340   if ($OptionsInfo{CompoundIDMode} =~ /^MolNameOrLabelPrefix$/i) {
 341     my($MolName);
 342     $MolName = $Molecule->GetName();
 343     $CmpdID = $MolName ? $MolName : "$OptionsInfo{CompoundID}${CmpdCount}";
 344   }
 345   elsif ($OptionsInfo{CompoundIDMode} =~ /^LabelPrefix$/i) {
 346     $CmpdID = "$OptionsInfo{CompoundID}${CmpdCount}";
 347   }
 348   elsif ($OptionsInfo{CompoundIDMode} =~ /^DataField$/i) {
 349     my($SpecifiedDataField);
 350     $SpecifiedDataField = $OptionsInfo{CompoundID};
 351     $CmpdID = exists $DataFieldLabelAndValuesRef->{$SpecifiedDataField} ? $DataFieldLabelAndValuesRef->{$SpecifiedDataField} : '';
 352   }
 353   elsif ($OptionsInfo{CompoundIDMode} =~ /^MolName$/i) {
 354     $CmpdID = $Molecule->GetName();
 355   }
 356   return $CmpdID;
 357 }
 358 
 359 # Generate fingerprints for molecule...
 360 #
 361 sub GenerateMoleculeFingerprints {
 362   my($Molecule) = @_;
 363   my($AtomTypesFingerprints);
 364 
 365   if ($OptionsInfo{KeepLargestComponent}) {
 366     $Molecule->KeepLargestComponent();
 367   }
 368   if (!$Molecule->DetectRings()) {
 369     return undef;
 370   }
 371   $Molecule->SetAromaticityModel($OptionsInfo{AromaticityModel});
 372   $Molecule->DetectAromaticity();
 373 
 374   $AtomTypesFingerprints = undef;
 375   if ($OptionsInfo{Mode} =~ /^AtomTypesCount$/i) {
 376     $AtomTypesFingerprints = new Fingerprints::AtomTypesFingerprints('Molecule' => $Molecule, 'Type' => 'AtomTypesCount', 'AtomIdentifierType' => $OptionsInfo{AtomIdentifierType}, 'AtomTypesSetToUse' => $OptionsInfo{AtomTypesSetToUse}, 'IgnoreHydrogens' => $OptionsInfo{IgnoreHydrogens});
 377 
 378   }
 379   elsif ($OptionsInfo{Mode} =~ /^AtomTypesBits$/i) {
 380     $AtomTypesFingerprints = new Fingerprints::AtomTypesFingerprints('Molecule' => $Molecule, 'Type' => 'AtomTypesBits', 'AtomIdentifierType' => $OptionsInfo{AtomIdentifierType}, 'AtomTypesSetToUse' => 'FixedSize', 'IgnoreHydrogens' => $OptionsInfo{IgnoreHydrogens});
 381   }
 382   else {
 383     die "Error: The value specified, $Options{mode}, for option \"-m, --mode\" is not valid. Allowed values: AtomTypesCount or AtomTypesBits\n";
 384   }
 385 
 386   SetAtomIdentifierTypeValuesToUse($AtomTypesFingerprints);
 387 
 388   # Generate atom types fingerprints...
 389   $AtomTypesFingerprints->GenerateFingerprints();
 390 
 391   # Make sure atom types fingerprints generation is successful...
 392   if (!$AtomTypesFingerprints->IsFingerprintsGenerationSuccessful()) {
 393     return undef;
 394   }
 395 
 396   return $AtomTypesFingerprints;
 397 }
 398 
 399 # Set atom identifier type to use for generating fingerprints...
 400 #
 401 sub SetAtomIdentifierTypeValuesToUse {
 402   my($AtomTypesFingerprints) = @_;
 403 
 404   if ($OptionsInfo{AtomIdentifierType} =~ /^AtomicInvariantsAtomTypes$/i) {
 405     $AtomTypesFingerprints->SetAtomicInvariantsToUse(\@{$OptionsInfo{AtomicInvariantsToUse}});
 406   }
 407   elsif ($OptionsInfo{AtomIdentifierType} =~ /^FunctionalClassAtomTypes$/i) {
 408     $AtomTypesFingerprints->SetFunctionalClassesToUse(\@{$OptionsInfo{FunctionalClassesToUse}});
 409   }
 410   elsif ($OptionsInfo{AtomIdentifierType} =~ /^(DREIDINGAtomTypes|EStateAtomTypes|MMFF94AtomTypes|SLogPAtomTypes|SYBYLAtomTypes|TPSAAtomTypes|UFFAtomTypes)$/i) {
 411     # Nothing to do for now...
 412   }
 413   else {
 414     die "Error: The value specified, $Options{atomidentifiertype}, for option \"-a, --AtomIdentifierType\" is not valid. Supported atom identifier types in current release of MayaChemTools: AtomicInvariantsAtomTypes, DREIDINGAtomTypes, EStateAtomTypes, FunctionalClassAtomTypes, MMFF94AtomTypes, SLogPAtomTypes, SYBYLAtomTypes, TPSAAtomTypes, UFFAtomTypes\n";
 415   }
 416 }
 417 
 418 # Retrieve information about SD files...
 419 #
 420 sub RetrieveSDFilesInfo {
 421   my($SDFile, $Index, $FileDir, $FileExt, $FileName, $OutFileRoot, $TextOutFileExt, $SDOutFileExt, $FPOutFileExt, $NewSDFileName, $NewFPFileName, $NewTextFileName, $CheckDataField, $CollectDataFields, $AllDataFieldsRef, $CommonDataFieldsRef);
 422 
 423   %SDFilesInfo = ();
 424   @{$SDFilesInfo{FileOkay}} = ();
 425   @{$SDFilesInfo{OutFileRoot}} = ();
 426   @{$SDFilesInfo{SDOutFileNames}} = ();
 427   @{$SDFilesInfo{FPOutFileNames}} = ();
 428   @{$SDFilesInfo{TextOutFileNames}} = ();
 429   @{$SDFilesInfo{AllDataFieldsRef}} = ();
 430   @{$SDFilesInfo{CommonDataFieldsRef}} = ();
 431 
 432   $CheckDataField = ($OptionsInfo{TextOutput} && ($OptionsInfo{DataFieldsMode} =~ /^CompoundID$/i) && ($OptionsInfo{CompoundIDMode} =~ /^DataField$/i)) ? 1 : 0;
 433   $CollectDataFields = ($OptionsInfo{TextOutput} && ($OptionsInfo{DataFieldsMode} =~ /^(All|Common)$/i)) ? 1 : 0;
 434 
 435   FILELIST: for $Index (0 .. $#SDFilesList) {
 436     $SDFile = $SDFilesList[$Index];
 437 
 438     $SDFilesInfo{FileOkay}[$Index] = 0;
 439     $SDFilesInfo{OutFileRoot}[$Index] = '';
 440     $SDFilesInfo{SDOutFileNames}[$Index] = '';
 441     $SDFilesInfo{FPOutFileNames}[$Index] = '';
 442     $SDFilesInfo{TextOutFileNames}[$Index] = '';
 443 
 444     $SDFile = $SDFilesList[$Index];
 445     if (!(-e $SDFile)) {
 446       warn "Warning: Ignoring file $SDFile: It doesn't exist\n";
 447       next FILELIST;
 448     }
 449     if (!CheckFileType($SDFile, "sd sdf")) {
 450       warn "Warning: Ignoring file $SDFile: It's not a SD file\n";
 451       next FILELIST;
 452     }
 453 
 454     if ($CheckDataField) {
 455       # Make sure data field exists in SD file..
 456       my($CmpdString, $SpecifiedDataField, @CmpdLines, %DataFieldValues);
 457 
 458       @CmpdLines = ();
 459       open SDFILE, "$SDFile" or die "Error: Couldn't open $SDFile: $! \n";
 460       $CmpdString = ReadCmpdString(\*SDFILE);
 461       close SDFILE;
 462       @CmpdLines = split "\n", $CmpdString;
 463       %DataFieldValues = GetCmpdDataHeaderLabelsAndValues(\@CmpdLines);
 464       $SpecifiedDataField = $OptionsInfo{CompoundID};
 465       if (!exists $DataFieldValues{$SpecifiedDataField}) {
 466         warn "Warning: Ignoring file $SDFile: Data field value, $SpecifiedDataField, using  \"--CompoundID\" option in \"DataField\" \"--CompoundIDMode\" doesn't exist\n";
 467         next FILELIST;
 468       }
 469     }
 470 
 471     $AllDataFieldsRef = '';
 472     $CommonDataFieldsRef = '';
 473     if ($CollectDataFields) {
 474       my($CmpdCount);
 475       open SDFILE, "$SDFile" or die "Error: Couldn't open $SDFile: $! \n";
 476       ($CmpdCount, $AllDataFieldsRef, $CommonDataFieldsRef) = GetAllAndCommonCmpdDataHeaderLabels(\*SDFILE);
 477       close SDFILE;
 478     }
 479 
 480     # Setup output file names...
 481     $FileDir = ""; $FileName = ""; $FileExt = "";
 482     ($FileDir, $FileName, $FileExt) = ParseFileName($SDFile);
 483 
 484     $TextOutFileExt = "csv";
 485     if ($Options{outdelim} =~ /^tab$/i) {
 486       $TextOutFileExt = "tsv";
 487     }
 488     $SDOutFileExt = $FileExt;
 489     $FPOutFileExt = "fpf";
 490 
 491     if ($OptionsInfo{OutFileRoot} && (@SDFilesList == 1)) {
 492       my ($RootFileDir, $RootFileName, $RootFileExt) = ParseFileName($OptionsInfo{OutFileRoot});
 493       if ($RootFileName && $RootFileExt) {
 494         $FileName = $RootFileName;
 495       }
 496       else {
 497         $FileName = $OptionsInfo{OutFileRoot};
 498       }
 499       $OutFileRoot = $FileName;
 500     }
 501     else {
 502       $OutFileRoot = $FileName . 'AtomTypesFP';
 503     }
 504 
 505     $NewSDFileName = "${OutFileRoot}.${SDOutFileExt}";
 506     $NewFPFileName = "${OutFileRoot}.${FPOutFileExt}";
 507     $NewTextFileName = "${OutFileRoot}.${TextOutFileExt}";
 508 
 509     if ($OptionsInfo{SDOutput}) {
 510       if ($SDFile =~ /$NewSDFileName/i) {
 511         warn "Warning: Ignoring input file $SDFile: Same output, $NewSDFileName, and input file names.\n";
 512         print "Specify a different name using \"-r --root\" option or use default name.\n";
 513         next FILELIST;
 514       }
 515     }
 516 
 517     if (!$OptionsInfo{OverwriteFiles}) {
 518       # Check SD and text outout files...
 519       if ($OptionsInfo{SDOutput}) {
 520         if (-e $NewSDFileName) {
 521           warn "Warning: Ignoring file $SDFile: The file $NewSDFileName already exists\n";
 522           next FILELIST;
 523         }
 524       }
 525       if ($OptionsInfo{FPOutput}) {
 526         if (-e $NewFPFileName) {
 527           warn "Warning: Ignoring file $SDFile: The file $NewFPFileName already exists\n";
 528           next FILELIST;
 529         }
 530       }
 531       if ($OptionsInfo{TextOutput}) {
 532         if (-e $NewTextFileName) {
 533           warn "Warning: Ignoring file $SDFile: The file $NewTextFileName already exists\n";
 534           next FILELIST;
 535         }
 536       }
 537     }
 538 
 539     $SDFilesInfo{FileOkay}[$Index] = 1;
 540 
 541     $SDFilesInfo{OutFileRoot}[$Index] = $OutFileRoot;
 542     $SDFilesInfo{SDOutFileNames}[$Index] = $NewSDFileName;
 543     $SDFilesInfo{FPOutFileNames}[$Index] = $NewFPFileName;
 544     $SDFilesInfo{TextOutFileNames}[$Index] = $NewTextFileName;
 545 
 546     $SDFilesInfo{AllDataFieldsRef}[$Index] = $AllDataFieldsRef;
 547     $SDFilesInfo{CommonDataFieldsRef}[$Index] = $CommonDataFieldsRef;
 548   }
 549 }
 550 
 551 # Process option values...
 552 sub ProcessOptions {
 553   %OptionsInfo = ();
 554 
 555   $OptionsInfo{Mode} = $Options{mode};
 556   $OptionsInfo{AromaticityModel} = $Options{aromaticitymodel};
 557 
 558   ProcessAtomIdentifierTypeOptions();
 559 
 560   my($AtomTypesSetToUse);
 561   $AtomTypesSetToUse = '';
 562   if ($Options{mode} =~ /^AtomTypesBits$/i) {
 563     if ($Options{atomtypessettouse} && $Options{atomtypessettouse} !~ /^FixedSize$/) {
 564       die "Error: The value specified, $Options{atomtypessettouse}, for option \"-e, --AtomTypesSetToUse\" is not valid. Allowed values for AtomTypesBits of \"-m, --mode\" option: FixedSize\n";
 565     }
 566     $AtomTypesSetToUse = 'FixedSize';
 567   }
 568   else {
 569     if ($Options{atomidentifiertype} =~ /^(AtomicInvariantsAtomTypes|FunctionalClassAtomTypes)$/i && $Options{atomtypessettouse} =~ /^FixedSize$/) {
 570       die "Error: The value specified, $Options{atomtypessettouse}, for option \"-e, --AtomTypesSetToUse\" is not valid during \"AtomicInvariantsAtomTypes or FunctionalClassAtomTypes\" value of \"-a, --AtomIdentifierType\". Allowed values: ArbitrarySize\n";
 571     }
 572     if ($Options{atomidentifiertype} =~ /^TPSAAtomTypes$/i && $Options{atomtypessettouse} =~ /^ArbitrarySize$/) {
 573       die "Error: The value specified, $Options{atomtypessettouse}, for option \"-e, --AtomTypesSetToUse\" is not valid during \"TPSAAtomTypes\" value of \"-a, --AtomIdentifierType\". Allowed values: FixedSize\n";
 574     }
 575     $AtomTypesSetToUse = $Options{atomtypessettouse} ? $Options{atomtypessettouse} : 'ArbitrarySize';
 576   }
 577   $OptionsInfo{AtomTypesSetToUse} = $AtomTypesSetToUse;
 578 
 579   $OptionsInfo{BitsOrder} = $Options{bitsorder};
 580   $OptionsInfo{BitStringFormat} = $Options{bitstringformat};
 581 
 582   $OptionsInfo{CompoundIDMode} = $Options{compoundidmode};
 583   $OptionsInfo{CompoundIDLabel} = $Options{compoundidlabel};
 584   $OptionsInfo{DataFieldsMode} = $Options{datafieldsmode};
 585 
 586   my(@SpecifiedDataFields);
 587   @SpecifiedDataFields = ();
 588 
 589   @{$OptionsInfo{SpecifiedDataFields}} = ();
 590   $OptionsInfo{CompoundID} = '';
 591 
 592   if ($Options{datafieldsmode} =~ /^CompoundID$/i) {
 593     if ($Options{compoundidmode} =~ /^DataField$/i) {
 594       if (!$Options{compoundid}) {
 595         die "Error: You must specify a value for \"--CompoundID\" option in \"DataField\" \"--CompoundIDMode\". \n";
 596       }
 597       $OptionsInfo{CompoundID} = $Options{compoundid};
 598     }
 599     elsif ($Options{compoundidmode} =~ /^(LabelPrefix|MolNameOrLabelPrefix)$/i) {
 600       $OptionsInfo{CompoundID} = $Options{compoundid} ? $Options{compoundid} : 'Cmpd';
 601     }
 602   }
 603   elsif ($Options{datafieldsmode} =~ /^Specify$/i) {
 604     if (!$Options{datafields}) {
 605       die "Error: You must specify a value for \"--DataFields\" option in \"Specify\" \"-d, --DataFieldsMode\". \n";
 606     }
 607     @SpecifiedDataFields = split /\,/, $Options{datafields};
 608     push @{$OptionsInfo{SpecifiedDataFields}}, @SpecifiedDataFields;
 609   }
 610 
 611   $OptionsInfo{IgnoreHydrogens} = ($Options{ignorehydrogens} =~ /^Yes$/i) ? 1 : 0;
 612 
 613   $OptionsInfo{FingerprintsLabel} = $Options{fingerprintslabel} ? $Options{fingerprintslabel} : 'AtomTypesFingerprints';
 614 
 615   $OptionsInfo{Filter} = ($Options{filter} =~ /^Yes$/i) ? 1 : 0;
 616 
 617   if ($Options{fingerprintslabelmode} =~ /^FingerprintsLabelWithIDs$/) {
 618     if ($Options{mode} =~ /^(AtomTypesCount)$/i && $Options{atomtypessettouse} =~ /^FixedSize$/i) {
 619       # Append atom types to the fingerprints label...
 620       my($FixedSizeAtomTypesSetRef);
 621       $FixedSizeAtomTypesSetRef = GetFixedSizeAtomTypesSet();
 622 
 623       $OptionsInfo{FingerprintsLabel} .= "; AtomTypes: " . TextUtil::JoinWords($FixedSizeAtomTypesSetRef, " ", 0);
 624     }
 625   }
 626   $OptionsInfo{FingerprintsLabelMode} = $Options{fingerprintslabelmode};
 627 
 628   $OptionsInfo{KeepLargestComponent} = ($Options{keeplargestcomponent} =~ /^Yes$/i) ? 1 : 0;
 629 
 630   $OptionsInfo{Output} = $Options{output};
 631   $OptionsInfo{SDOutput} = ($Options{output} =~ /^(SD|All)$/i) ? 1 : 0;
 632   $OptionsInfo{FPOutput} = ($Options{output} =~ /^(FP|All)$/i) ? 1 : 0;
 633   $OptionsInfo{TextOutput} = ($Options{output} =~ /^(Text|All)$/i) ? 1 : 0;
 634 
 635   $OptionsInfo{OutDelim} = $Options{outdelim};
 636   $OptionsInfo{OutQuote} = ($Options{quote} =~ /^Yes$/i) ? 1 : 0;
 637 
 638   $OptionsInfo{OverwriteFiles} = $Options{overwrite} ? 1 : 0;
 639   $OptionsInfo{OutFileRoot} = $Options{root} ? $Options{root} : 0;
 640 
 641   # Setup default vector string format...
 642   my($VectorStringFormat);
 643   $VectorStringFormat = '';
 644   if ($Options{vectorstringformat}) {
 645     $VectorStringFormat = $Options{vectorstringformat};
 646   }
 647   else {
 648     $VectorStringFormat = ($Options{atomtypessettouse} =~ /^FixedSize$/) ? "ValuesString" : "IDsAndValuesString";
 649   }
 650   $OptionsInfo{VectorStringFormat} = $VectorStringFormat;
 651 }
 652 
 653 # Process atom identifier type and related options...
 654 #
 655 sub ProcessAtomIdentifierTypeOptions {
 656 
 657   $OptionsInfo{AtomIdentifierType} = $Options{atomidentifiertype};
 658 
 659   if ($Options{atomidentifiertype} =~ /^AtomicInvariantsAtomTypes$/i) {
 660     ProcessAtomicInvariantsToUseOption();
 661   }
 662   elsif ($Options{atomidentifiertype} =~ /^FunctionalClassAtomTypes$/i) {
 663     ProcessFunctionalClassesToUse();
 664   }
 665   elsif ($OptionsInfo{AtomIdentifierType} =~ /^(DREIDINGAtomTypes|EStateAtomTypes|MMFF94AtomTypes|SLogPAtomTypes|SYBYLAtomTypes|TPSAAtomTypes|UFFAtomTypes)$/i) {
 666     # Nothing to do for now...
 667   }
 668   else {
 669     die "Error: The value specified, $Options{atomidentifiertype}, for option \"-a, --AtomIdentifierType\" is not valid. Supported atom identifier types in current release of MayaChemTools: AtomicInvariantsAtomTypes, DREIDINGAtomTypes, EStateAtomTypes, FunctionalClassAtomTypes, MMFF94AtomTypes, SLogPAtomTypes, SYBYLAtomTypes, TPSAAtomTypes, UFFAtomTypes\n";
 670   }
 671 }
 672 
 673 # Process specified atomic invariants to use...
 674 #
 675 sub ProcessAtomicInvariantsToUseOption {
 676   my($AtomicInvariant, $AtomSymbolSpecified, @AtomicInvariantsWords);
 677 
 678   @{$OptionsInfo{AtomicInvariantsToUse}} = ();
 679   if (IsEmpty($Options{atomicinvariantstouse})) {
 680     die "Error: Atomic invariants value specified using \"--AtomicInvariantsToUse\" option is empty\n";
 681   }
 682   $AtomSymbolSpecified = 0;
 683   @AtomicInvariantsWords = split /\,/, $Options{atomicinvariantstouse};
 684   for $AtomicInvariant (@AtomicInvariantsWords) {
 685     if (!AtomTypes::AtomicInvariantsAtomTypes::IsAtomicInvariantAvailable($AtomicInvariant)) {
 686       die "Error: Atomic invariant specified, $AtomicInvariant, using \"--AtomicInvariantsToUse\" option is not valid...\n ";
 687     }
 688     if ($AtomicInvariant =~ /^(AS|AtomSymbol)$/i) {
 689       $AtomSymbolSpecified = 1;
 690     }
 691     push @{$OptionsInfo{AtomicInvariantsToUse}}, $AtomicInvariant;
 692   }
 693   if (!$AtomSymbolSpecified) {
 694     die "Error: Atomic invariant, AS or AtomSymbol, must be specified as using \"--AtomicInvariantsToUse\" option...\n ";
 695   }
 696 }
 697 
 698 # Process specified functional classes invariants to use...
 699 #
 700 sub ProcessFunctionalClassesToUse {
 701   my($FunctionalClass, @FunctionalClassesToUseWords);
 702 
 703   @{$OptionsInfo{FunctionalClassesToUse}} = ();
 704   if (IsEmpty($Options{functionalclassestouse})) {
 705     die "Error: Functional classes value specified using \"--FunctionalClassesToUse\" option is empty\n";
 706   }
 707   @FunctionalClassesToUseWords = split /\,/, $Options{functionalclassestouse};
 708   for $FunctionalClass (@FunctionalClassesToUseWords) {
 709     if (!AtomTypes::FunctionalClassAtomTypes::IsFunctionalClassAvailable($FunctionalClass)) {
 710       die "Error: Functional class specified, $FunctionalClass, using \"--FunctionalClassesToUse\" option is not valid...\n ";
 711     }
 712     push @{$OptionsInfo{FunctionalClassesToUse}}, $FunctionalClass;
 713   }
 714 }
 715 
 716 # Get fixed size atom types set...
 717 #
 718 sub GetFixedSizeAtomTypesSet {
 719   my($AtomTypesRef);
 720 
 721   $AtomTypesRef = undef;
 722 
 723   IDENTIFIERTYPE: {
 724     if ($OptionsInfo{AtomIdentifierType} =~ /^DREIDINGAtomTypes$/i) {
 725       $AtomTypesRef = $OptionsInfo{IgnoreHydrogens} ? DREIDINGAtomTypes::GetAllPossibleDREIDINGNonHydrogenAtomTypes() : DREIDINGAtomTypes::GetAllPossibleDREIDINGAtomTypes();
 726       last IDENTIFIERTYPE;
 727     }
 728 
 729     if ($OptionsInfo{AtomIdentifierType} =~ /^EStateAtomTypes$/i) {
 730       $AtomTypesRef = $OptionsInfo{IgnoreHydrogens} ? EStateAtomTypes::GetAllPossibleEStateNonHydrogenAtomTypes() : EStateAtomTypes::GetAllPossibleEStateAtomTypes();
 731       last IDENTIFIERTYPE;
 732     }
 733 
 734     if ($OptionsInfo{AtomIdentifierType} =~ /^MMFF94AtomTypes$/i) {
 735       $AtomTypesRef = $OptionsInfo{IgnoreHydrogens} ? MMFF94AtomTypes::GetAllPossibleMMFF94NonHydrogenAtomTypes() : MMFF94AtomTypes::GetAllPossibleMMFF94AtomTypes();
 736       last IDENTIFIERTYPE;
 737     }
 738 
 739     if ($OptionsInfo{AtomIdentifierType} =~ /^SLogPAtomTypes$/i) {
 740       $AtomTypesRef = $OptionsInfo{IgnoreHydrogens} ? SLogPAtomTypes::GetAllPossibleSLogPNonHydrogenAtomTypes() : SLogPAtomTypes::GetAllPossibleSLogPAtomTypes();
 741       last IDENTIFIERTYPE;
 742     }
 743 
 744     if ($OptionsInfo{AtomIdentifierType} =~ /^SYBYLAtomTypes$/i) {
 745       $AtomTypesRef = $OptionsInfo{IgnoreHydrogens} ? SYBYLAtomTypes::GetAllPossibleSYBYLNonHydrogenAtomTypes() : SYBYLAtomTypes::GetAllPossibleSYBYLAtomTypes();
 746       last IDENTIFIERTYPE;
 747     }
 748 
 749     if ($OptionsInfo{AtomIdentifierType} =~ /^TPSAAtomTypes$/i) {
 750       $AtomTypesRef = TPSAAtomTypes::GetAllPossibleTPSAAtomTypes();
 751       last IDENTIFIERTYPE;
 752     }
 753 
 754     if ($OptionsInfo{AtomIdentifierType} =~ /^UFFAtomTypes$/i) {
 755       $AtomTypesRef = $OptionsInfo{IgnoreHydrogens} ? UFFAtomTypes::GetAllPossibleUFFNonHydrogenAtomTypes() : UFFAtomTypes::GetAllPossibleUFFAtomTypes();
 756       last IDENTIFIERTYPE;
 757     }
 758     die "Error: GetFixedSizeAtomTypesSet: Atom types set for atom indentifier type, $OptionsInfo{AtomIdentifierType}, is not available...";
 759   }
 760 
 761   return $AtomTypesRef;
 762 }
 763 
 764 # Setup script usage  and retrieve command line arguments specified using various options...
 765 sub SetupScriptUsage {
 766 
 767   # Retrieve all the options...
 768   %Options = ();
 769 
 770   $Options{aromaticitymodel} = 'MayaChemToolsAromaticityModel';
 771 
 772   $Options{atomidentifiertype} = 'AtomicInvariantsAtomTypes';
 773   $Options{atomicinvariantstouse} = 'AS,X,BO,H,FC';
 774   $Options{functionalclassestouse} = 'HBD,HBA,PI,NI,Ar,Hal';
 775 
 776   $Options{atomtypessettouse} = 'ArbitrarySize';
 777 
 778   $Options{bitsorder} = 'Ascending';
 779   $Options{bitstringformat} = 'BinaryString';
 780 
 781   $Options{compoundidmode} = 'LabelPrefix';
 782   $Options{compoundidlabel} = 'CompoundID';
 783   $Options{datafieldsmode} = 'CompoundID';
 784 
 785   $Options{filter} = 'Yes';
 786 
 787   $Options{fingerprintslabelmode} = 'FingerprintsLabelOnly';
 788   $Options{keeplargestcomponent} = 'Yes';
 789 
 790   $Options{mode} = 'AtomTypesCount';
 791 
 792   $Options{ignorehydrogens} = 'Yes';
 793 
 794   $Options{quote} = 'yes';
 795 
 796   $Options{output} = 'text';
 797   $Options{outdelim} = 'comma';
 798   $Options{quote} = 'yes';
 799 
 800   $Options{vectorstringformat} = '';
 801 
 802   if (!GetOptions(\%Options, "aromaticitymodel=s", "atomidentifiertype|a=s", "atomicinvariantstouse=s", "functionalclassestouse=s", "atomtypessettouse|e=s", "bitsorder=s", "bitstringformat|b=s", "compoundid=s", "compoundidlabel=s", "compoundidmode=s", "datafields=s", "datafieldsmode|d=s", "filter|f=s", "fingerprintslabelmode=s", "fingerprintslabel=s",  "help|h", "ignorehydrogens|i=s", "keeplargestcomponent|k=s", "mode|m=s", "outdelim=s", "output=s", "overwrite|o", "quote|q=s", "root|r=s", "vectorstringformat|v=s", "workingdir|w=s")) {
 803     die "\nTo get a list of valid options and their values, use \"$ScriptName -h\" or\n\"perl -S $ScriptName -h\" command and try again...\n";
 804   }
 805   if ($Options{workingdir}) {
 806     if (! -d $Options{workingdir}) {
 807       die "Error: The value specified, $Options{workingdir}, for option \"-w --workingdir\" is not a directory name.\n";
 808     }
 809     chdir $Options{workingdir} or die "Error: Couldn't chdir $Options{workingdir}: $! \n";
 810   }
 811   if (!Molecule::IsSupportedAromaticityModel($Options{aromaticitymodel})) {
 812     my(@SupportedModels) = Molecule::GetSupportedAromaticityModels();
 813     die "Error: The value specified, $Options{aromaticitymodel}, for option \"--AromaticityModel\" is not valid. Supported aromaticity models in current release of MayaChemTools: @SupportedModels\n";
 814   }
 815   if ($Options{atomidentifiertype} !~ /^(AtomicInvariantsAtomTypes|DREIDINGAtomTypes|EStateAtomTypes|FunctionalClassAtomTypes|MMFF94AtomTypes|SLogPAtomTypes|SYBYLAtomTypes|TPSAAtomTypes|UFFAtomTypes)$/i) {
 816     die "Error: The value specified, $Options{atomidentifiertype}, for option \"-a, --AtomIdentifierType\" is not valid. Supported atom identifier types in current release of MayaChemTools: AtomicInvariantsAtomTypes, DREIDINGAtomTypes, EStateAtomTypes, FunctionalClassAtomTypes, MMFF94AtomTypes, SLogPAtomTypes, SYBYLAtomTypes, TPSAAtomTypes, UFFAtomTypes\n";
 817   }
 818   if ($Options{atomtypessettouse} && $Options{atomtypessettouse} !~ /^(ArbitrarySize|FixedSize)$/) {
 819     die "Error: The value specified, $Options{atomtypessettouse}, for option \"--AtomTypesSetToUse\" is not valid. Allowed values: ArbitrarySize or FixedSize\n";
 820   }
 821   if ($Options{bitsorder} !~ /^(Ascending|Descending)$/i) {
 822     die "Error: The value specified, $Options{bitsorder}, for option \"--BitsOrder\" is not valid. Allowed values: Ascending or Descending\n";
 823   }
 824   if ($Options{bitstringformat} !~ /^(BinaryString|HexadecimalString)$/i) {
 825     die "Error: The value specified, $Options{bitstringformat}, for option \"-b, --bitstringformat\" is not valid. Allowed values: BinaryString or HexadecimalString\n";
 826   }
 827   if ($Options{compoundidmode} !~ /^(DataField|MolName|LabelPrefix|MolNameOrLabelPrefix)$/i) {
 828     die "Error: The value specified, $Options{compoundidmode}, for option \"--CompoundIDMode\" is not valid. Allowed values: DataField, MolName, LabelPrefix or MolNameOrLabelPrefix\n";
 829   }
 830   if ($Options{datafieldsmode} !~ /^(All|Common|Specify|CompoundID)$/i) {
 831     die "Error: The value specified, $Options{datafieldsmode}, for option \"-d, --DataFieldsMode\" is not valid. Allowed values: All, Common, Specify or CompoundID\n";
 832   }
 833   if ($Options{filter} !~ /^(Yes|No)$/i) {
 834     die "Error: The value specified, $Options{filter}, for option \"-f, --Filter\" is not valid. Allowed values: Yes or No\n";
 835   }
 836   if ($Options{fingerprintslabelmode} !~ /^(FingerprintsLabelOnly|FingerprintsLabelWithIDs)$/i) {
 837     die "Error: The value specified, $Options{fingerprintslabelmode}, for option \"--FingerprintsLabelMode\" is not valid. Allowed values: FingerprintsLabelOnly or FingerprintsLabelWithIDs\n";
 838   }
 839   if ($Options{ignorehydrogens} !~ /^(Yes|No)$/i) {
 840     die "Error: The value specified, $Options{ignorehydrogens}, for option \"-i, --IgnoreHydrogens\" is not valid. Allowed values: Yes or No\n";
 841   }
 842   if ($Options{keeplargestcomponent} !~ /^(Yes|No)$/i) {
 843     die "Error: The value specified, $Options{keeplargestcomponent}, for option \"-k, --KeepLargestComponent\" is not valid. Allowed values: Yes or No\n";
 844   }
 845   if ($Options{mode} !~ /^(AtomTypesCount|AtomTypesBits)$/i) {
 846     die "Error: The value specified, $Options{mode}, for option \"-m, --mode\" is not valid. Allowed values: AtomTypesCount, or AtomTypesBits\n";
 847   }
 848   if ($Options{output} !~ /^(SD|FP|text|all)$/i) {
 849     die "Error: The value specified, $Options{output}, for option \"--output\" is not valid. Allowed values: SD, FP, text, or all\n";
 850   }
 851   if ($Options{outdelim} !~ /^(comma|semicolon|tab)$/i) {
 852     die "Error: The value specified, $Options{outdelim}, for option \"--outdelim\" is not valid. Allowed values: comma, tab, or semicolon\n";
 853   }
 854   if ($Options{quote} !~ /^(Yes|No)$/i) {
 855     die "Error: The value specified, $Options{quote}, for option \"-q --quote\" is not valid. Allowed values: Yes or No\n";
 856   }
 857   if ($Options{outdelim} =~ /semicolon/i && $Options{quote} =~ /^No$/i) {
 858     die "Error: The value specified, $Options{quote}, for option \"-q --quote\" is not allowed with, semicolon value of \"--outdelim\" option: Fingerprints string use semicolon as delimiter for various data fields and must be quoted.\n";
 859   }
 860   if ($Options{vectorstringformat} && $Options{vectorstringformat} !~ /^(ValuesString|IDsAndValuesString|IDsAndValuesPairsString|ValuesAndIDsString|ValuesAndIDsPairsString)$/i) {
 861     die "Error: The value specified, $Options{vectorstringformat}, for option \"-v, --VectorStringFormat\" is not valid. Allowed values: ValuesString, IDsAndValuesString, IDsAndValuesPairsString, ValuesAndIDsString or ValuesAndIDsPairsString\n";
 862   }
 863 }
 864