{"id":20757293,"url":"https://github.com/piebro/plotting-ribbons","last_synced_at":"2026-03-08T21:03:12.200Z","repository":{"id":200619271,"uuid":"317323286","full_name":"piebro/plotting-ribbons","owner":"piebro","description":null,"archived":false,"fork":false,"pushed_at":"2021-01-09T18:13:05.000Z","size":3874,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-18T04:43:33.089Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/piebro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-11-30T19:22:01.000Z","updated_at":"2021-01-09T18:13:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"1a35a5a4-ab07-4f1e-8991-4c19a9979b00","html_url":"https://github.com/piebro/plotting-ribbons","commit_stats":null,"previous_names":["piebro/plotting-ribbons"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piebro%2Fplotting-ribbons","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piebro%2Fplotting-ribbons/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piebro%2Fplotting-ribbons/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piebro%2Fplotting-ribbons/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/piebro","download_url":"https://codeload.github.com/piebro/plotting-ribbons/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243066965,"owners_count":20230837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-17T09:41:21.884Z","updated_at":"2025-12-12T00:02:34.892Z","avatar_url":"https://github.com/piebro.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Plotting Ribbons\n\nAn easy way to use [fogleman/ribbon](https://github.com/fogleman/ribbon) to create ready to plot SVGs like these:\n\n\u003cimg src=\"./examples/1A08.svg\" width=\"800\"\u003e\n\n\u003cimg src=\"./examples/6UFW.svg\" width=\"800\"\u003e\n\n## Create SVGs\n\nInstall [fogleman/ribbon](https://github.com/fogleman/ribbon) and get the source code.\n\n```bash\ngo get -u github.com/fogleman/ribbon/cmd/rcsb\ngit clone git@github.com:fogleman/ribbon.git\n```\n\nRun the lines cmd with `go run ribbon/cmd/lines/main.go` with a 4-digit RCSB Structure ID to print all lines to the console. With the following cmd you can save all 4-digit RCSB Structure IDs in `ids` and as SVGs. You can set IDs for example with `ids=\"1A08 6UFW\"` and run the following cmd to create the SVGs.\n\n```bash\nfor id in $ids; do echo $id; go run ribbon/cmd/lines/main.go $id | python -c \"import sys\npoints = [str(round((float(num)+1)*500*1e6)/1e6) for num in sys.stdin.read()[:-1].replace('\\n',',').replace(';',',').split(',')]\nlines = [points[:4]]\nfor i in range(4,len(points), 4):\n    if lines[-1][-2:] == points[i:i+2]: lines[-1].extend(points[i+2:i+4])\n    else: lines.append(points[i:i+4])\npolyline_strs = ['\u003cpolyline fill=\\\"none\\\" stroke=\\\"#00f\\\" points=\\\"' + ' '.join(line) + '\\\"/\u003e' for line in lines]\nwith open('$id.svg','w') as f: f.write('\\n'.join(['\u003csvg xmlns=\\\"http://www.w3.org/2000/svg\\\" height=\\\"26.45834cm\\\" viewBox=\\\"0 0 1000 1000\\\" width=\\\"26.45834cm\\\"\u003e']+polyline_strs+['\u003c/svg\u003e']))\"; done\n```\n\n## Get RCSB Structure IDs\n\nYou can go to the [Protein Data Bank](http://www.rcsb.org) main page or [search](http://www.rcsb.org/search?q=*) to find a structure.\n\nAll IDs up to the end of 2020 are in `all_ids_01_2021.txt`. Run the following cmd to get all ids in a certain range and save it to ids.\n\n```bash\nids=$(cat all_ids_01_2021.txt | cut -c1-50) # get ids from 1-50 (10*5) get the first 10 ids\necho $ids\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiebro%2Fplotting-ribbons","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpiebro%2Fplotting-ribbons","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiebro%2Fplotting-ribbons/lists"}