{"action":"created","comment":{"url":"https://api.github.com/repos/biocore/scikit-bio/pulls/comments/39776084","id":39776084,"diff_hunk":"@@ -717,6 +707,92 @@ def reindex(self, key=None, keys=None):\n         self._keys = keys_\n \n     @experimental(as_of='0.4.0-dev')\n+    def append(self, sequence, minter=None):\n+        \"\"\"Append a sequence to the MSA.\n+\n+        Parameters\n+        ----------\n+        sequence : alphabet-aware scikit-bio sequence object\n+            Sequence to be appended. Must match the dtype of the MSA and the\n+            length of the second dimension of the MSA.\n+        minter : callable or metadata key, optional\n+            If None, the MSA is checked to see if a previous minter has been\n+            cached. If not, an exception is raised. If a cached key is found\n+            it is used to reindex the MSA.\n+\n+        Raises\n+        ------\n+        TypeError\n+            If the sequence object is a type that doesn't have an alphabet\n+        TypeError\n+            If the type of the sequence does not match the dtype of the MSA.\n+        ValueError\n+            If the length of the sequence does not match the number of\n+            positions in the MSA.\n+        OperationError\n+            If no key is provided, but the MSA has keys, and no cached key\n+            is found.\n+\n+        See Also\n+        --------\n+        reindex\n+\n+        Notes\n+        -----\n+        The MSA is not automatically re-aligned when a sequence is appended.\n+        Therefore, this operation is not necessarily meaningful on its own.\n+\n+        Examples\n+        --------\n+        >>> from skbio import DNA, TabularMSA\n+        >>> msa = TabularMSA([DNA('')])\n+        >>> msa.append(DNA(''))\n+        >>> msa == TabularMSA([DNA(''), DNA('')])\n+        True\n+\n+        >>> msa = TabularMSA([DNA('', metadata={'id': 'a'})], minter='id')\n+        >>> msa.append(DNA('', metadata={'id': 'b'}), minter='id')\n+        >>> msa == TabularMSA([DNA('', metadata={'id': 'a'}),\n+        ...                    DNA('', metadata={'id': 'b'})], minter='id')\n+        True\n+        \"\"\"\n+        if minter is None:\n+            if self.has_keys():\n+                minter = self.minter\n+        else:\n+            if not self.has_keys():\n+                raise OperationError(\n+                    \"key was provided but MSA does not have keys.\")\n+\n+        self._add_sequence(sequence)\n+        self.reindex(minter=minter)\n+\n+    def _add_sequence(self, sequence):\n+        msa_is_empty = not len(self)\n+        if msa_is_empty:\n+            dtype = type(sequence)\n+            if not issubclass(dtype, IUPACSequence):\n+                raise TypeError(\n+                    \"`sequence` must be a scikit-bio sequence object \"\n+                    \"that has an alphabet, not type %r\" % dtype.__name__)\n+            self._dtype = dtype\n+            self._shape = _Shape(sequence=1, position=len(sequence))\n+            self._seqs = [sequence]\n+        elif type(sequence) is not self.dtype:","path":"skbio/alignment/_tabular_msa.py","position":243,"original_position":243,"commit_id":"5f68a5e8d31e684cbab2c6760b1dd389b22c2aa6","original_commit_id":"5f68a5e8d31e684cbab2c6760b1dd389b22c2aa6","user":{"login":"anderspitman","id":7820200,"avatar_url":"https://avatars.githubusercontent.com/u/7820200?v=3","gravatar_id":"","url":"https://api.github.com/users/anderspitman","html_url":"https://github.com/anderspitman","followers_url":"https://api.github.com/users/anderspitman/followers","following_url":"https://api.github.com/users/anderspitman/following{/other_user}","gists_url":"https://api.github.com/users/anderspitman/gists{/gist_id}","starred_url":"https://api.github.com/users/anderspitman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anderspitman/subscriptions","organizations_url":"https://api.github.com/users/anderspitman/orgs","repos_url":"https://api.github.com/users/anderspitman/repos","events_url":"https://api.github.com/users/anderspitman/events{/privacy}","received_events_url":"https://api.github.com/users/anderspitman/received_events","type":"User","site_admin":false},"body":"Modified my previous comment. I changed the original code more than I had remembered, so there's a good chance it's not as optimal as before. Probably would be a good idea to get a second opinion.","created_at":"2015-09-17T17:47:38Z","updated_at":"2015-09-17T17:47:38Z","html_url":"https://github.com/biocore/scikit-bio/pull/1121#discussion_r39776084","pull_request_url":"https://api.github.com/repos/biocore/scikit-bio/pulls/1121","_links":{"self":{"href":"https://api.github.com/repos/biocore/scikit-bio/pulls/comments/39776084"},"html":{"href":"https://github.com/biocore/scikit-bio/pull/1121#discussion_r39776084"},"pull_request":{"href":"https://api.github.com/repos/biocore/scikit-bio/pulls/1121"}}},"pull_request":{"url":"https://api.github.com/repos/biocore/scikit-bio/pulls/1121","id":44749348,"html_url":"https://github.com/biocore/scikit-bio/pull/1121","diff_url":"https://github.com/biocore/scikit-bio/pull/1121.diff","patch_url":"https://github.com/biocore/scikit-bio/pull/1121.patch","issue_url":"https://api.github.com/repos/biocore/scikit-bio/issues/1121","number":1121,"state":"open","locked":false,"title":"Implement TabularMSA.append","user":{"login":"anderspitman","id":7820200,"avatar_url":"https://avatars.githubusercontent.com/u/7820200?v=3","gravatar_id":"","url":"https://api.github.com/users/anderspitman","html_url":"https://github.com/anderspitman","followers_url":"https://api.github.com/users/anderspitman/followers","following_url":"https://api.github.com/users/anderspitman/following{/other_user}","gists_url":"https://api.github.com/users/anderspitman/gists{/gist_id}","starred_url":"https://api.github.com/users/anderspitman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anderspitman/subscriptions","organizations_url":"https://api.github.com/users/anderspitman/orgs","repos_url":"https://api.github.com/users/anderspitman/repos","events_url":"https://api.github.com/users/anderspitman/events{/privacy}","received_events_url":"https://api.github.com/users/anderspitman/received_events","type":"User","site_admin":false},"body":"Closes #1098 ","created_at":"2015-09-11T06:08:27Z","updated_at":"2015-09-17T17:47:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ed26dbb7ddafb55853c0cfd3c8123a1ea34a4a2c","assignee":{"login":"jairideout","id":1847232,"avatar_url":"https://avatars.githubusercontent.com/u/1847232?v=3","gravatar_id":"","url":"https://api.github.com/users/jairideout","html_url":"https://github.com/jairideout","followers_url":"https://api.github.com/users/jairideout/followers","following_url":"https://api.github.com/users/jairideout/following{/other_user}","gists_url":"https://api.github.com/users/jairideout/gists{/gist_id}","starred_url":"https://api.github.com/users/jairideout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jairideout/subscriptions","organizations_url":"https://api.github.com/users/jairideout/orgs","repos_url":"https://api.github.com/users/jairideout/repos","events_url":"https://api.github.com/users/jairideout/events{/privacy}","received_events_url":"https://api.github.com/users/jairideout/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/biocore/scikit-bio/milestones/12","html_url":"https://github.com/biocore/scikit-bio/milestones/RFC%201:%20tabular-msa","labels_url":"https://api.github.com/repos/biocore/scikit-bio/milestones/12/labels","id":1278267,"number":12,"title":"RFC 1: tabular-msa","description":"RFC:\r\nhttps://github.com/biocore/scikit-bio-rfcs/blob/master/active/001-tabular-msa.md\r\n\r\nPrior discussion:\r\nhttps://github.com/biocore/scikit-bio-rfcs/pull/1","creator":{"login":"ebolyen","id":3976804,"avatar_url":"https://avatars.githubusercontent.com/u/3976804?v=3","gravatar_id":"","url":"https://api.github.com/users/ebolyen","html_url":"https://github.com/ebolyen","followers_url":"https://api.github.com/users/ebolyen/followers","following_url":"https://api.github.com/users/ebolyen/following{/other_user}","gists_url":"https://api.github.com/users/ebolyen/gists{/gist_id}","starred_url":"https://api.github.com/users/ebolyen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ebolyen/subscriptions","organizations_url":"https://api.github.com/users/ebolyen/orgs","repos_url":"https://api.github.com/users/ebolyen/repos","events_url":"https://api.github.com/users/ebolyen/events{/privacy}","received_events_url":"https://api.github.com/users/ebolyen/received_events","type":"User","site_admin":false},"open_issues":16,"closed_issues":13,"state":"open","created_at":"2015-08-28T20:36:38Z","updated_at":"2015-09-15T20:29:40Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/biocore/scikit-bio/pulls/1121/commits","review_comments_url":"https://api.github.com/repos/biocore/scikit-bio/pulls/1121/comments","review_comment_url":"https://api.github.com/repos/biocore/scikit-bio/pulls/comments{/number}","comments_url":"https://api.github.com/repos/biocore/scikit-bio/issues/1121/comments","statuses_url":"https://api.github.com/repos/biocore/scikit-bio/statuses/5f68a5e8d31e684cbab2c6760b1dd389b22c2aa6","head":{"label":"anderspitman:tabular_msa_append","ref":"tabular_msa_append","sha":"5f68a5e8d31e684cbab2c6760b1dd389b22c2aa6","user":{"login":"anderspitman","id":7820200,"avatar_url":"https://avatars.githubusercontent.com/u/7820200?v=3","gravatar_id":"","url":"https://api.github.com/users/anderspitman","html_url":"https://github.com/anderspitman","followers_url":"https://api.github.com/users/anderspitman/followers","following_url":"https://api.github.com/users/anderspitman/following{/other_user}","gists_url":"https://api.github.com/users/anderspitman/gists{/gist_id}","starred_url":"https://api.github.com/users/anderspitman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anderspitman/subscriptions","organizations_url":"https://api.github.com/users/anderspitman/orgs","repos_url":"https://api.github.com/users/anderspitman/repos","events_url":"https://api.github.com/users/anderspitman/events{/privacy}","received_events_url":"https://api.github.com/users/anderspitman/received_events","type":"User","site_admin":false},"repo":{"id":28160892,"name":"scikit-bio","full_name":"anderspitman/scikit-bio","owner":{"login":"anderspitman","id":7820200,"avatar_url":"https://avatars.githubusercontent.com/u/7820200?v=3","gravatar_id":"","url":"https://api.github.com/users/anderspitman","html_url":"https://github.com/anderspitman","followers_url":"https://api.github.com/users/anderspitman/followers","following_url":"https://api.github.com/users/anderspitman/following{/other_user}","gists_url":"https://api.github.com/users/anderspitman/gists{/gist_id}","starred_url":"https://api.github.com/users/anderspitman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anderspitman/subscriptions","organizations_url":"https://api.github.com/users/anderspitman/orgs","repos_url":"https://api.github.com/users/anderspitman/repos","events_url":"https://api.github.com/users/anderspitman/events{/privacy}","received_events_url":"https://api.github.com/users/anderspitman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/anderspitman/scikit-bio","description":"Core objects, functions and statistics for working with biological data in Python.","fork":true,"url":"https://api.github.com/repos/anderspitman/scikit-bio","forks_url":"https://api.github.com/repos/anderspitman/scikit-bio/forks","keys_url":"https://api.github.com/repos/anderspitman/scikit-bio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/anderspitman/scikit-bio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/anderspitman/scikit-bio/teams","hooks_url":"https://api.github.com/repos/anderspitman/scikit-bio/hooks","issue_events_url":"https://api.github.com/repos/anderspitman/scikit-bio/issues/events{/number}","events_url":"https://api.github.com/repos/anderspitman/scikit-bio/events","assignees_url":"https://api.github.com/repos/anderspitman/scikit-bio/assignees{/user}","branches_url":"https://api.github.com/repos/anderspitman/scikit-bio/branches{/branch}","tags_url":"https://api.github.com/repos/anderspitman/scikit-bio/tags","blobs_url":"https://api.github.com/repos/anderspitman/scikit-bio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/anderspitman/scikit-bio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/anderspitman/scikit-bio/git/refs{/sha}","trees_url":"https://api.github.com/repos/anderspitman/scikit-bio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/anderspitman/scikit-bio/statuses/{sha}","languages_url":"https://api.github.com/repos/anderspitman/scikit-bio/languages","stargazers_url":"https://api.github.com/repos/anderspitman/scikit-bio/stargazers","contributors_url":"https://api.github.com/repos/anderspitman/scikit-bio/contributors","subscribers_url":"https://api.github.com/repos/anderspitman/scikit-bio/subscribers","subscription_url":"https://api.github.com/repos/anderspitman/scikit-bio/subscription","commits_url":"https://api.github.com/repos/anderspitman/scikit-bio/commits{/sha}","git_commits_url":"https://api.github.com/repos/anderspitman/scikit-bio/git/commits{/sha}","comments_url":"https://api.github.com/repos/anderspitman/scikit-bio/comments{/number}","issue_comment_url":"https://api.github.com/repos/anderspitman/scikit-bio/issues/comments{/number}","contents_url":"https://api.github.com/repos/anderspitman/scikit-bio/contents/{+path}","compare_url":"https://api.github.com/repos/anderspitman/scikit-bio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/anderspitman/scikit-bio/merges","archive_url":"https://api.github.com/repos/anderspitman/scikit-bio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/anderspitman/scikit-bio/downloads","issues_url":"https://api.github.com/repos/anderspitman/scikit-bio/issues{/number}","pulls_url":"https://api.github.com/repos/anderspitman/scikit-bio/pulls{/number}","milestones_url":"https://api.github.com/repos/anderspitman/scikit-bio/milestones{/number}","notifications_url":"https://api.github.com/repos/anderspitman/scikit-bio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/anderspitman/scikit-bio/labels{/name}","releases_url":"https://api.github.com/repos/anderspitman/scikit-bio/releases{/id}","created_at":"2014-12-17T23:59:49Z","updated_at":"2015-03-13T00:43:46Z","pushed_at":"2015-09-17T17:38:53Z","git_url":"git://github.com/anderspitman/scikit-bio.git","ssh_url":"git@github.com:anderspitman/scikit-bio.git","clone_url":"https://github.com/anderspitman/scikit-bio.git","svn_url":"https://github.com/anderspitman/scikit-bio","homepage":"http://scikit-bio.org","size":37743,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"biocore:master","ref":"master","sha":"4db769f5c40c8ff1e51d4086b6cd82e0ac7848de","user":{"login":"biocore","id":6241857,"avatar_url":"https://avatars.githubusercontent.com/u/6241857?v=3","gravatar_id":"","url":"https://api.github.com/users/biocore","html_url":"https://github.com/biocore","followers_url":"https://api.github.com/users/biocore/followers","following_url":"https://api.github.com/users/biocore/following{/other_user}","gists_url":"https://api.github.com/users/biocore/gists{/gist_id}","starred_url":"https://api.github.com/users/biocore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/biocore/subscriptions","organizations_url":"https://api.github.com/users/biocore/orgs","repos_url":"https://api.github.com/users/biocore/repos","events_url":"https://api.github.com/users/biocore/events{/privacy}","received_events_url":"https://api.github.com/users/biocore/received_events","type":"Organization","site_admin":false},"repo":{"id":15168264,"name":"scikit-bio","full_name":"biocore/scikit-bio","owner":{"login":"biocore","id":6241857,"avatar_url":"https://avatars.githubusercontent.com/u/6241857?v=3","gravatar_id":"","url":"https://api.github.com/users/biocore","html_url":"https://github.com/biocore","followers_url":"https://api.github.com/users/biocore/followers","following_url":"https://api.github.com/users/biocore/following{/other_user}","gists_url":"https://api.github.com/users/biocore/gists{/gist_id}","starred_url":"https://api.github.com/users/biocore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/biocore/subscriptions","organizations_url":"https://api.github.com/users/biocore/orgs","repos_url":"https://api.github.com/users/biocore/repos","events_url":"https://api.github.com/users/biocore/events{/privacy}","received_events_url":"https://api.github.com/users/biocore/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/biocore/scikit-bio","description":"scikit-bio is an open-source, BSD-licensed, Python package providing data structures, algorithms, and educational resources for bioinformatics.","fork":false,"url":"https://api.github.com/repos/biocore/scikit-bio","forks_url":"https://api.github.com/repos/biocore/scikit-bio/forks","keys_url":"https://api.github.com/repos/biocore/scikit-bio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/biocore/scikit-bio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/biocore/scikit-bio/teams","hooks_url":"https://api.github.com/repos/biocore/scikit-bio/hooks","issue_events_url":"https://api.github.com/repos/biocore/scikit-bio/issues/events{/number}","events_url":"https://api.github.com/repos/biocore/scikit-bio/events","assignees_url":"https://api.github.com/repos/biocore/scikit-bio/assignees{/user}","branches_url":"https://api.github.com/repos/biocore/scikit-bio/branches{/branch}","tags_url":"https://api.github.com/repos/biocore/scikit-bio/tags","blobs_url":"https://api.github.com/repos/biocore/scikit-bio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/biocore/scikit-bio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/biocore/scikit-bio/git/refs{/sha}","trees_url":"https://api.github.com/repos/biocore/scikit-bio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/biocore/scikit-bio/statuses/{sha}","languages_url":"https://api.github.com/repos/biocore/scikit-bio/languages","stargazers_url":"https://api.github.com/repos/biocore/scikit-bio/stargazers","contributors_url":"https://api.github.com/repos/biocore/scikit-bio/contributors","subscribers_url":"https://api.github.com/repos/biocore/scikit-bio/subscribers","subscription_url":"https://api.github.com/repos/biocore/scikit-bio/subscription","commits_url":"https://api.github.com/repos/biocore/scikit-bio/commits{/sha}","git_commits_url":"https://api.github.com/repos/biocore/scikit-bio/git/commits{/sha}","comments_url":"https://api.github.com/repos/biocore/scikit-bio/comments{/number}","issue_comment_url":"https://api.github.com/repos/biocore/scikit-bio/issues/comments{/number}","contents_url":"https://api.github.com/repos/biocore/scikit-bio/contents/{+path}","compare_url":"https://api.github.com/repos/biocore/scikit-bio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/biocore/scikit-bio/merges","archive_url":"https://api.github.com/repos/biocore/scikit-bio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/biocore/scikit-bio/downloads","issues_url":"https://api.github.com/repos/biocore/scikit-bio/issues{/number}","pulls_url":"https://api.github.com/repos/biocore/scikit-bio/pulls{/number}","milestones_url":"https://api.github.com/repos/biocore/scikit-bio/milestones{/number}","notifications_url":"https://api.github.com/repos/biocore/scikit-bio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/biocore/scikit-bio/labels{/name}","releases_url":"https://api.github.com/repos/biocore/scikit-bio/releases{/id}","created_at":"2013-12-13T16:24:41Z","updated_at":"2015-09-13T09:13:52Z","pushed_at":"2015-09-17T17:38:53Z","git_url":"git://github.com/biocore/scikit-bio.git","ssh_url":"git@github.com:biocore/scikit-bio.git","clone_url":"https://github.com/biocore/scikit-bio.git","svn_url":"https://github.com/biocore/scikit-bio","homepage":"http://scikit-bio.org","size":42002,"stargazers_count":156,"watchers_count":156,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":87,"mirror_url":null,"open_issues_count":160,"forks":87,"open_issues":160,"watchers":156,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/biocore/scikit-bio/pulls/1121"},"html":{"href":"https://github.com/biocore/scikit-bio/pull/1121"},"issue":{"href":"https://api.github.com/repos/biocore/scikit-bio/issues/1121"},"comments":{"href":"https://api.github.com/repos/biocore/scikit-bio/issues/1121/comments"},"review_comments":{"href":"https://api.github.com/repos/biocore/scikit-bio/pulls/1121/comments"},"review_comment":{"href":"https://api.github.com/repos/biocore/scikit-bio/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/biocore/scikit-bio/pulls/1121/commits"},"statuses":{"href":"https://api.github.com/repos/biocore/scikit-bio/statuses/5f68a5e8d31e684cbab2c6760b1dd389b22c2aa6"}}}}