Delete a whole gene list with links to cases or a link.
502260
def delete_genelist(list_id, case_id=None):
    """"""
    if case_id:
        # unlink a case from a gene list
        case_obj = app.db.case(case_id)
        app.db.remove_genelist(list_id, case_obj=case_obj)
        return redirect(request.referrer)
    else:
        # remove the whole gene list
        app.db.remove_genelist(list_id)
        return redirect(url_for('.index'))
1364586
def clean_links():
    '''
        
    '''
    if os.path.isfile(CURRENT_CERTIFICATE_PATH):
        print 'Delete symlink {}'.format(CURRENT_CERTIFICATE_PATH)
        os.remove(CURRENT_CERTIFICATE_PATH)

    if os.path.isfile(CURRENT_PRIVATE_KEY_PATH):
        print 'Delete symlink {}'.format(CURRENT_PRIVATE_KEY_PATH)
        os.remove(CURRENT_PRIVATE_KEY_PATH)
296301
def cleanup(self):
        """"""
        for file in glob.glob(self.basename + '*'):
            os.unlink(file)
331780
def clean(all=False, docs=False, dist=False, extra=None):
    """"""

    run('find . -type f -name "*.py[co]" -delete')
    run('find . -type d -name "__pycache__" -delete')

    patterns = ['build', '*.egg-info/']
    if all or docs:
        patterns.append('doc/build/*')
    if all or dist:
        patterns.append('dist')
    if extra:
        patterns.append(extra)
    for pattern in patterns:
        run('rm -rf {}'.format(pattern))
1303605
def _cleanup(self, domains):
        """"""
        for option in domains.values():
            try:
                os.remove(option['pot'])
            except (IOError, OSError):
                # It is not a problem if we can't actually remove the temporary file
                pass
753669
def remove_variants(self, variants):
        """"""
        chroms = set([i.chrom for i in variants])
        for chrom in chroms:
            if self.append_chromosome:
                chrom = 'chr%s' % chrom
            to_delete = [pos for pos in self.positions[chrom] if pos in variants]
            for pos in to_delete:
                del self.positions[chrom][pos]
801648
def unlink(self, definition, doc1, doc2) :
        ""
        links = self.database[definition].fetchByExample( {"_from": doc1._id,"_to" : doc2._id}, batchSize = 100)
        for l in links :
            self.deleteEdge(l)
1000513
public void remove() {

    if (context == null) {
      throw new IllegalStateException("link with href=" + getHref() + " can not be removed, because it's not part of a HAL resource tree");
    }

    // iterate over all links grouped by relation (because for removal we need to know the relation)
    ListMultimap<String, Link> allLinks = context.getLinks();
    for (String relation : allLinks.keySet()) {
      List<Link> links = allLinks.get(relation);

      // use an indexed for-loop, because we need to know the index to properly remove the link
      for (int i = 0; i < links.size(); i++) {
        if (links.get(i).getModel() == model) {
          context.removeLink(relation, i);
          context = null;
          return;
        }
      }
    }

    throw new IllegalStateException("the last known context resource of link with href=" + getHref() + " no longer contains this link");
  }
52332
def unlink(self):
        ''''''
        old_head = self.head
        old_tail = self.tail

        self.head = None
        self.tail = None

        if old_head:
            old_head.tail = old_tail

        if old_tail:
            old_tail.head = old_head
1198219
def clean_sequences(self):
        """"""
        logging.info('Removing plasmids and masking phages')
        plasmid_db = os.path.join(self.reffilepath, 'plasmidfinder', 'plasmid_database.fa')
        phage_db = os.path.join(self.reffilepath, 'prophages', 'combinedtargets.tfa')
        with progressbar(self.runmetadata.samples) as bar:
            for sample in bar:
                plasmid_removal = 'bbduk.sh ref={} in={} out={} overwrite'\
                    .format(plasmid_db, sample.general.combined, sample.general.combined.replace('.f', '_noplasmid.f'))
                subprocess.call(plasmid_removal, shell=True, stdout=self.devnull, stderr=self.devnull)
                phage_masking = 'bbduk.sh ref={} in={} out={} kmask=N overwrite'\
                    .format(phage_db, sample.general.combined.replace('.f', '_noplasmid.f'),
                            sample.general.combined.replace('.f', '_clean.f'))
                subprocess.call(phage_masking, shell=True, stdout=self.devnull, stderr=self.devnull)
                os.remove(sample.general.combined)
                os.rename(sample.general.combined.replace('.f', '_clean.f'), sample.general.combined)
                os.remove(sample.general.combined.replace('.f', '_noplasmid.f'))
11600
def unlink(self, *others):
        
        if not len(others):
            others = self.links[:]
        for p in self.links[:]:
            if p in others:
                p.teardown()
        return self
640902
def remove_dups(seq):
    """"""
    seen = set()
    seen_add = seen.add
    return [x for x in seq if not (x in seen or seen_add(x))]
1282153
def filter_genes(self, relevant_entrez: list) -> None:
        
        logger.info("In filter_genes()")
        irrelevant_genes = self.graph.vs.select(name_notin=relevant_entrez)
        self.graph.delete_vertices(irrelevant_genes)
1297541
def remove(self, nodes):
        """"""
        nodes = nodes if isinstance(nodes, list) else [nodes]
        for node in nodes:
            k = self.id(node)
            self.edges = list(filter(lambda e: e[0] != k and e[1] != k, self.edges))
            del self.nodes[k]
1083696
def unlink(self):
        
        links = self.registry.get(self.source)
        if self in links:
            links.pop(links.index(self))
1278779
def delete_connections(self, **kwargs):
        """"""
        rv = False
        for c in self.find_connections(**kwargs):
            self.delete(c)
            rv = True
        return rv
621799
def remove(self, spec_or_id, multi=True, *args, **kwargs):
        """"""
        if multi:
            return self.delete_many(spec_or_id)
        return self.delete_one(spec_or_id)