Beispiel #1
0
    def create_construct_data(self, filenames=False):
        self.logger.info('ADDING EXPERIMENTAL CONSTRUCT DATA')

        # read source files
        if not filenames:
            filenames = os.listdir(self.construct_data_dir)

        for filename in filenames:
            if filename[-4:] != 'json':
                continue
            filepath = os.sep.join([self.construct_data_dir, filename])
            with open(filepath) as json_file:
                d = json.load(json_file)

                add_construct(d)

        structures = Structure.objects.all()

        for s in structures:
            pdbname = str(s)
            try:
                protein = Protein.objects.filter(
                    entry_name=pdbname.lower()).get()
                d = fetch_pdb_info(pdbname, protein)
                add_construct(d)
            except:
                print(pdbname, 'failed')

        self.logger.info('COMPLETED CREATING EXPERIMENTAL CONSTRUCT DATA')
    def create_construct_data(self, filenames=False):
        self.logger.info('ADDING EXPERIMENTAL CONSTRUCT DATA')

        # read source files
        if not filenames:
            filenames = os.listdir(self.construct_data_dir)

        for filename in filenames:
            if filename[-4:]!='json':
                continue
            filepath = os.sep.join([self.construct_data_dir, filename])
            with open(filepath) as json_file:
                d = json.load(json_file)

                add_construct(d)

        structures = Structure.objects.all()

        for s in structures:
            pdbname = str(s)
            try:
                protein = Protein.objects.filter(entry_name=pdbname.lower()).get()
                d = fetch_pdb_info(pdbname,protein)
                add_construct(d)
            except:
                print(pdbname,'failed')



        self.logger.info('COMPLETED CREATING EXPERIMENTAL CONSTRUCT DATA')
    def create_construct_data(self, filenames=False):
        self.logger.info('ADDING EXPERIMENTAL CONSTRUCT DATA')

        # read source files
        do_all = False
        if not filenames:
            do_all = True
            # self.purge_construct_data()
            # filenames = os.listdir(self.construct_data_dir)

        if filenames:
            for filename in filenames:
                if filename[-4:] != 'json':
                    continue
                filepath = os.sep.join([self.construct_data_dir, filename])
                print('Adding ' + filepath)
                with open(filepath) as json_file:
                    d = json.load(json_file)
                    add_construct(d)

        if do_all:
            structures = Structure.objects.all().exclude(refined=True)
            for s in structures:
                pdbname = str(s)
                try:
                    exists = Construct.objects.filter(
                        structure__pdb_code__index=pdbname).exists()
                    if not exists:
                        print(pdbname)
                        protein = Protein.objects.filter(
                            entry_name=pdbname.lower()).get()
                        d = fetch_pdb_info(pdbname, protein)
                        add_construct(d)
                    else:
                        # pass
                        print("Entry for", pdbname, "already there")
                except:
                    print(pdbname, 'failed')

        self.logger.info('COMPLETED CREATING EXPERIMENTAL CONSTRUCT DATA')
    def create_construct_data(self, filenames=False):
        self.logger.info('ADDING EXPERIMENTAL CONSTRUCT DATA')

        # read source files
        do_all = False
        if not filenames:
            do_all = True
            # self.purge_construct_data()
            # filenames = os.listdir(self.construct_data_dir)

        if filenames:
            for filename in filenames:
                if filename[-4:]!='json':
                    continue
                filepath = os.sep.join([self.construct_data_dir, filename])
                print('Adding '+filepath)
                with open(filepath) as json_file:
                    d = json.load(json_file)
                    add_construct(d)

        if do_all:
            structures = Structure.objects.all().exclude(refined=True)
            for s in structures:
                pdbname = str(s)
                try:
                    exists = Construct.objects.filter(structure__pdb_code__index=pdbname).exists()
                    if not exists:
                        # print(pdbname)
                        protein = Protein.objects.filter(entry_name=pdbname.lower()).get()
                        d = fetch_pdb_info(pdbname,protein)
                        add_construct(d)
                    else:
                        # pass
                        print("Entry for",pdbname,"already there")
                except:
                    print(pdbname,'failed')

        self.logger.info('COMPLETED CREATING EXPERIMENTAL CONSTRUCT DATA')
Beispiel #5
0
    def create_construct_local_data(self, filenames=False):
        self.logger.info('ADDING EXPERIMENTAL CONSTRUCT DATA')

        #delete existing
        self.purge_construct_data()

        # read source files
        if not filenames:
            filenames = os.listdir(self.construct_data_dir)

        for filename in sorted(filenames):
            print('dealing with', filename)
            if filename[-4:] != 'json':
                continue
            filepath = os.sep.join([self.construct_data_dir, filename])
            with open(filepath) as json_file:
                d = json.load(json_file)
                add_construct(d)

        filenames = os.listdir(self.construct_data_local_dir)

        for filename in sorted(filenames):
            print('dealing with', filename)
            if filename[-4:] != 'json':
                continue
            filepath = os.sep.join([self.construct_data_local_dir, filename])
            with open(filepath) as json_file:
                d = json.load(json_file)
                add_construct(d)

        structures = Structure.objects.all()

        for s in structures:
            pdbname = str(s)
            try:
                exists = Construct.objects.filter(
                    structure__pdb_code__index=pdbname).exists()
                if not exists:
                    print(pdbname)
                    protein = Protein.objects.filter(
                        entry_name=pdbname.lower()).get()
                    d = fetch_pdb_info(pdbname, protein)
                    add_construct(d)
                else:
                    print("Entry for", pdbname, "already there")
            except:
                print(pdbname, 'failed')
    def create_construct_local_data(self, filenames=False):
        self.logger.info('ADDING EXPERIMENTAL CONSTRUCT DATA')

        #delete existing
        self.purge_construct_data()

        # read source files
        if not filenames:
            filenames = os.listdir(self.construct_data_dir)

        for filename in sorted(filenames):
            print('dealing with',filename)
            if filename[-4:]!='json':
                continue
            filepath = os.sep.join([self.construct_data_dir, filename])
            with open(filepath) as json_file:
                d = json.load(json_file)
                add_construct(d)

        filenames = os.listdir(self.construct_data_local_dir)

        for filename in sorted(filenames):
            print('dealing with',filename)
            if filename[-4:]!='json':
                continue
            filepath = os.sep.join([self.construct_data_local_dir, filename])
            with open(filepath) as json_file:
                d = json.load(json_file)
                add_construct(d)

        structures = Structure.objects.all()

        for s in structures:
            pdbname = str(s)
            try:
                exists = Construct.objects.filter(structure__pdb_code__index=pdbname).exists()
                if not exists:
                    print(pdbname)
                    protein = Protein.objects.filter(entry_name=pdbname.lower()).get()
                    d = fetch_pdb_info(pdbname,protein)
                    add_construct(d)
                else:
                    print("Entry for",pdbname,"already there")
            except:
                print(pdbname,'failed')