| 20 . | Income Taxes |
| As of December 31, | ||||||||
| 2017 | 2016 | |||||||
| Deferred tax assets: | ||||||||
| Net operating loss carryforwards | $ | 29,570,581 | $ | 66,150,646 | ||||
| R&D credit carryforwards | 10,043,714 | 9,729,673 | ||||||
| AMT credit carryforward | 1,229,979 | — | ||||||
| Stock compensation | 576,024 | 1,368,458 | ||||||
| Intangibles | 591,651 | 1,720,761 | ||||||
| Gain/loss from discontinued operations | (2,510,699 | ) | — | |||||
| Temporary differences | 207,447 | 132,476 | ||||||
| Deferred tax assets before valuation allowance | 39,708,697 | 79,102,014 | ||||||
| Valuation allowance | (38,478,718 | ) | (79,102,014 | ) | ||||
| Net deferred tax assets | $ | 1,229,979 | $ | — | ||||
| As of December 31, 2017 | ||||||||||
| Generated | Expiration | U.S. Net Operating Loss Carryforwards | U.S. R&D Credit Carryforwards | |||||||
| 1998 | 2018 | $ | — | $ | 1,173,387 | |||||
| 1999 | 2019 | — | 130,359 | |||||||
| 2000 | 2020 | — | 71,713 | |||||||
| 2001 | 2021 | — | 39,128 | |||||||
| 2002 | 2022 | — | 5,350 | |||||||
| 2003 | 2023 | — | 2,905 | |||||||
| 2004 | 2024 | — | 22,861 | |||||||
| 2005 | 2025 | — | 218,332 | |||||||
| 2006 | 2026 | — | 365,541 | |||||||
| 2007 | 2027 | — | 342,898 | |||||||
| 2008 | 2028 | — | 531,539 | |||||||
| 2009 | 2029 | — | 596,843 | |||||||
| 2010 | 2030 | — | 1,094,449 | |||||||
| 2011 | 2031 | — | 1,950,744 | |||||||
| 2012 | 2032 | 19,577,479 | 468,008 | |||||||
| 2013 | 2033 | 37,450,522 | 681,772 | |||||||
| 2014 | 2034 | 34,088,874 | 816,116 | |||||||
| 2015 | 2035 | 25,073,846 | 492,732 | |||||||
| 2016 | 2036 | 15,581,209 | 262,257 | |||||||
| 2017 | 2037 | — | 387,892 | |||||||
Total carryforwards | $ | 131,771,930 | $ | 9,654,826 | ||||||
| Years Ended December 31, | ||||||||||||||||||||||||
| 2017 | 2016 | 2015 | ||||||||||||||||||||||
| Amount | % | Amount | % | Amount | % | |||||||||||||||||||
| Benefit at statutory rate | $ | (6,048,423 | ) | (34.0 | )% | $ | (2,508,264 | ) | (34.0 | )% | $ | (7,835,163 | ) | (34.0 | )% | |||||||||
| Adjustments to valuation allowance | (26,080,051 | ) | (146.6 | )% | 2,354,656 | 31.9 | % | 8,212,163 | 35.7 | % | ||||||||||||||
| Adjustments to R&D credit carryforwards | (291,745 | ) | (1.6 | )% | (239,049 | ) | (3.2 | )% | (612,087 | ) | (2.7 | )% | ||||||||||||
| Disqualified debt interest | — | 0.0 | % | 188,060 | 2.5 | % | 438,007 | 1.9 | % | |||||||||||||||
| Tax law changes | 28,731,045 | 161.5 | % | — | 0.0 | % | — | 0.0 | % | |||||||||||||||
| Permanent items and other | (373,315 | ) | (2.2 | )% | 204,597 | 2.8 | % | (202,920 | ) | (0.9 | )% | |||||||||||||
| Provision per financial statements | $ | (4,062,489 | ) | $ | — | $ | — | |||||||||||||||||