diff --git a/mrdna/readers/.ipynb_checkpoints/test-checkpoint.ipynb b/mrdna/readers/.ipynb_checkpoints/test-checkpoint.ipynb
index 35dcfeebe6d1c30490746e659e54020de83c676d..e061577f760f9585f978ee7f330364b3c04f5d06 100644
--- a/mrdna/readers/.ipynb_checkpoints/test-checkpoint.ipynb
+++ b/mrdna/readers/.ipynb_checkpoints/test-checkpoint.ipynb
@@ -3,7 +3,7 @@
   {
    "cell_type": "code",
    "execution_count": 2,
-   "id": "d1c58516",
+   "id": "b7b6b57a",
    "metadata": {
     "scrolled": true
    },
@@ -19,7 +19,7 @@
   {
    "cell_type": "code",
    "execution_count": 7,
-   "id": "df7df2a7",
+   "id": "d7794e7b",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -30,7 +30,7 @@
   {
    "cell_type": "code",
    "execution_count": 4,
-   "id": "a24cd262",
+   "id": "a18ffc26",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -41,7 +41,7 @@
   {
    "cell_type": "code",
    "execution_count": 5,
-   "id": "806af23a",
+   "id": "22e5fd1e",
    "metadata": {},
    "outputs": [
     {
@@ -224,7 +224,7 @@
   {
    "cell_type": "code",
    "execution_count": 14,
-   "id": "db28a621",
+   "id": "6ddb3f62",
    "metadata": {},
    "outputs": [
     {
@@ -264,7 +264,7 @@
   {
    "cell_type": "code",
    "execution_count": 18,
-   "id": "cf748a26",
+   "id": "9a6e2f17",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -285,8 +285,8 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 70,
-   "id": "fde9e6b9",
+   "execution_count": 121,
+   "id": "0253e593",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -340,7 +340,7 @@
   {
    "cell_type": "code",
    "execution_count": 44,
-   "id": "608b53b9",
+   "id": "2929c2ed",
    "metadata": {},
    "outputs": [
     {
@@ -361,8 +361,8 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 71,
-   "id": "abf6006a",
+   "execution_count": 122,
+   "id": "20eab478",
    "metadata": {
     "scrolled": true
    },
@@ -382,7 +382,7 @@
   {
    "cell_type": "code",
    "execution_count": 52,
-   "id": "57f22778",
+   "id": "4ab55565",
    "metadata": {},
    "outputs": [
     {
@@ -402,55 +402,333 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 74,
-   "id": "399ada62",
+   "execution_count": 83,
+   "id": "c55fdc19",
    "metadata": {},
    "outputs": [],
    "source": [
-    "def ntcount(b):\n",
+    "def ntcount(scafs):\n",
     "    def judge(i):\n",
     "        if i ==[-1,-1,-1,-1]:\n",
     "            return 0\n",
     "        else: return 1\n",
-    "    n=np.array([judge(i) for i in b])\n",
+    "    n=np.array([judge(i) for i in scafs])\n",
     "    return np.sum(n)\n",
     "\n"
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 78,
-   "id": "1d63a717",
+   "execution_count": 84,
+   "id": "3552d3d6",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "b[\"scafnt\"]=[ntcount(b['scaf'][i]) for i in b.index]\n",
+    "b[\"stapnt\"]=[ntcount(b['stap'][i]) for i in b.index]"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 123,
+   "id": "58b92427",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "i=range(5)\n",
+    "col=[\"vh\",\"zid\",\"r\",\"bp\",\"stack\",\"threeprime\",\"seq\",\"orientation\"]\n",
+    "d=pd.DataFrame(index=i,columns=col)\n",
+    "d['vh']=[0,1,2,3,1]\n",
+    "d['zid']=[0,3,1,2,8]\n",
+    "d.set_index([\"vh\",\"zid\"],inplace=True)\n"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 126,
+   "id": "aaf6cb45",
    "metadata": {},
    "outputs": [
     {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "35\n",
-      "35\n",
-      "34\n",
-      "36\n",
-      "35\n",
-      "35\n",
-      "37\n",
-      "36\n",
-      "35\n",
-      "35\n",
-      "31\n",
-      "31\n"
+     "data": {
+      "text/html": [
+       "<div>\n",
+       "<style scoped>\n",
+       "    .dataframe tbody tr th:only-of-type {\n",
+       "        vertical-align: middle;\n",
+       "    }\n",
+       "\n",
+       "    .dataframe tbody tr th {\n",
+       "        vertical-align: top;\n",
+       "    }\n",
+       "\n",
+       "    .dataframe thead th {\n",
+       "        text-align: right;\n",
+       "    }\n",
+       "</style>\n",
+       "<table border=\"1\" class=\"dataframe\">\n",
+       "  <thead>\n",
+       "    <tr style=\"text-align: right;\">\n",
+       "      <th></th>\n",
+       "      <th>vh</th>\n",
+       "      <th>zid</th>\n",
+       "      <th>r</th>\n",
+       "      <th>bp</th>\n",
+       "      <th>stack</th>\n",
+       "      <th>threeprime</th>\n",
+       "      <th>seq</th>\n",
+       "      <th>orientation</th>\n",
+       "    </tr>\n",
+       "  </thead>\n",
+       "  <tbody>\n",
+       "    <tr>\n",
+       "      <th>0</th>\n",
+       "      <td>0</td>\n",
+       "      <td>0</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>1</th>\n",
+       "      <td>1</td>\n",
+       "      <td>3</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>2</th>\n",
+       "      <td>2</td>\n",
+       "      <td>1</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>3</th>\n",
+       "      <td>3</td>\n",
+       "      <td>2</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>4</th>\n",
+       "      <td>1</td>\n",
+       "      <td>8</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "    </tr>\n",
+       "  </tbody>\n",
+       "</table>\n",
+       "</div>"
+      ],
+      "text/plain": [
+       "   vh  zid    r   bp stack threeprime  seq orientation\n",
+       "0   0    0  NaN  NaN   NaN        NaN  NaN         NaN\n",
+       "1   1    3  NaN  NaN   NaN        NaN  NaN         NaN\n",
+       "2   2    1  NaN  NaN   NaN        NaN  NaN         NaN\n",
+       "3   3    2  NaN  NaN   NaN        NaN  NaN         NaN\n",
+       "4   1    8  NaN  NaN   NaN        NaN  NaN         NaN"
+      ]
+     },
+     "execution_count": 126,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "d.reset_index()"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 128,
+   "id": "6daf8f3b",
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "(array([0, 2]),)"
+      ]
+     },
+     "execution_count": 128,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "s=[True,False,True,False,False]\n",
+    "np.where(np.array(s)==True)"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 127,
+   "id": "126916f8",
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/html": [
+       "<div>\n",
+       "<style scoped>\n",
+       "    .dataframe tbody tr th:only-of-type {\n",
+       "        vertical-align: middle;\n",
+       "    }\n",
+       "\n",
+       "    .dataframe tbody tr th {\n",
+       "        vertical-align: top;\n",
+       "    }\n",
+       "\n",
+       "    .dataframe thead th {\n",
+       "        text-align: right;\n",
+       "    }\n",
+       "</style>\n",
+       "<table border=\"1\" class=\"dataframe\">\n",
+       "  <thead>\n",
+       "    <tr style=\"text-align: right;\">\n",
+       "      <th></th>\n",
+       "      <th></th>\n",
+       "      <th>r</th>\n",
+       "      <th>bp</th>\n",
+       "      <th>stack</th>\n",
+       "      <th>threeprime</th>\n",
+       "      <th>seq</th>\n",
+       "      <th>orientation</th>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>vh</th>\n",
+       "      <th>zid</th>\n",
+       "      <th></th>\n",
+       "      <th></th>\n",
+       "      <th></th>\n",
+       "      <th></th>\n",
+       "      <th></th>\n",
+       "      <th></th>\n",
+       "    </tr>\n",
+       "  </thead>\n",
+       "  <tbody>\n",
+       "    <tr>\n",
+       "      <th>0</th>\n",
+       "      <th>0</th>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>1</th>\n",
+       "      <th>3</th>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>2</th>\n",
+       "      <th>1</th>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>3</th>\n",
+       "      <th>2</th>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>1</th>\n",
+       "      <th>8</th>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "    </tr>\n",
+       "  </tbody>\n",
+       "</table>\n",
+       "</div>"
+      ],
+      "text/plain": [
+       "          r   bp stack threeprime  seq orientation\n",
+       "vh zid                                            \n",
+       "0  0    NaN  NaN   NaN        NaN  NaN         NaN\n",
+       "1  3    NaN  NaN   NaN        NaN  NaN         NaN\n",
+       "2  1    NaN  NaN   NaN        NaN  NaN         NaN\n",
+       "3  2    NaN  NaN   NaN        NaN  NaN         NaN\n",
+       "1  8    NaN  NaN   NaN        NaN  NaN         NaN"
+      ]
+     },
+     "execution_count": 127,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "d"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 100,
+   "id": "18f368b0",
+   "metadata": {},
+   "outputs": [
+    {
+     "ename": "KeyError",
+     "evalue": "\"None of [Int64Index([0, 0], dtype='int64')] are in the [columns]\"",
+     "output_type": "error",
+     "traceback": [
+      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+      "\u001b[0;31mKeyError\u001b[0m                                  Traceback (most recent call last)",
+      "\u001b[0;32m<ipython-input-100-a349feadc600>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0md\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
+      "\u001b[0;32m/data/server1/cmaffeo2/miniconda3/lib/python3.8/site-packages/pandas/core/frame.py\u001b[0m in \u001b[0;36m__getitem__\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m   3509\u001b[0m             \u001b[0;32mif\u001b[0m \u001b[0mis_iterator\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   3510\u001b[0m                 \u001b[0mkey\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mlist\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3511\u001b[0;31m             \u001b[0mindexer\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcolumns\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_get_indexer_strict\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"columns\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   3512\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   3513\u001b[0m         \u001b[0;31m# take() does not accept boolean indexers\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+      "\u001b[0;32m/data/server1/cmaffeo2/miniconda3/lib/python3.8/site-packages/pandas/core/indexes/base.py\u001b[0m in \u001b[0;36m_get_indexer_strict\u001b[0;34m(self, key, axis_name)\u001b[0m\n\u001b[1;32m   5780\u001b[0m             \u001b[0mkeyarr\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mindexer\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mnew_indexer\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_reindex_non_unique\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkeyarr\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   5781\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 5782\u001b[0;31m         \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_raise_if_missing\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkeyarr\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mindexer\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0maxis_name\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   5783\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   5784\u001b[0m         \u001b[0mkeyarr\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtake\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mindexer\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+      "\u001b[0;32m/data/server1/cmaffeo2/miniconda3/lib/python3.8/site-packages/pandas/core/indexes/base.py\u001b[0m in \u001b[0;36m_raise_if_missing\u001b[0;34m(self, key, indexer, axis_name)\u001b[0m\n\u001b[1;32m   5840\u001b[0m                 \u001b[0;32mif\u001b[0m \u001b[0muse_interval_msg\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   5841\u001b[0m                     \u001b[0mkey\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mlist\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 5842\u001b[0;31m                 \u001b[0;32mraise\u001b[0m \u001b[0mKeyError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34mf\"None of [{key}] are in the [{axis_name}]\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   5843\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   5844\u001b[0m             \u001b[0mnot_found\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mlist\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mensure_index\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mmissing_mask\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mnonzero\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0munique\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+      "\u001b[0;31mKeyError\u001b[0m: \"None of [Int64Index([0, 0], dtype='int64')] are in the [columns]\""
      ]
     }
    ],
    "source": [
-    "b[\"scafnt\"]=[ntcount(b['scaf'][i]) for i in b.index]\n",
-    "b[\"stapnt\"]=[ntcount(b['stap'][i]) for i in b.index]"
+    "d[[0,0]]"
    ]
   },
   {
    "cell_type": "code",
    "execution_count": 13,
-   "id": "6e30e6ec",
+   "id": "998eed5e",
    "metadata": {},
    "outputs": [
     {
@@ -471,7 +749,7 @@
   {
    "cell_type": "code",
    "execution_count": 14,
-   "id": "d2a55c6a",
+   "id": "6e62da4d",
    "metadata": {},
    "outputs": [
     {
@@ -493,7 +771,7 @@
   {
    "cell_type": "code",
    "execution_count": 198,
-   "id": "b36a118e",
+   "id": "b786e74c",
    "metadata": {},
    "outputs": [
     {
@@ -515,7 +793,7 @@
   {
    "cell_type": "code",
    "execution_count": 15,
-   "id": "c1fd0214",
+   "id": "e36b19a3",
    "metadata": {},
    "outputs": [
     {
@@ -536,7 +814,7 @@
   {
    "cell_type": "code",
    "execution_count": 173,
-   "id": "21f20d54",
+   "id": "46b64c39",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -572,7 +850,7 @@
   {
    "cell_type": "code",
    "execution_count": 177,
-   "id": "ca75e9ec",
+   "id": "4d59fd91",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -608,7 +886,7 @@
   {
    "cell_type": "code",
    "execution_count": 187,
-   "id": "daa13243",
+   "id": "d49175db",
    "metadata": {},
    "outputs": [
     {
@@ -835,7 +1113,7 @@
   {
    "cell_type": "code",
    "execution_count": 142,
-   "id": "687c6f64",
+   "id": "a033b838",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -872,7 +1150,7 @@
   {
    "cell_type": "code",
    "execution_count": 117,
-   "id": "4d610626",
+   "id": "2f0d79a6",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -893,7 +1171,7 @@
   {
    "cell_type": "code",
    "execution_count": 116,
-   "id": "ab5c6907",
+   "id": "7874ae4e",
    "metadata": {},
    "outputs": [
     {
@@ -1105,7 +1383,7 @@
   {
    "cell_type": "code",
    "execution_count": 157,
-   "id": "8e05cf62",
+   "id": "ba99db6a",
    "metadata": {},
    "outputs": [
     {
@@ -1129,7 +1407,7 @@
   {
    "cell_type": "code",
    "execution_count": 152,
-   "id": "e2e30e0a",
+   "id": "c26f006c",
    "metadata": {},
    "outputs": [
     {
@@ -1150,7 +1428,7 @@
   {
    "cell_type": "code",
    "execution_count": 62,
-   "id": "03354054",
+   "id": "108484f8",
    "metadata": {},
    "outputs": [
     {
@@ -1378,7 +1656,7 @@
   {
    "cell_type": "code",
    "execution_count": 3,
-   "id": "12b28ec3",
+   "id": "3c44e8e6",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -1504,7 +1782,7 @@
   {
    "cell_type": "code",
    "execution_count": 4,
-   "id": "6d1e1ea1",
+   "id": "2b15ebca",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -1525,7 +1803,7 @@
   {
    "cell_type": "code",
    "execution_count": 20,
-   "id": "17119618",
+   "id": "b115cc56",
    "metadata": {},
    "outputs": [
     {
@@ -1587,7 +1865,7 @@
   {
    "cell_type": "code",
    "execution_count": 25,
-   "id": "58213565",
+   "id": "3ef5fda5",
    "metadata": {},
    "outputs": [
     {
@@ -1649,7 +1927,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "id": "954a6da6",
+   "id": "6e4cec2f",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -1662,7 +1940,7 @@
   {
    "cell_type": "code",
    "execution_count": 13,
-   "id": "900af65d",
+   "id": "c194aaf1",
    "metadata": {},
    "outputs": [
     {
@@ -1683,7 +1961,7 @@
   {
    "cell_type": "code",
    "execution_count": 7,
-   "id": "b3dd534e",
+   "id": "fd8812c1",
    "metadata": {},
    "outputs": [
     {
@@ -1732,7 +2010,7 @@
   {
    "cell_type": "code",
    "execution_count": 36,
-   "id": "3477f518",
+   "id": "eb8c3d36",
    "metadata": {},
    "outputs": [
     {
@@ -1794,7 +2072,7 @@
   {
    "cell_type": "code",
    "execution_count": 1,
-   "id": "cb794762",
+   "id": "fc31059a",
    "metadata": {},
    "outputs": [
     {
@@ -1820,7 +2098,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "id": "7fe2cd8b",
+   "id": "87e1b359",
    "metadata": {},
    "outputs": [],
    "source": []
@@ -1828,7 +2106,7 @@
   {
    "cell_type": "code",
    "execution_count": 3,
-   "id": "0fe00cf6",
+   "id": "8ed06a4e",
    "metadata": {},
    "outputs": [
     {
@@ -1848,7 +2126,7 @@
   {
    "cell_type": "code",
    "execution_count": 13,
-   "id": "f8bb463d",
+   "id": "dc56eb01",
    "metadata": {},
    "outputs": [
     {
@@ -1869,7 +2147,7 @@
   {
    "cell_type": "code",
    "execution_count": 15,
-   "id": "bebc29de",
+   "id": "e24820fe",
    "metadata": {},
    "outputs": [
     {
@@ -1939,7 +2217,7 @@
   {
    "cell_type": "code",
    "execution_count": 16,
-   "id": "e67598f0",
+   "id": "adabfec6",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -1950,7 +2228,7 @@
   {
    "cell_type": "code",
    "execution_count": 26,
-   "id": "51b78d60",
+   "id": "83617f96",
    "metadata": {},
    "outputs": [
     {
@@ -2059,7 +2337,7 @@
   {
    "cell_type": "code",
    "execution_count": 25,
-   "id": "b58993ab",
+   "id": "a9e7ae70",
    "metadata": {},
    "outputs": [
     {
@@ -2080,7 +2358,7 @@
   {
    "cell_type": "code",
    "execution_count": 10,
-   "id": "2554e586",
+   "id": "062ccc4d",
    "metadata": {},
    "outputs": [
     {
@@ -2111,7 +2389,7 @@
   {
    "cell_type": "code",
    "execution_count": 1,
-   "id": "c46a53a3",
+   "id": "225701b3",
    "metadata": {},
    "outputs": [
     {
@@ -2608,7 +2886,7 @@
   {
    "cell_type": "code",
    "execution_count": 3,
-   "id": "7e1b1fb5",
+   "id": "eb0dfa9d",
    "metadata": {},
    "outputs": [
     {
@@ -2642,7 +2920,7 @@
   {
    "cell_type": "code",
    "execution_count": 4,
-   "id": "14168996",
+   "id": "2ea725af",
    "metadata": {},
    "outputs": [
     {
@@ -2662,7 +2940,7 @@
   {
    "cell_type": "code",
    "execution_count": 5,
-   "id": "b1e6b703",
+   "id": "e7ecad72",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -2672,7 +2950,7 @@
   {
    "cell_type": "code",
    "execution_count": 6,
-   "id": "229a0b83",
+   "id": "921ab252",
    "metadata": {},
    "outputs": [
     {
@@ -2693,7 +2971,7 @@
   {
    "cell_type": "code",
    "execution_count": 7,
-   "id": "ef1e3f31",
+   "id": "5e3ddee4",
    "metadata": {},
    "outputs": [
     {
@@ -2720,7 +2998,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "id": "9fcf9231",
+   "id": "16b9a0f0",
    "metadata": {},
    "outputs": [],
    "source": []
diff --git a/mrdna/readers/segmentmodel_from_cadnano.py b/mrdna/readers/segmentmodel_from_cadnano.py
index fe6b46cd9bf5da8c8ee90287e8365bf76bfcf50b..cd92d4896e42c893b6751c15572a6b97d092c6aa 100644
--- a/mrdna/readers/segmentmodel_from_cadnano.py
+++ b/mrdna/readers/segmentmodel_from_cadnano.py
@@ -5,6 +5,7 @@ import os,sys
 from glob import glob
 import re
 import pandas as pd
+pd.options.mode.chained_assignment = None  # default='warn'
 
 from ..arbdmodel.coords import readArbdCoords, readAvgArbdCoords, rotationAboutAxis
 from ..segmentmodel import SegmentModel, SingleStrandedSegment, DoubleStrandedSegment
@@ -78,32 +79,32 @@ def read_json_file(filename):
     n_df=df.set_index("num")
     return part,n_df
 
-
 def get_helix_angle(part, helix_id, indices):
-        """ Get "start_orientation" for helix """
+    """ Get "start_orientation" for helix """
         # import ipdb
         # ipdb.set_trace()
 
-        """ FROM CADNANO2.5
-        + angle is CCW
-        - angle is CW
-        Right handed DNA rotates clockwise from 5' to 3'
-        we use the convention the 5' end starts at 0 degrees
-        and it's pair is minor_groove_angle degrees away
-        direction, hence the minus signs.  eulerZ
-        """
-
-    hp, bpr, tpr, eulerZ, mgroove = self.part.vh_properties.loc[helix_id,['helical_pitch',
+    """ FROM CADNANO2.5
+    + angle is CCW
+    - angle is CW
+    Right handed DNA rotates clockwise from 5' to 3'
+    we use the convention the 5' end starts at 0 degrees
+    and it's pair is minor_groove_angle degrees away
+    direction, hence the minus signs.  eulerZ
+    """
+
+    hp, bpr, tpr, eulerZ, mgroove = part.vh_properties.loc[helix_id,
+                                                                    ['helical_pitch',
                                                                      'bases_per_repeat',
                                                                      'turns_per_repeat',
                                                                      'eulerZ',
                                                                      'minor_groove_angle']]
     twist_per_base = tpr*360./bpr
-    # angle = eulerZ - twist_per_base*indices + 0.5*mgroove + 180
+        # angle = eulerZ - twist_per_base*indices + 0.5*mgroove + 180
     angle = eulerZ + twist_per_base*indices - 0.5*mgroove
-    return angle
+    return rotationAboutAxis(np.array((0,0,1)),angle)
 
-def ntcount(scafs):
+def nttype(scafs):
     def judge(i):
         if i ==[-1,-1,-1,-1]:
             return 0
@@ -112,32 +113,66 @@ def ntcount(scafs):
     return n
 
             
-def mrdna_model_from_cadnano(json_data,**model_parameters):
-    part,vslist=decode_cadnano_part(json_data)
+def gen_prop_table(json_file):
+    part,vslist=read_json_file(json_file)
     props = part.getModelProperties().copy()
-        
-    if props.get('point_type') == PointType.ARBITRARY:
+    try:
+        if props.get('point_type') == PointType.ARBITRARY:
             # TODO add code to encode Parts with ARBITRARY point configurations
-        raise NotImplementedError("Not implemented")
-    else:
+            raise NotImplementedError("Not implemented")
+    except:
         try:
             vh_props, origins = part.helixPropertiesAndOrigins()
         except:
             origins = {hid:part.getVirtualHelixOrigin(hid)[:2] for hid in part.getidNums()}
-    scaf_id=[ntcount(vslist['scaf'][i]) for i in vslist.index]
-    stap_id=[ntcount(vslist['stap'][i]) for i in vslist.index]
+    scaf_id=[nttype(vslist['scaf'][i]) for i in vslist.index]
+    stap_id=[nttype(vslist['stap'][i]) for i in vslist.index]
     cad_bps=part.getIndices(0)
-    vslist["scafnt"]=np.sum(scaf_id)
-    vslist["stapnt"]=np.sum(stap_id)
+    vslist["scafnt"]=np.sum(np.array(scaf_id),axis=1)
+    vslist["stapnt"]=np.sum(np.array(stap_id),axis=1)
     totnt=np.sum(vslist["scafnt"])+np.sum(vslist["stapnt"])
-    nt_prop=pd.DataFrame(index=range(totnt),columns=["vh","zid","r","bp","stack","threeprime","seq","orientation"])
-    ind=0
-    for vs in range(len(scaf_id)):
-        for j in range(len(vs)):
-            if j ==True
-            nt_prop.loc[ind]["vh"]=vs
-            nt_prop.loc[ind]["zid"]
-
-
-
-    model = model_from_basepair_stack_3prime( r, bp, stack, three_prime, seq, orientation, **model_parameters )
+    is_scaf=np.zeros(totnt,dtype=bool)
+    is_scaf[0:np.sum(vslist["scafnt"])]=1
+    nt_prop=pd.DataFrame(index=range(totnt),columns=["vh","zid","is_scaf","r","bp","stack","threeprime","seq","orientation"])
+    nt_prop["is_scaf"]=is_scaf
+    tot_id=scaf_id+stap_id
+    vhi,zidi=np.where(np.array(scaf_id)==1)
+    vhj,zidj=np.where(np.array(stap_id)==1)
+    nt_prop["vh"]=list(vhi)+list(vhj)
+    nt_prop["zid"]=list(zidi)+list(zidj)
+    vhzid=list(zip(nt_prop["vh"],nt_prop["zid"]))
+    nt_prop["r"]=[part.getCoordinate(i,j) for i,j in zip(nt_prop["vh"],nt_prop["zid"])]
+    nt_prop["orientation"]=[get_helix_angle(part, helix_id, indices) for i,j in zip(nt_prop["vh"],nt_prop["zid"])]
+    nt_prop=nt_prop.fillna(-1)
+    for i in range(int(len(vhzid)/2)):
+        try:
+            bp1,bp2=(i,1+i+vhzid[i+1:].index(vhzid[i]))
+            nt_prop["bp"][bp1]=bp2
+            nt_prop["bp"][bp2]=bp1
+        except:
+            pass
+    tprime_list=-np.ones(len(nt_prop.index),dtype=int)
+    for i in range(len(nt_prop.index)):
+        ((m,n),p)=list(zip(vhzid,nt_prop["is_scaf"]))[i]
+        if p==True:
+            k,l=(vslist["scaf"][m])[n][2:]
+            if k!=-1 and l!=-1:
+                n=index2.index(((k,l),True))
+                tprime_list[i]=int(n)
+            
+        else:
+            k,l=(vslist["stap"][m])[n][2:]
+            if k!=-1 and l!=-1:
+                n=index2.index(((k,l),False))
+                tprime_list[i]=int(n)
+    nt_prop["threeprime"]=tprime_list
+    (n,)=np.where(nt_prop["threeprime"]==-1)
+    stackid=nt_prop["bp"][[list(nt_prop["threeprime"]).index(i) for i in n]]
+    nt_prop["stack"][stackid.index[np.where(np.array(stackid)!=-1)]]=nt_prop["threeprime"][stackid.index[np.where(np.array(stackid)!=-1)]]
+    
+
+    return nt_prop
+
+def mrdna_model_from_cadnano(json_file,**model_parameters):
+    nt_prop=gen_prop_table(json_file)
+    model = model_from_basepair_stack_3prime( nt_prop["r"], nt_prop["bp"], stack, three_prime, seq, orientation, **model_parameters )
diff --git a/mrdna/readers/test.ipynb b/mrdna/readers/test.ipynb
index b039b19ba5fb41f02a4d667e381a224bba2ccbca..217f357447273e9f86e51310d3571ace6b59a97c 100644
--- a/mrdna/readers/test.ipynb
+++ b/mrdna/readers/test.ipynb
@@ -2,8 +2,8 @@
  "cells": [
   {
    "cell_type": "code",
-   "execution_count": 2,
-   "id": "065c6b08",
+   "execution_count": 342,
+   "id": "767fe31e",
    "metadata": {
     "scrolled": true
    },
@@ -12,25 +12,27 @@
     "import pandas as pd\n",
     "import pickle\n",
     "import numpy as np\n",
+    "\n",
     "df=pd.read_json(\"test.json\")\n",
     "d=list(df[\"vstrands\"])"
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 7,
-   "id": "e2409533",
+   "execution_count": 343,
+   "id": "52f3059d",
    "metadata": {},
    "outputs": [],
    "source": [
     "import cadnano\n",
-    "from cadnano.document import Document\n"
+    "from cadnano.document import Document\n",
+    "from mrdna.arbdmodel.coords import readArbdCoords, readAvgArbdCoords, rotationAboutAxis"
    ]
   },
   {
    "cell_type": "code",
    "execution_count": 4,
-   "id": "f3880b54",
+   "id": "2fb0f9e3",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -41,7 +43,7 @@
   {
    "cell_type": "code",
    "execution_count": 5,
-   "id": "5e4380bc",
+   "id": "312a3b3c",
    "metadata": {},
    "outputs": [
     {
@@ -224,7 +226,7 @@
   {
    "cell_type": "code",
    "execution_count": 14,
-   "id": "6f670828",
+   "id": "df00a798",
    "metadata": {},
    "outputs": [
     {
@@ -264,7 +266,7 @@
   {
    "cell_type": "code",
    "execution_count": 18,
-   "id": "ff3c11b6",
+   "id": "ab971d26",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -285,8 +287,8 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 121,
-   "id": "40fffe7e",
+   "execution_count": 195,
+   "id": "1a5439a1",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -339,88 +341,659 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 44,
-   "id": "d640032c",
+   "execution_count": 358,
+   "id": "254f8faf",
    "metadata": {},
    "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "Found cadnano version 2 file\n"
+     ]
+    },
     {
      "data": {
       "text/plain": [
-       "[42, 42, 42, 42, 42, 42]"
+       "NucleicAcidPart_-1_3904"
       ]
      },
-     "execution_count": 44,
+     "execution_count": 358,
      "metadata": {},
      "output_type": "execute_result"
     }
    ],
    "source": [
-    "bpnum=[len(df[\"scaf\"][i]) for i in df.index]\n",
-    "bpnum"
+    "p,f=read_json_file(\"test.json\")\n",
+    "p"
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 122,
-   "id": "7559115b",
-   "metadata": {
-    "scrolled": true
-   },
+   "execution_count": 199,
+   "id": "054ffa7d",
+   "metadata": {},
    "outputs": [
     {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Found cadnano version 2 file\n"
+     "data": {
+      "text/plain": [
+       "array([0.  , 2.25, 3.4 ])"
+      ]
+     },
+     "execution_count": 199,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "p.getCoordinate(0,10)"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 434,
+   "id": "5b268b86",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "def mrdna_model_from_cadnano(json_file,**model_parameters):\n",
+    "    part,vslist=read_json_file(json_file)\n",
+    "    props = part.getModelProperties().copy()\n",
+    "    try:\n",
+    "        if props.get('point_type') == PointType.ARBITRARY:\n",
+    "            # TODO add code to encode Parts with ARBITRARY point configurations\n",
+    "            raise NotImplementedError(\"Not implemented\")\n",
+    "    except:\n",
+    "        try:\n",
+    "            vh_props, origins = part.helixPropertiesAndOrigins()\n",
+    "        except:\n",
+    "            origins = {hid:part.getVirtualHelixOrigin(hid)[:2] for hid in part.getidNums()}\n",
+    "    scaf_id=[nttype(vslist['scaf'][i]) for i in vslist.index]\n",
+    "    stap_id=[nttype(vslist['stap'][i]) for i in vslist.index]\n",
+    "    cad_bps=part.getIndices(0)\n",
+    "    vslist[\"scafnt\"]=np.sum(np.array(scaf_id),axis=1)\n",
+    "    vslist[\"stapnt\"]=np.sum(np.array(stap_id),axis=1)\n",
+    "    totnt=np.sum(vslist[\"scafnt\"])+np.sum(vslist[\"stapnt\"])\n",
+    "    is_scaf=np.zeros(totnt,dtype=bool)\n",
+    "    is_scaf[0:np.sum(vslist[\"scafnt\"])]=1\n",
+    "    nt_prop=pd.DataFrame(index=range(totnt),columns=[\"vh\",\"zid\",\"is_scaf\",\"r\",\"bp\",\"stack\",\"threeprime\",\"seq\",\"orientation\"])\n",
+    "    nt_prop[\"is_scaf\"]=is_scaf\n",
+    "    tot_id=scaf_id+stap_id\n",
+    "    vhi,zidi=np.where(np.array(scaf_id)==1)\n",
+    "    vhj,zidj=np.where(np.array(stap_id)==1)\n",
+    "    nt_prop[\"vh\"]=list(vhi)+list(vhj)\n",
+    "    nt_prop[\"zid\"]=list(zidi)+list(zidj)\n",
+    "    vhzid=list(zip(nt_prop[\"vh\"],nt_prop[\"zid\"]))\n",
+    "    nt_prop[\"r\"]=[part.getCoordinate(i,j) for i,j in zip(nt_prop[\"vh\"],nt_prop[\"zid\"])]\n",
+    "    nt_prop[\"orientation\"]=[get_helix_angle(part, helix_id, indices) for i,j in zip(nt_prop[\"vh\"],nt_prop[\"zid\"])]\n",
+    "    nt_prop=nt_prop.fillna(-1)\n",
+    "    for i in range(int(len(vhzid)/2)):\n",
+    "        try:\n",
+    "            bp1,bp2=(i,1+i+vhzid[i+1:].index(vhzid[i]))\n",
+    "            nt_prop[\"bp\"][bp1]=bp2\n",
+    "            nt_prop[\"bp\"][bp2]=bp1\n",
+    "        except:\n",
+    "            pass\n",
+    "    tprime_list=-np.ones(len(nt_prop.index),dtype=int)\n",
+    "    for i in range(len(nt_prop.index)):\n",
+    "        ((m,n),p)=list(zip(vhzid,nt_prop[\"is_scaf\"]))[i]\n",
+    "        if p==True:\n",
+    "            k,l=(vslist[\"scaf\"][m])[n][2:]\n",
+    "            if k!=-1 and l!=-1:\n",
+    "                n=index2.index(((k,l),True))\n",
+    "                tprime_list[i]=int(n)\n",
+    "\n",
+    "        else:\n",
+    "            k,l=(vslist[\"stap\"][m])[n][2:]\n",
+    "            if k!=-1 and l!=-1:\n",
+    "                n=index2.index(((k,l),False))\n",
+    "                tprime_list[i]=int(n)\n",
+    "    nt_prop[\"threeprime\"]=tprime_list\n",
+    "    (n,)=np.where(nt_prop[\"threeprime\"]==-1)\n",
+    "    stackid=nt_prop[\"bp\"][[list(nt_prop[\"threeprime\"]).index(i) for i in n]]\n",
+    "    nt_prop[\"stack\"][stackid.index[np.where(np.array(stackid)!=-1)]]=nt_prop[\"threeprime\"][stackid.index[np.where(np.array(stackid)!=-1)]]\n",
+    "\n",
+    "\n",
+    "    return nt_prop\n"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 437,
+   "id": "67d740a5",
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "array([213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225,\n",
+       "       226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238,\n",
+       "       239, 240, 241, 242, 243, 244,  -1,  -1,  -1, 249, 250, 251, 252,\n",
+       "       253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265,\n",
+       "       266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278,\n",
+       "       279, 280,  -1,  -1,  -1, 285, 286, 287, 288, 289, 290, 291, 292,\n",
+       "       293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305,\n",
+       "       306, 307, 308, 309, 310, 311, 312, 313, 314, 315,  -1,  -1,  -1,\n",
+       "       320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332,\n",
+       "       333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345,\n",
+       "       346, 347, 348, 349, 350,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,\n",
+       "        -1, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,\n",
+       "       365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377,\n",
+       "       378, 379, 380, 381, 382, 383,  -1,  -1,  -1,  -1, 384, 385, 386,\n",
+       "       387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399,\n",
+       "       400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411,  -1,\n",
+       "        -1,  -1,  -1,  -1,  -1,   0,   1,   2,   3,   4,   5,   6,   7,\n",
+       "         8,   9,  10,  11,  12,  13,  14,  15,  16,  17,  18,  19,  20,\n",
+       "        21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,  -1,  -1,\n",
+       "        -1,  -1,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,\n",
+       "        46,  47,  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,\n",
+       "        59,  60,  61,  62,  63,  64,  65,  66,  -1,  -1,  -1,  -1,  70,\n",
+       "        71,  72,  73,  74,  75,  76,  77,  78,  79,  80,  81,  82,  83,\n",
+       "        84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,  96,\n",
+       "        97,  98,  99, 100,  -1,  -1,  -1,  -1, 104, 105, 106, 107, 108,\n",
+       "       109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,\n",
+       "       122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,\n",
+       "        -1,  -1, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,\n",
+       "       155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167,\n",
+       "       168, 169, 170, 171, 172, 173, 174, 179, 180, 181, 182, 183, 184,\n",
+       "       185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197,\n",
+       "       198, 199, 200, 201, 202, 203, 204, 205, 206,  -1,  -1,  -1])"
+      ]
+     },
+     "execution_count": 437,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "np.array(nt_prop[\"bp\"])"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 302,
+   "id": "8df80d92",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "tprime_list=-np.ones(len(nt_prop.index),dtype=int)\n",
+    "for i in range(len(nt_prop.index)):\n",
+    "    ((m,n),p)=list(zip(vhzid,nt_prop[\"is_scaf\"]))[i]\n",
+    "    if p==True:\n",
+    "        k,l=(vslist[\"scaf\"][m])[n][2:]\n",
+    "        if k!=-1 and l!=-1:\n",
+    "            n=index2.index(((k,l),True))\n",
+    "            tprime_list[i]=int(n)\n",
+    "            \n",
+    "    else:\n",
+    "        k,l=(vslist[\"stap\"][m])[n][2:]\n",
+    "        if k!=-1 and l!=-1:\n",
+    "            n=index2.index(((k,l),False))\n",
+    "            tprime_list[i]=int(n)\n",
+    "nt_prop[\"threeprime\"]=tprime_list"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 368,
+   "id": "1ba36ce9",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "def get_helix_angle(part, helix_id, indices):\n",
+    "    \"\"\" Get \"start_orientation\" for helix \"\"\"\n",
+    "        # import ipdb\n",
+    "        # ipdb.set_trace()\n",
+    "\n",
+    "    \"\"\" FROM CADNANO2.5\n",
+    "    + angle is CCW\n",
+    "    - angle is CW\n",
+    "    Right handed DNA rotates clockwise from 5' to 3'\n",
+    "    we use the convention the 5' end starts at 0 degrees\n",
+    "    and it's pair is minor_groove_angle degrees away\n",
+    "    direction, hence the minus signs.  eulerZ\n",
+    "    \"\"\"\n",
+    "\n",
+    "    hp, bpr, tpr, eulerZ, mgroove = part.vh_properties.loc[helix_id,\n",
+    "                                                                    ['helical_pitch',\n",
+    "                                                                     'bases_per_repeat',\n",
+    "                                                                     'turns_per_repeat',\n",
+    "                                                                     'eulerZ',\n",
+    "                                                                     'minor_groove_angle']]\n",
+    "    twist_per_base = tpr*360./bpr\n",
+    "        # angle = eulerZ - twist_per_base*indices + 0.5*mgroove + 180\n",
+    "    angle = eulerZ + twist_per_base*indices - 0.5*mgroove\n",
+    "    return rotationAboutAxis(np.array((0,0,1)),angle)\n"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 429,
+   "id": "c275fa92",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "\n",
+    "(n,)=np.where(nt_prop[\"threeprime\"]==-1)\n",
+    "\n",
+    "stackid=nt_prop[\"bp\"][[list(nt_prop[\"threeprime\"]).index(i) for i in n]]\n",
+    "\n",
+    "nt_prop[\"stack\"][stackid.index[np.where(np.array(stackid)!=-1)]]=nt_prop[\"threeprime\"][stackid.index[np.where(np.array(stackid)!=-1)]]\n"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 430,
+   "id": "05d1934e",
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "33      -1\n",
+       "68      -1\n",
+       "102     -1\n",
+       "136     -1\n",
+       "142     -1\n",
+       "176     -1\n",
+       "194    399\n",
+       "211     -1\n",
+       "233     20\n",
+       "281     -1\n",
+       "284     -1\n",
+       "351     -1\n",
+       "354    145\n",
+       "413     -1\n",
+       "Name: bp, dtype: int64"
+      ]
+     },
+     "execution_count": 430,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "stackid"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 431,
+   "id": "7d0daba0",
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "232"
+      ]
+     },
+     "execution_count": 431,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "nt_prop[\"stack\"][233]"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 433,
+   "id": "214ff037",
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "353"
+      ]
+     },
+     "execution_count": 433,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "nt_prop[\"stack\"][354]"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 167,
+   "id": "eb07d74e",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "scaf_id=[nttype(vslist[\"scaf\"][i]) for i in vslist.index]\n",
+    "stap_id=[nttype(vslist[\"stap\"][i]) for i in vslist.index]\n",
+    "nts=scaf_id+stap_id"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 360,
+   "id": "63302624",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "nt_prop[\"orientation\"]=[get_helix_angle(p,i,j) for i,j in zip(nt_prop[\"vh\"],nt_prop[\"zid\"])]\n"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 190,
+   "id": "bc0af039",
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/html": [
+       "<div>\n",
+       "<style scoped>\n",
+       "    .dataframe tbody tr th:only-of-type {\n",
+       "        vertical-align: middle;\n",
+       "    }\n",
+       "\n",
+       "    .dataframe tbody tr th {\n",
+       "        vertical-align: top;\n",
+       "    }\n",
+       "\n",
+       "    .dataframe thead th {\n",
+       "        text-align: right;\n",
+       "    }\n",
+       "</style>\n",
+       "<table border=\"1\" class=\"dataframe\">\n",
+       "  <thead>\n",
+       "    <tr style=\"text-align: right;\">\n",
+       "      <th></th>\n",
+       "      <th>row</th>\n",
+       "      <th>col</th>\n",
+       "      <th>scaf</th>\n",
+       "      <th>stap</th>\n",
+       "      <th>loop</th>\n",
+       "      <th>skip</th>\n",
+       "      <th>scafLoop</th>\n",
+       "      <th>stapLoop</th>\n",
+       "      <th>stap_colors</th>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>num</th>\n",
+       "      <th></th>\n",
+       "      <th></th>\n",
+       "      <th></th>\n",
+       "      <th></th>\n",
+       "      <th></th>\n",
+       "      <th></th>\n",
+       "      <th></th>\n",
+       "      <th></th>\n",
+       "      <th></th>\n",
+       "    </tr>\n",
+       "  </thead>\n",
+       "  <tbody>\n",
+       "    <tr>\n",
+       "      <th>0</th>\n",
+       "      <td>12</td>\n",
+       "      <td>16</td>\n",
+       "      <td>[[-1, -1, -1, -1], [-1, -1, -1, -1], [-1, -1, ...</td>\n",
+       "      <td>[[-1, -1, -1, -1], [-1, -1, -1, -1], [0, 3, -1...</td>\n",
+       "      <td>[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...</td>\n",
+       "      <td>[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...</td>\n",
+       "      <td>[]</td>\n",
+       "      <td>[]</td>\n",
+       "      <td>[[23, 13369809], [38, 12060012]]</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>1</th>\n",
+       "      <td>12</td>\n",
+       "      <td>15</td>\n",
+       "      <td>[[-1, -1, -1, -1], [-1, -1, -1, -1], [-1, -1, ...</td>\n",
+       "      <td>[[-1, -1, -1, -1], [-1, -1, -1, -1], [-1, -1, ...</td>\n",
+       "      <td>[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...</td>\n",
+       "      <td>[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...</td>\n",
+       "      <td>[]</td>\n",
+       "      <td>[]</td>\n",
+       "      <td>[[3, 1501302]]</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>2</th>\n",
+       "      <td>13</td>\n",
+       "      <td>15</td>\n",
+       "      <td>[[-1, -1, -1, -1], [-1, -1, -1, -1], [3, 2, 2,...</td>\n",
+       "      <td>[[2, 1, -1, -1], [2, 2, 2, 0], [2, 3, 2, 1], [...</td>\n",
+       "      <td>[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...</td>\n",
+       "      <td>[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...</td>\n",
+       "      <td>[]</td>\n",
+       "      <td>[]</td>\n",
+       "      <td>[[34, 8947848]]</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>3</th>\n",
+       "      <td>13</td>\n",
+       "      <td>16</td>\n",
+       "      <td>[[-1, -1, -1, -1], [-1, -1, -1, -1], [3, 3, 2,...</td>\n",
+       "      <td>[[-1, -1, 3, 1], [3, 0, 3, 2], [3, 1, 3, 3], [...</td>\n",
+       "      <td>[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...</td>\n",
+       "      <td>[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...</td>\n",
+       "      <td>[]</td>\n",
+       "      <td>[]</td>\n",
+       "      <td>[[0, 13369344]]</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>4</th>\n",
+       "      <td>13</td>\n",
+       "      <td>17</td>\n",
+       "      <td>[[-1, -1, 4, 1], [4, 0, 4, 2], [4, 1, 4, 3], [...</td>\n",
+       "      <td>[[-1, -1, -1, -1], [-1, -1, -1, -1], [-1, -1, ...</td>\n",
+       "      <td>[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...</td>\n",
+       "      <td>[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...</td>\n",
+       "      <td>[]</td>\n",
+       "      <td>[]</td>\n",
+       "      <td>[[39, 8947848]]</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>5</th>\n",
+       "      <td>12</td>\n",
+       "      <td>17</td>\n",
+       "      <td>[[5, 1, -1, -1], [5, 2, 5, 0], [5, 3, 5, 1], [...</td>\n",
+       "      <td>[[-1, -1, -1, -1], [-1, -1, -1, -1], [-1, -1, ...</td>\n",
+       "      <td>[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...</td>\n",
+       "      <td>[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...</td>\n",
+       "      <td>[]</td>\n",
+       "      <td>[]</td>\n",
+       "      <td>[[9, 0]]</td>\n",
+       "    </tr>\n",
+       "  </tbody>\n",
+       "</table>\n",
+       "</div>"
+      ],
+      "text/plain": [
+       "     row  col                                               scaf  \\\n",
+       "num                                                                \n",
+       "0     12   16  [[-1, -1, -1, -1], [-1, -1, -1, -1], [-1, -1, ...   \n",
+       "1     12   15  [[-1, -1, -1, -1], [-1, -1, -1, -1], [-1, -1, ...   \n",
+       "2     13   15  [[-1, -1, -1, -1], [-1, -1, -1, -1], [3, 2, 2,...   \n",
+       "3     13   16  [[-1, -1, -1, -1], [-1, -1, -1, -1], [3, 3, 2,...   \n",
+       "4     13   17  [[-1, -1, 4, 1], [4, 0, 4, 2], [4, 1, 4, 3], [...   \n",
+       "5     12   17  [[5, 1, -1, -1], [5, 2, 5, 0], [5, 3, 5, 1], [...   \n",
+       "\n",
+       "                                                  stap  \\\n",
+       "num                                                      \n",
+       "0    [[-1, -1, -1, -1], [-1, -1, -1, -1], [0, 3, -1...   \n",
+       "1    [[-1, -1, -1, -1], [-1, -1, -1, -1], [-1, -1, ...   \n",
+       "2    [[2, 1, -1, -1], [2, 2, 2, 0], [2, 3, 2, 1], [...   \n",
+       "3    [[-1, -1, 3, 1], [3, 0, 3, 2], [3, 1, 3, 3], [...   \n",
+       "4    [[-1, -1, -1, -1], [-1, -1, -1, -1], [-1, -1, ...   \n",
+       "5    [[-1, -1, -1, -1], [-1, -1, -1, -1], [-1, -1, ...   \n",
+       "\n",
+       "                                                  loop  \\\n",
+       "num                                                      \n",
+       "0    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...   \n",
+       "1    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...   \n",
+       "2    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...   \n",
+       "3    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...   \n",
+       "4    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...   \n",
+       "5    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...   \n",
+       "\n",
+       "                                                  skip scafLoop stapLoop  \\\n",
+       "num                                                                        \n",
+       "0    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...       []       []   \n",
+       "1    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...       []       []   \n",
+       "2    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...       []       []   \n",
+       "3    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...       []       []   \n",
+       "4    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...       []       []   \n",
+       "5    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...       []       []   \n",
+       "\n",
+       "                          stap_colors  \n",
+       "num                                    \n",
+       "0    [[23, 13369809], [38, 12060012]]  \n",
+       "1                      [[3, 1501302]]  \n",
+       "2                     [[34, 8947848]]  \n",
+       "3                     [[0, 13369344]]  \n",
+       "4                     [[39, 8947848]]  \n",
+       "5                            [[9, 0]]  "
+      ]
+     },
+     "execution_count": 190,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "vslist"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 200,
+   "id": "fd6b27af",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "def mrdna_model_from_cadnano(json_data,**model_parameters):\n",
+    "    part,vslist=decode_cadnano_part(json_data)\n",
+    "    props = part.getModelProperties().copy()\n",
+    "\n",
+    "    if props.get('point_type') == PointType.ARBITRARY:\n",
+    "            # TODO add code to encode Parts with ARBITRARY point configurations\n",
+    "        raise NotImplementedError(\"Not implemented\")\n",
+    "    else:\n",
+    "        try:\n",
+    "            vh_props, origins = part.helixPropertiesAndOrigins()\n",
+    "        except:\n",
+    "            origins = {hid:part.getVirtualHelixOrigin(hid)[:2] for hid in part.getidNums()}\n",
+    "    scaf_id=np.array([nttype(vslist['scaf'][i]) for i in vslist.index])\n",
+    "    stap_id=np.array([nttype(vslist['stap'][i]) for i in vslist.index])\n",
+    "    cad_bps=part.getIndices(0)\n",
+    "    vslist[\"scafnt\"]=np.sum(scaf_id,axis=1)\n",
+    "    vslist[\"stapnt\"]=np.sum(stap_id,axis=1)\n",
+    "    totnt=np.sum(vslist[\"scafnt\"])+np.sum(vslist[\"stapnt\"])\n",
+    "    is_scaf=np.zeros(totnt)\n",
+    "    is_scaf[0:np.sum(vslist[\"scafnt\"])]=1\n",
+    "    nt_prop=pd.DataFrame(index=range(totnt),columns=[\"vh\",\"zid\",\"is_scaf\",\"r\",\"bp\",\"stack\",\"threeprime\",\"seq\",\"orientation\"])\n",
+    "    nt_prop[\"is_scaf\"]=is_scaf\n",
+    "    vhi,zids=np.where(np.array(scaf_id+stap_id)==1)\n",
+    "    nt_prop[\"vh\"]=vhi\n",
+    "    nt_prop[\"zid\"]=zids\n",
+    "    nt_prop[\"r\"] =part.getCoordinate(nt_prop[\"vh\"],nt_prop[\"zid\"])\n",
+    "    return nt_prop\n"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 201,
+   "id": "1130c056",
+   "metadata": {},
+   "outputs": [
+    {
+     "ename": "NameError",
+     "evalue": "name 'decode_cadnano_part' is not defined",
+     "output_type": "error",
+     "traceback": [
+      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+      "\u001b[0;31mNameError\u001b[0m                                 Traceback (most recent call last)",
+      "\u001b[0;32m<ipython-input-201-c5d589a8b80d>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mmrdna_model_from_cadnano\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"test.json\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
+      "\u001b[0;32m<ipython-input-200-181a924488ad>\u001b[0m in \u001b[0;36mmrdna_model_from_cadnano\u001b[0;34m(json_data, **model_parameters)\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mmrdna_model_from_cadnano\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mjson_data\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0mmodel_parameters\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m     \u001b[0mpart\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mvslist\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdecode_cadnano_part\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mjson_data\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m      3\u001b[0m     \u001b[0mprops\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mpart\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgetModelProperties\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcopy\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      4\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      5\u001b[0m     \u001b[0;32mif\u001b[0m \u001b[0mprops\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'point_type'\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mPointType\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mARBITRARY\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+      "\u001b[0;31mNameError\u001b[0m: name 'decode_cadnano_part' is not defined"
      ]
     }
    ],
    "source": [
-    "f,b=read_json_file(\"test.json\")\n"
+    "mrdna_model_from_cadnano(\"test.json\")"
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 52,
-   "id": "1c4cd407",
+   "execution_count": 146,
+   "id": "7a77a10c",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "a,b=np.where(np.array(nts)==1)"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 148,
+   "id": "07bed4f1",
    "metadata": {},
    "outputs": [
     {
      "data": {
       "text/plain": [
-       "Int64Index([0, 1, 2, 3, 4, 5], dtype='int64', name='num')"
+       "array([ 5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,\n",
+       "       22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 39, 40,\n",
+       "       41,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,\n",
+       "       21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 39,\n",
+       "       40, 41,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16,\n",
+       "       17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 39,\n",
+       "       40, 41,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16,\n",
+       "       17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 37,\n",
+       "       38, 39, 40, 41,  0,  1,  2,  3,  9, 10, 11, 12, 13, 14, 15, 16, 17,\n",
+       "       18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,\n",
+       "       35, 36, 37, 38, 39,  0,  1,  2,  3,  9, 10, 11, 12, 13, 14, 15, 16,\n",
+       "       17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,\n",
+       "       34, 35, 36, 37, 38, 39])"
       ]
      },
-     "execution_count": 52,
+     "execution_count": 148,
      "metadata": {},
      "output_type": "execute_result"
     }
    ],
    "source": [
-    "b.index"
+    "nt_prop=pd.DataFrame(index)"
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 83,
-   "id": "b85be77d",
+   "execution_count": 137,
+   "id": "efe96d4a",
    "metadata": {},
    "outputs": [],
    "source": [
-    "def ntcount(scafs):\n",
+    "def nttype(scafs):\n",
     "    def judge(i):\n",
     "        if i ==[-1,-1,-1,-1]:\n",
     "            return 0\n",
     "        else: return 1\n",
     "    n=np.array([judge(i) for i in scafs])\n",
-    "    return np.sum(n)\n",
+    "    return n\n",
     "\n"
    ]
   },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "id": "9ac7ac46",
+   "metadata": {},
+   "outputs": [],
+   "source": []
+  },
   {
    "cell_type": "code",
    "execution_count": 84,
-   "id": "1b2f9268",
+   "id": "a28688b9",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -430,23 +1003,134 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 123,
-   "id": "5042c85d",
+   "execution_count": 156,
+   "id": "7583686f",
    "metadata": {},
-   "outputs": [],
+   "outputs": [
+    {
+     "data": {
+      "text/html": [
+       "<div>\n",
+       "<style scoped>\n",
+       "    .dataframe tbody tr th:only-of-type {\n",
+       "        vertical-align: middle;\n",
+       "    }\n",
+       "\n",
+       "    .dataframe tbody tr th {\n",
+       "        vertical-align: top;\n",
+       "    }\n",
+       "\n",
+       "    .dataframe thead th {\n",
+       "        text-align: right;\n",
+       "    }\n",
+       "</style>\n",
+       "<table border=\"1\" class=\"dataframe\">\n",
+       "  <thead>\n",
+       "    <tr style=\"text-align: right;\">\n",
+       "      <th></th>\n",
+       "      <th></th>\n",
+       "      <th>r</th>\n",
+       "      <th>bp</th>\n",
+       "      <th>stack</th>\n",
+       "      <th>threeprime</th>\n",
+       "      <th>seq</th>\n",
+       "      <th>orientation</th>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>vh</th>\n",
+       "      <th>zid</th>\n",
+       "      <th></th>\n",
+       "      <th></th>\n",
+       "      <th></th>\n",
+       "      <th></th>\n",
+       "      <th></th>\n",
+       "      <th></th>\n",
+       "    </tr>\n",
+       "  </thead>\n",
+       "  <tbody>\n",
+       "    <tr>\n",
+       "      <th>0</th>\n",
+       "      <th>0</th>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>1</th>\n",
+       "      <th>3</th>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>2</th>\n",
+       "      <th>1</th>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>3</th>\n",
+       "      <th>2</th>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>1</th>\n",
+       "      <th>8</th>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "      <td>NaN</td>\n",
+       "    </tr>\n",
+       "  </tbody>\n",
+       "</table>\n",
+       "</div>"
+      ],
+      "text/plain": [
+       "          r   bp stack threeprime  seq orientation\n",
+       "vh zid                                            \n",
+       "0  0    NaN  NaN   NaN        NaN  NaN         NaN\n",
+       "1  3    NaN  NaN   NaN        NaN  NaN         NaN\n",
+       "2  1    NaN  NaN   NaN        NaN  NaN         NaN\n",
+       "3  2    NaN  NaN   NaN        NaN  NaN         NaN\n",
+       "1  8    NaN  NaN   NaN        NaN  NaN         NaN"
+      ]
+     },
+     "execution_count": 156,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
    "source": [
     "i=range(5)\n",
     "col=[\"vh\",\"zid\",\"r\",\"bp\",\"stack\",\"threeprime\",\"seq\",\"orientation\"]\n",
     "d=pd.DataFrame(index=i,columns=col)\n",
     "d['vh']=[0,1,2,3,1]\n",
     "d['zid']=[0,3,1,2,8]\n",
-    "d.set_index([\"vh\",\"zid\"],inplace=True)\n"
+    "d.set_index([\"vh\",\"zid\"],inplace=True)\n",
+    "d"
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 126,
-   "id": "b91c2367",
+   "execution_count": 157,
+   "id": "1b71d3f6",
    "metadata": {},
    "outputs": [
     {
@@ -549,19 +1233,21 @@
        "4   1    8  NaN  NaN   NaN        NaN  NaN         NaN"
       ]
      },
-     "execution_count": 126,
+     "execution_count": 157,
      "metadata": {},
      "output_type": "execute_result"
     }
    ],
    "source": [
-    "d.reset_index()"
+    "\n",
+    "d=d.reset_index()\n",
+    "d"
    ]
   },
   {
    "cell_type": "code",
    "execution_count": 128,
-   "id": "3c1fc0c9",
+   "id": "65e31a02",
    "metadata": {},
    "outputs": [
     {
@@ -583,7 +1269,7 @@
   {
    "cell_type": "code",
    "execution_count": 127,
-   "id": "59833d98",
+   "id": "9e9fe8c1",
    "metadata": {},
    "outputs": [
     {
@@ -703,7 +1389,7 @@
   {
    "cell_type": "code",
    "execution_count": 100,
-   "id": "1139214c",
+   "id": "7a82b9f7",
    "metadata": {},
    "outputs": [
     {
@@ -728,7 +1414,7 @@
   {
    "cell_type": "code",
    "execution_count": 13,
-   "id": "ca81ed00",
+   "id": "759146bc",
    "metadata": {},
    "outputs": [
     {
@@ -749,7 +1435,7 @@
   {
    "cell_type": "code",
    "execution_count": 14,
-   "id": "895861eb",
+   "id": "817cf65c",
    "metadata": {},
    "outputs": [
     {
@@ -771,7 +1457,7 @@
   {
    "cell_type": "code",
    "execution_count": 198,
-   "id": "82bc0749",
+   "id": "683deaa8",
    "metadata": {},
    "outputs": [
     {
@@ -793,7 +1479,7 @@
   {
    "cell_type": "code",
    "execution_count": 15,
-   "id": "1f5791d0",
+   "id": "cf734789",
    "metadata": {},
    "outputs": [
     {
@@ -814,7 +1500,7 @@
   {
    "cell_type": "code",
    "execution_count": 173,
-   "id": "b36dc7e5",
+   "id": "7561d936",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -850,7 +1536,7 @@
   {
    "cell_type": "code",
    "execution_count": 177,
-   "id": "e0f42e86",
+   "id": "2fd676d8",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -886,7 +1572,7 @@
   {
    "cell_type": "code",
    "execution_count": 187,
-   "id": "0ca50f51",
+   "id": "6b288cdc",
    "metadata": {},
    "outputs": [
     {
@@ -1113,7 +1799,7 @@
   {
    "cell_type": "code",
    "execution_count": 142,
-   "id": "6b3a92fd",
+   "id": "c516286a",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -1150,7 +1836,7 @@
   {
    "cell_type": "code",
    "execution_count": 117,
-   "id": "09ac3efa",
+   "id": "461e5389",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -1171,7 +1857,7 @@
   {
    "cell_type": "code",
    "execution_count": 116,
-   "id": "20b8e5fb",
+   "id": "1cfe41f9",
    "metadata": {},
    "outputs": [
     {
@@ -1383,7 +2069,7 @@
   {
    "cell_type": "code",
    "execution_count": 157,
-   "id": "0978d11f",
+   "id": "b1e9c75c",
    "metadata": {},
    "outputs": [
     {
@@ -1407,7 +2093,7 @@
   {
    "cell_type": "code",
    "execution_count": 152,
-   "id": "b9ffc57d",
+   "id": "91717641",
    "metadata": {},
    "outputs": [
     {
@@ -1428,7 +2114,7 @@
   {
    "cell_type": "code",
    "execution_count": 62,
-   "id": "91c8bda1",
+   "id": "c2735ea2",
    "metadata": {},
    "outputs": [
     {
@@ -1656,7 +2342,7 @@
   {
    "cell_type": "code",
    "execution_count": 3,
-   "id": "9d00775e",
+   "id": "21ebd651",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -1782,7 +2468,7 @@
   {
    "cell_type": "code",
    "execution_count": 4,
-   "id": "fe38ddd0",
+   "id": "29d8b2a3",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -1803,7 +2489,7 @@
   {
    "cell_type": "code",
    "execution_count": 20,
-   "id": "47af43f2",
+   "id": "ac70d73d",
    "metadata": {},
    "outputs": [
     {
@@ -1865,7 +2551,7 @@
   {
    "cell_type": "code",
    "execution_count": 25,
-   "id": "92ee5de3",
+   "id": "b531515d",
    "metadata": {},
    "outputs": [
     {
@@ -1927,7 +2613,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "id": "e99ffa71",
+   "id": "f11056d9",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -1940,7 +2626,7 @@
   {
    "cell_type": "code",
    "execution_count": 13,
-   "id": "9f251d5c",
+   "id": "7c724714",
    "metadata": {},
    "outputs": [
     {
@@ -1961,7 +2647,7 @@
   {
    "cell_type": "code",
    "execution_count": 7,
-   "id": "ddff8ccc",
+   "id": "44e3bf14",
    "metadata": {},
    "outputs": [
     {
@@ -2010,7 +2696,7 @@
   {
    "cell_type": "code",
    "execution_count": 36,
-   "id": "9bc201d2",
+   "id": "e0b4e485",
    "metadata": {},
    "outputs": [
     {
@@ -2072,7 +2758,7 @@
   {
    "cell_type": "code",
    "execution_count": 1,
-   "id": "ab8da587",
+   "id": "97c05d36",
    "metadata": {},
    "outputs": [
     {
@@ -2098,7 +2784,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "id": "4141882b",
+   "id": "5818a167",
    "metadata": {},
    "outputs": [],
    "source": []
@@ -2106,7 +2792,7 @@
   {
    "cell_type": "code",
    "execution_count": 3,
-   "id": "ce1031ed",
+   "id": "005b032e",
    "metadata": {},
    "outputs": [
     {
@@ -2126,7 +2812,7 @@
   {
    "cell_type": "code",
    "execution_count": 13,
-   "id": "0f02b96f",
+   "id": "95c7c24d",
    "metadata": {},
    "outputs": [
     {
@@ -2147,7 +2833,7 @@
   {
    "cell_type": "code",
    "execution_count": 15,
-   "id": "eb6d271c",
+   "id": "7bec19b6",
    "metadata": {},
    "outputs": [
     {
@@ -2217,7 +2903,7 @@
   {
    "cell_type": "code",
    "execution_count": 16,
-   "id": "db9fb42a",
+   "id": "289d2009",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -2228,7 +2914,7 @@
   {
    "cell_type": "code",
    "execution_count": 26,
-   "id": "6e28886e",
+   "id": "8ac5cdf9",
    "metadata": {},
    "outputs": [
     {
@@ -2337,7 +3023,7 @@
   {
    "cell_type": "code",
    "execution_count": 25,
-   "id": "8532c958",
+   "id": "f39f61c8",
    "metadata": {},
    "outputs": [
     {
@@ -2358,7 +3044,7 @@
   {
    "cell_type": "code",
    "execution_count": 10,
-   "id": "42c985e8",
+   "id": "a4e2fc7b",
    "metadata": {},
    "outputs": [
     {
@@ -2389,7 +3075,7 @@
   {
    "cell_type": "code",
    "execution_count": 1,
-   "id": "d26babc9",
+   "id": "3a00cb97",
    "metadata": {},
    "outputs": [
     {
@@ -2886,7 +3572,7 @@
   {
    "cell_type": "code",
    "execution_count": 3,
-   "id": "eacb35b4",
+   "id": "8ba9d3ad",
    "metadata": {},
    "outputs": [
     {
@@ -2920,7 +3606,7 @@
   {
    "cell_type": "code",
    "execution_count": 4,
-   "id": "0ff274ec",
+   "id": "9dcaba3d",
    "metadata": {},
    "outputs": [
     {
@@ -2940,7 +3626,7 @@
   {
    "cell_type": "code",
    "execution_count": 5,
-   "id": "cb4b20bc",
+   "id": "5a768b47",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -2950,7 +3636,7 @@
   {
    "cell_type": "code",
    "execution_count": 6,
-   "id": "9694a3bb",
+   "id": "d64d0055",
    "metadata": {},
    "outputs": [
     {
@@ -2971,7 +3657,7 @@
   {
    "cell_type": "code",
    "execution_count": 7,
-   "id": "d8dec327",
+   "id": "c7e397f4",
    "metadata": {},
    "outputs": [
     {
@@ -2998,7 +3684,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "id": "6af9f1ff",
+   "id": "24d5d7e8",
    "metadata": {},
    "outputs": [],
    "source": []