Investing in pharmaceutical or biopharmaceutical companies can be ridiculously profitable. The problem: It can also leave you in the poor house. Because the fate of these stocks hinges on Food and Drug Administration approval, there's usually no middle ground -- a drug gets approved and the company's stock skyrockets, or it gets denied and shares plunge.

Source: Integrity Bio via Wikimedia Commons

Though it's not as volatile with larger pharmaceutical companies, that type of action can keep a lot of investors on the sidelines. Many fear they don't understanding the science behind each individual drug well enough to put their hard-earned cash on the table.

Luckily for those of us who aren't rocket scientists, there are two small companies who are poised to profit from the massive drug industry no matter the fate of each approval.

Killing drugs faster
First on our list is Organovo (ONVO 1.79%), a 3-D bioprinting company that has three different ways to succeed over the coming decades. Today, we'll just focus on the first one: helping drug companies "kill" their potential drugs faster.

Every year, the drug industry spends $50 billion to research and develop drugs. Of that, 40% is spent on drugs that will eventually have to be shelved because liver toxicities that won't surface until after preclinical testing has been completed. If drug companies were able to detect these toxicities earlier, they would save billions by either adjusting the composition of their drugs, or abandoning them.

That's where Organovo enters. The company is able to make 3-D liver assays (cultures of liver tissue cells) that act far more like native cells than do 2-D samples. Just this month, the company announced that its 3-D liver tissues were able to retain key liver functions for more than 40 days. That's an enormous accomplishment considering that in April, the best Organovo could announce was that its assays could accomplish this feat for just five days. Typical 2-D assays only retain normal functions for two days. 

Already, the company has partnered with Pfizer (PFE 0.02%) and United Therapeutics (UTHR 0.51%). The work with Pfizer has already been completed, and only time will tell if the company will come back to Organovo to work on future projects.  Even if they don't, it was a good deal for Organovo, as Pfizer funded the collaborative research, and Organovo got to keep the rights to any new tissues developed.

Work with United Therapeutics, on the other hand, is ongoing.  The companies are researching treatments for pulmonary hypertension, and their collaboration was expanded upon last year based on an expanding scope of research. 

Buying shares of Organovo isn't without its heart-stopping moments. Currently, the company has little to speak of in revenue. That won't come along until 2014, when the liver assays will become available to the market. Shares have been volatile in the past, and will continue to be, so keep that in mind if you decide to purchase shares.

Cutting down on data costs
Another big chunk of that $50 billion pie are costs associated with keeping track of all the data necessary to get a drug from the concept stage all the way to the market. That's where our second company, Medidata Solutions (MDSO), comes in.

In the most basic sense, Medidata provides cloud-based software -- dubbed the Rave system -- that helps streamline the drug approval process. Trading for almost 80 times earnings, this company's stock certainly isn't cheap, but it's also but showing hugely positive trends.

Take a look at how Medidata has been able to grow its base of drug companies using Rave software.

Source: SEC filings.

As the company's software becomes more saturated within the industry, the other variable that investors should keep their eye on is Medidata's ability to cross-sell additional products to existing customers. The company only recently began tracking these numbers, and the growth in customers using one or more add-on products is encouraging.

Source: SEC filings.

A little basic math tells us that last year, 100 drug companies used more than one Medidata service. This year, that figure stood at 178 companies. That's also impressive growth.

Go all in?
Like I said at the beginning, investing in smaller pharmaceutical companies can be vexing. These two companies should succeed no matter how each individual drug ends up faring. That being said, they are both also very volatile stocks. I own shares of both, but they account for less than 1% of my stock holdings.