In python, “for” (and “while”) loops can have an “else” branch

# Python's `for` and `while` loops
# support an `else` clause that executes
# only if the loops terminates without
# hitting a `break` statement.

def contains(haystack, needle):
    """
    Throw a ValueError if `needle` not
    in `haystack`.
    """
    for item in haystack:
        if item == needle:
            break
    else:
        # The `else` here is a
        # "completion clause" that runs
        # only if the loop ran to completion
        # without hitting a `break` statement.
        raise ValueError('Needle not found')


>>> contains([23, 'needle', 0xbadc0ffee], 'needle')
None

>>> contains([23, 42, 0xbadc0ffee], 'needle')
ValueError: "Needle not found"


# Personally, I'm not a fan of the `else`
# "completion clause" in loops because
# I find it confusing. I'd rather do
# something like this:
def better_contains(haystack, needle):
    for item in haystack:
        if item == needle:
            return
    raise ValueError('Needle not found')

# Note: Typically you'd write something
# like this to do a membership test,
# which is much more Pythonic:
if needle not in haystack:
    raise ValueError('Needle not found')

How to avoid version conflicts with Virtual Environments in Python

# Virtual Environments ("virtualenvs") keep
# your project dependencies separated.
# They help you avoid version conflicts
# between packages and different versions
# of the Python runtime.

# Before creating & activating a virtualenv:
# `python` and `pip` map to the system
# version of the Python interpreter
# (e.g. Python 2.7)
$ which python
/usr/local/bin/python

# Let's create a fresh virtualenv using
# another version of Python (Python 3):
$ python3 -m venv ./venv

# A virtualenv is just a "Python
# environment in a folder":
$ ls ./venv
bin      include    lib      pyvenv.cfg

# Activating a virtualenv configures the
# current shell session to use the python
# (and pip) commands from the virtualenv
# folder instead of the global environment:
$ source ./venv/bin/activate

# Note how activating a virtualenv modifies
# your shell prompt with a little note
# showing the name of the virtualenv folder:
(venv) $ echo "wee!"

# With an active virtualenv, the `python`
# command maps to the interpreter binary
# *inside the active virtualenv*:
(venv) $ which python
/Users/dan/my-project/venv/bin/python3

# Installing new libraries and frameworks
# with `pip` now installs them *into the
# virtualenv sandbox*, leaving your global
# environment (and any other virtualenvs)
# completely unmodified:
(venv) $ pip install requests

# To get back to the global Python
# environment, run the following command:
(venv) $ deactivate

# (See how the prompt changed back
# to "normal" again?)
$ echo "yay!"

# Deactivating the virtualenv flipped the
# `python` and `pip` commands back to
# the global environment:
$ which python
/usr/local/bin/python

Microbes called extremophiles might combat superbugs, biowarfare agents


The Champagne vent field at NW Eifuku seamount in the Marianas Trench Marine National Monument in the Pacific Ocean. Microbes called “extremophiles” can thrive in such physically or geochemically harsh conditions. (NOAA Office of Ocean Exploration and Research)
By Max Blau
May 5

In early 2001, Joe Ng boarded a ship in the Azores to collect samples of mud. It wasn’t just any old boat: It was the Akademik Mstislav Keldysh, the 401-foot Russian research vessel used by filmmaker James Cameron to help capture deep-sea footage for the blockbuster film “Titanic.” And it wasn’t just any kind of mud: It was samples from a hydrothermal vent field thousands of feet below the Atlantic Ocean’s surface where some of the world’s tiniest and toughest organisms flourished.

The $50,000 ticket bought Ng, a molecular biologist, roughly two weeks at sea. Afterward, Ng traveled back to Huntsville, Ala., with an insulated lunch cooler stuffed with plastic sandwich bags of mud. Back in his lab, he occasionally subjected these “extremophiles” — a word derived from Latin (extreme) and Greek (love) — to various tests.

But soon, as Ng pursued other academic interests, the samples sat idly in a freezer. Then, 14 years later, he came across a funding opportunity to see whether those extremophiles, which live in environments once thought too extreme for life, might have a medical purpose. The funder wasn’t a drug company, nor an academic institution, as he might have expected. It was the U.S. military.

