{"action":"created","issue":{"url":"https://api.github.com/repos/daler/gffutils/issues/79","repository_url":"https://api.github.com/repos/daler/gffutils","labels_url":"https://api.github.com/repos/daler/gffutils/issues/79/labels{/name}","comments_url":"https://api.github.com/repos/daler/gffutils/issues/79/comments","events_url":"https://api.github.com/repos/daler/gffutils/issues/79/events","html_url":"https://github.com/daler/gffutils/issues/79","id":171073146,"number":79,"title":"Issues with gffutils.create_db attribute ordering","user":{"login":"cbrueffer","id":2705287,"avatar_url":"https://avatars.githubusercontent.com/u/2705287?v=3","gravatar_id":"","url":"https://api.github.com/users/cbrueffer","html_url":"https://github.com/cbrueffer","followers_url":"https://api.github.com/users/cbrueffer/followers","following_url":"https://api.github.com/users/cbrueffer/following{/other_user}","gists_url":"https://api.github.com/users/cbrueffer/gists{/gist_id}","starred_url":"https://api.github.com/users/cbrueffer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cbrueffer/subscriptions","organizations_url":"https://api.github.com/users/cbrueffer/orgs","repos_url":"https://api.github.com/users/cbrueffer/repos","events_url":"https://api.github.com/users/cbrueffer/events{/privacy}","received_events_url":"https://api.github.com/users/cbrueffer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-08-14T19:03:51Z","updated_at":"2016-08-15T12:45:02Z","closed_at":null,"body":"Hi,\r\n\r\nI'm debugging a problem in the cloudbiolinux (https://github.com/chapmanb/cloudbiolinux/) script scripts/prepare_tx_gff.py. I have created a minimal test case and input GTF in the attached ZIP file. Since I'm not sure whether this should be fixed inside gffutils or in the consumer, I try my luck here first :-)\r\n\r\nI have tested both gffutils 0.8.7.1 as well as the current version from git.\r\n\r\nThe problem is that prepare_tx_gff.py writes a GTF file with attributes that have gene_id and transcript_id shuffled into the middle of the attributes string, instead of beginning with them. The input GTF file (minimal.gtf in the attached archive is the first line of my actual GTF file) however starts the attribute string correctly with gene_id and transcript_id. This, in turn, leads to gtfToGenePred from the UCSC tools erroring out later on.\r\n\r\nThe gffutils DB is created like so:\r\n\r\n```\r\n    gffutils.create_db(gtf, dbfn=db_file,\r\n                       disable_infer_genes=False,\r\n                       disable_infer_transcripts=False,\r\n                       id_spec={\"gene\": \"gene_id\", \"transcript\": \"transcript_id\"},\r\n                       merge_strategy=\"create_unique\",\r\n                       keep_order=True,\r\n                       verbose=True)\r\n```\r\n\r\nIf I read the docs correctly, ```keep_order=True``` should lead to the attributed being stored in exactly the same sequence as they appear in the input file, however this is not the case if you then iterate through the DB:\r\n\r\n```\r\nfor feature in db.all_features():\r\n            out_handle.write(str(feature) + \"\\n\")\r\n```\r\n\r\nThe output lines look like this:\r\n\r\n```\r\nchr1\thg38_knownGene\texon\t11874\t12227\t0\t+\t.\tknownCanonicalChrom \"NA\"; description \"Homo sapiens DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 1 (DDX11L1), non-coding RNA.\"; protAcc; knownCanonicalChromStart \"NA\"; knownToRefSeq \"NR_046018\"; knownIsoformsClusterID \"1\"; gene_id \"uc001aaa.3\"; tss_id \"TSS1\"; alias \"DDX11L1\"; transcript_id \"uc001aaa.3\"; mRNA \"NR_046018\"; knownCanonicalChromEnd \"NA\"; knownCanonicalClusterId \"NA\"; refseq \"NR_046018\"; locusLink \"100287102\"; geneSymbol \"DDX11L1\";\r\nchr1\tgffutils_derived\ttranscript\t11874\t12227\t.\t+\t.\ttranscript_id \"uc001aaa.3\"; gene_id \"uc001aaa.3\";\r\n```\r\n\r\nI should add that the code in the ZIP archive is boiled down from the actual prepare_tx_gff.py in cloudbiolinux.\r\n\r\nAny insight would be appreciated!\r\n\r\n[bugtest.zip](https://github.com/daler/gffutils/files/417193/bugtest.zip)\r\n"},"comment":{"url":"https://api.github.com/repos/daler/gffutils/issues/comments/239793062","html_url":"https://github.com/daler/gffutils/issues/79#issuecomment-239793062","issue_url":"https://api.github.com/repos/daler/gffutils/issues/79","id":239793062,"user":{"login":"roryk","id":414586,"avatar_url":"https://avatars.githubusercontent.com/u/414586?v=3","gravatar_id":"","url":"https://api.github.com/users/roryk","html_url":"https://github.com/roryk","followers_url":"https://api.github.com/users/roryk/followers","following_url":"https://api.github.com/users/roryk/following{/other_user}","gists_url":"https://api.github.com/users/roryk/gists{/gist_id}","starred_url":"https://api.github.com/users/roryk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roryk/subscriptions","organizations_url":"https://api.github.com/users/roryk/orgs","repos_url":"https://api.github.com/users/roryk/repos","events_url":"https://api.github.com/users/roryk/events{/privacy}","received_events_url":"https://api.github.com/users/roryk/received_events","type":"User","site_admin":false},"created_at":"2016-08-15T12:45:02Z","updated_at":"2016-08-15T12:45:02Z","body":"Ohhhhhh, I see. We might have to spit out a cleaned up GTF file then to get that to work."}}
{"actor":{"display_login":"roryk"}}