Example #1
0
 def test_WhyNot(self):
     cingDirTmpTest = os.path.join(cingDirTmp, getCallerName())
     mkdirs(cingDirTmpTest)
     self.failIf(os.chdir(cingDirTmpTest),
                 msg="Failed to change to test directory for files: " +
                 cingDirTmpTest)
     whyNot = WhyNot()
     for entryId in ['1brv', '9pcy']:
         whyNotEntry = WhyNotEntry(entryId)
         whyNot[entryId] = whyNotEntry
         if entryId not in ['1brv']:
             whyNotEntry.comment = NOT_NMR_ENTRY
             whyNotEntry.exists = False
             continue
         whyNotEntry.comment = FAILED_TO_BE_VALIDATED_CING
     whyNotStr = '%s' % whyNot
     nTdebug("whyNotStr: [" + whyNotStr + "]")
     writeTextToFile("NRG-CING.txt", whyNotStr)
Example #2
0
    def doWriteWhyNot(self):
        "Write the WHYNOT files"
        if self.writeWhyNot:
            nTdebug("Create WHY_NOT list")
        else:
            nTmessage("Skipping create WHY_NOT list")
            return

        whyNot = WhyNot()
        # Loop for speeding up the checks. Most are not nmr.
        for entryId in self.entry_list_pdb:
            whyNotEntry = WhyNotEntry(entryId)
            whyNot[entryId] = whyNotEntry
            whyNotEntry.comment = ''
            whyNotEntry.exists = False

        for entryId in self.entry_list_pdb:
            whyNotEntry = whyNot[entryId]
            whyNotEntry.exists = True
            #            if entryId not in self.entry_list_nrg:
            #                whyNotEntry.comment = NO_EXPERIMENTAL_DATA
            #                whyNotEntry.exists = False
            #                continue
            #            if entryId not in self.entry_list_nrg_docr:
            #                whyNotEntry.comment = FAILED_TO_BE_CONVERTED_NRG
            #                whyNotEntry.exists = False
            #                continue
            if entryId not in self.entry_list_tried:
                whyNotEntry.comment = TO_BE_VALIDATED_BY_CING
                whyNotEntry.exists = False
                continue
            if entryId not in self.entry_list_done:
                whyNotEntry.comment = FAILED_TO_BE_VALIDATED_CING
                whyNotEntry.exists = False
                continue


#            whyNotEntry.comment = PRESENT_IN_CING
# Entries that are present in the database do not need a comment
            del (whyNot[entryId])
        # end loop over entries
        whyNotStr = '%s' % whyNot
        #        nTdebug("whyNotStr truncated to 1000 chars: [" + whyNotStr[0:1000] + "]")

        whyNotFileName = "PDB-CING.txt"
        writeTextToFile(whyNotFileName, whyNotStr)

        why_not_db_comments_file = os.path.join(self.why_not_db_comments_dir,
                                                self.why_not_db_comments_file)
        nTdebug("Copying to: " + why_not_db_comments_file)
        shutil.copy(whyNotFileName, why_not_db_comments_file)
        if self.writeTheManyFiles:
            for entryId in self.entry_list_done:
                # For many files like: /usr/data/raw/nmr-cing/           d3/1d3z/1d3z.exist
                char23 = entryId[1:3]
                subDir = os.path.join(self.why_not_db_raw_dir, char23, entryId)
                if not os.path.exists(subDir):
                    os.makedirs(subDir)
                fileName = os.path.join(subDir, entryId + ".exist")
                if not os.path.exists(fileName):
                    #                nTdebug("Creating: " + fileName)
                    fp = open(fileName, 'w')
                    #            fprintf(fp, ' ')
                    fp.close()
Example #3
0
    def doWriteWhyNot(self):
        "Write the WHYNOT files"
        if self.writeWhyNot:
            nTdebug("Create WHY_NOT list")
        else:
            nTmessage("Skipping create WHY_NOT list")
            return

        whyNot = WhyNot()
        # Loop for speeding up the checks. Most are not nmr.
        for entryId in self.entry_list_pdb:
            whyNotEntry = WhyNotEntry(entryId)
            whyNot[entryId] = whyNotEntry
            whyNotEntry.comment = ''
            whyNotEntry.exists = False

        for entryId in self.entry_list_pdb:
            whyNotEntry = whyNot[entryId]
            whyNotEntry.exists = True
#            if entryId not in self.entry_list_nrg:
#                whyNotEntry.comment = NO_EXPERIMENTAL_DATA
#                whyNotEntry.exists = False
#                continue
#            if entryId not in self.entry_list_nrg_docr:
#                whyNotEntry.comment = FAILED_TO_BE_CONVERTED_NRG
#                whyNotEntry.exists = False
#                continue
            if entryId not in self.entry_list_tried:
                whyNotEntry.comment = TO_BE_VALIDATED_BY_CING
                whyNotEntry.exists = False
                continue
            if entryId not in self.entry_list_done:
                whyNotEntry.comment = FAILED_TO_BE_VALIDATED_CING
                whyNotEntry.exists = False
                continue

#            whyNotEntry.comment = PRESENT_IN_CING
            # Entries that are present in the database do not need a comment
            del(whyNot[entryId])
        # end loop over entries
        whyNotStr = '%s' % whyNot
#        nTdebug("whyNotStr truncated to 1000 chars: [" + whyNotStr[0:1000] + "]")

        whyNotFileName = "PDB-CING.txt"
        writeTextToFile(whyNotFileName, whyNotStr)

        why_not_db_comments_file = os.path.join(self.why_not_db_comments_dir, self.why_not_db_comments_file)
        nTdebug("Copying to: " + why_not_db_comments_file)
        shutil.copy(whyNotFileName, why_not_db_comments_file)
        if self.writeTheManyFiles:
            for entryId in self.entry_list_done:
                # For many files like: /usr/data/raw/nmr-cing/           d3/1d3z/1d3z.exist
                char23 = entryId[1:3]
                subDir = os.path.join(self.why_not_db_raw_dir, char23, entryId)
                if not os.path.exists(subDir):
                    os.makedirs(subDir)
                fileName = os.path.join(subDir, entryId + ".exist")
                if not os.path.exists(fileName):
    #                nTdebug("Creating: " + fileName)
                    fp = open(fileName, 'w')
        #            fprintf(fp, ' ')
                    fp.close()