The Defense Department was trying to protect soldiers not only against traditional arms such as bullets and bombs but also biological weapons. That concern had birthed scientific research initiatives that did everything from detect potential chemical threats to treat soldiers infected with biowarfare agents in the line of duty. Worried about the rise of drug-resistant bacteria and the pharmaceutical industry’s lack of new antibiotic research, Defense officials turned to biologists for help defending against agents such as anthrax.

Already, the military has funded private researchers to help develop vaccines for filovirus and recombinant plague, a pair of highly lethal pathogens.

Superbugs are on track to kill more people than cancer by 2050. Bob Kokoska, project manager with the U.S. Army Research Office, believes the resilient, understudied genes of extremophiles might hold answers to better protecting tomorrow’s soldiers.

“They were looking for new chemistry to attack these bugs that are very resistant to antibiotics,” said Anuj “AJ” Singhal, a former colleague of Ng who now oversees the extremophile research for CFD Research, a Huntsville-based company that also develops technology for NASA and the Energy Department. “We had all these samples from places no one has really looked to make drugs from before. I was like, what if we looked there?”

Identifying new antibiotics is an unglamorous process.

First, Singhal must pour the mud samples through five filters to remove potential contaminants. Once captured, he can crack open the cells to isolate long purified fragments of DNA. Those fragments are then placed into a library full of DNA clones. His lab then examines each clone to see whether they might harbor gene clusters suitable to potentially produce antibiotics.

Synthetic biology comes next. Singhal inserts each DNA clone into a genetic vehicle known as a vector, which can deliver the DNA fragment to another cell. To do that, he fires pulses that “shock” open the membrane of E. coli cells. This allows the DNA fragments to be introduced. Inside a petri dish, Singhal grows the E. coli cells. After several days, he places a thin layer of bacteria over the petri dish to see whether those clones — no bigger than a white speck of dust — can fend off bacteria.

He knows which ones hold the most promise because a visible halo, known as a “kill zone,” emerges around those white specks.

“We’re tapping open something few people have thought about,” said Seth Bordenstein, associate professor of biological sciences at Vanderbilt University, who is separately studying whether deep-sea microbes known as archaea could help lead to the discovery of new antibacterial drugs. “What types of new classes of antibiotics could be discovered? Are there any new classes? We don’t know the answers.”

Ng, now a biology professor at the University of Alabama in Huntsville, says “more people have explored space than the ocean floor.” But that’s changing in part thanks to biochemists such as Kary Mullis, whose Nobel Prize-winning work on polymerase chain reaction was based on bacterium found in a hot spring. One scientist in New Zealand is testing whether extremophiles found in a contaminated lake could treat Alzheimer’s disease, while another researcher found in the Great Salt Lake’s sediment a family of peptides that show antibiotic potential.

And James Coker, a biotechnology professor at the University of Maryland University College, said he believes potential exists for a wide variety of industries including biofuel, food, cosmetics and health care.

“In truth, this should come as little surprise, as microorganisms have been killing each other and fighting for survival for billions of years,” Coker wrote in a 2016 article published in F1000Research. “After that long a time, it should be clear that microorganisms have perfected the art of warfare, but it is up to us to take advantage of it.”

Over the past three years, Singhal said he has grown Ng’s collection of extremophile samples into a library of about 200,000 DNA clones. Singhal said only a small fraction has so far been tested. (About two-dozen extracts have displayed enough potential to be considered for further testing.)

During a recent screening of thermal vent clones — the ones Ng collected back in 2001 — Singhal found seven new hits with “substantial” antibacterial activity. But the results were mixed. A few of the DNA clones that initially showed the most promise were false positives. Six clones, however, produced antibiotics.

Soon, Singhal will grow those extracts into larger volumes and, eventually, test them against organisms that act as safer “surrogates” to biowarfare agents.

If they perform well, he’ll ship those extracts nearly 700 miles northeast to Maryland’s Fort Detrick. Scientists at the U.S. Army Medical Research Institute of Infectious Diseases, located 50 miles outside the District, can safely test those extremophiles in a biosecure lab capable of handling deadly agents. Animal — or perhaps human — testing would potentially follow.

“There’s a lot of failure in drug discovery,” Singhal warned. “But if we keep screening, we’re going to keep finding new hits, and that will improve our chances. Look at Alexander Fleming, 90 years ago. One hit found by accident turned out to be penicillin. You never know.

Original Link Washington Post

Original File Found