-
Notifications
You must be signed in to change notification settings - Fork 0
/
examples.html
240 lines (177 loc) · 11.9 KB
/
examples.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
---
layout: page
---
<div id="main" class="alt">
<section>
<div class="inner">
<header class="major">
<h1>Dataframes provided by RCSB PDB</h1>
</header>
<p class="lead">Perform data analytics on RCSB PDB data using <a href="http://spark.apache.org/">Apache Spark</a>, <a href="http://pandas.pydata.org/">Python Pandas</a>, and other tools.</p>
<p> The data is currently provided as <a href="https://parquet.apache.org/">Parquet</a> or <a href="https://cwiki.apache.org/confluence/display/Hive/LanguageManual+ORC">ORC</a> files.</p>
<p> The directory level listing of all data can be found here:
</p><ul>
<li><a href="http://dataframes.rcsb.org/parquet">Parquet files</a></li>
<li><a href="http://dataframes.rcsb.org/orc">ORC files</a></li>
<li><a href="http://dataframes.rcsb.org/csv">CSV files</a></li>
</ul>
<p></p>
<p>
<img src="https://img.shields.io/badge/status-experimental-red.svg"/>
<a href="mailto:[email protected]" type="button" class="btn btn-xs btn-info">Contact</a>
</p>
</div>
</section>
<section id="links" class="tiles">
<article>
<span class="image">
<img src="images/pic01.jpg" alt="" />
</span>
<header class="major">
<h3><a href="https://github.com/biodataframes/examples-java" class="link">Examples: Java</a></h3>
<p>Examples using Java and Apache Spark</p>
</header>
</article>
<article>
<span class="image">
<img src="images/pic02.jpg" alt="" />
</span>
<header class="major">
<h3><a href="examples.html" class="link">Examples: Python</a></h3>
<p>Still missing: examples using Python / Pandas</p>
</header>
</article>
<article>
<span class="image">
<img src="images/pic03.jpg" alt="" />
</span>
<header class="major">
<h3><a href="examples.html" class="link">Examples: R</a></h3>
<p>Still missing: examples using R</p>
</header>
</article>
<article>
<span class="image">
<img src="images/pic04.jpg" alt="" />
</span>
<header class="major">
<h3><a href="examples.html" class="link">Examples: Jupyter Notebooks</a></h3>
<p>Still missing: examples using Jupyter notebooks</p>
</header>
</article>
</section>
<section>
<div class="inner">
<header class="major">
<h2>Currently available data:</h2>
</header>
<ul>
<li>
Residue level mapping of PDB to UniProt.
</li>
</ul>
<div>
<p>Download via </p>
<blockquote>wget -r -l1 --reject "index.html*" http://dataframes.rcsb.org/parquet/uniprotpdb/20160517/</blockquote>
</div>
<ul>
<li>Nucleotide level mapping of human genome to UniProt residues.</li>
</ul>
<div class="panel-body">
<p>We are currently providing mappings both for assemblies 37 and 38 on a per-chromosome level. Download via e.g</p>
<blockquote>wget -r -l1 --reject "index.html*" http://dataframes.rcsb.org/parquet/humangenome/20160517/hg38/chr11 </blockquote>
</div>
</div>
</section>
<section>
<div class="inner">
<header class="major">
<h2>Howto: Mapping from human genome to PDB</h2>
</header>
This example uses <a href="http://spark.apache.org/">Apache Spark</a> and Java to reproduce the mapping of a SNP that causes sickle cell anemia.
<p>See also <a href="http://www.rcsb.org/pdb/chromosome.do?v=hg38&chromosome=11&pos=5227002">RCSB PDB user interface</a> for comparison.</p>
<pre><code>
//toplevel folder where wget wrote the data to
String localDir = "/Users/andreas/WORK/dataframes.rcsb.org";
// assumes the human genetic data is available as a parquet file
// also needs the uniprot-PDB mapping parquet file
int cores = Runtime.getRuntime().availableProcessors();
SparkConf conf = new SparkConf()
.setMaster("local[" + cores + "]")
.setAppName("map SNP to PDB");
JavaSparkContext sc = new JavaSparkContext(conf);
SQLContext sqlContext = SparkUtils.getSqlContext(sc);
// register the UniProt to PDB mapping
DataFrame uniprotPDB = sqlContext.read().parquet(localDir+"/parquet/uniprotpdb/20160517");
uniprotPDB.registerTempTable("uniprotPDB");
System.out.println("Example row from PDB to UniProt mapping:");
uniprotPDB.show(1);
</code> </pre>
<p> This provides the following output:</p><p>
</p><pre><code>
Example row from PDB to UniProt mapping:
+-------+-------+----------+-----+---------+----------+
|chainId|insCode|pdbAtomPos|pdbId|uniProtId|uniProtPos|
+-------+-------+----------+-----+---------+----------+
| A| null| 0| 101M| P02185| 1|
+-------+-------+----------+-----+---------+----------+
only showing top 1 row
</code></pre>
<p> Now let's load the mapping from the human genome (assembly 38) to UniProt and let's look at a SNP.</p>
<pre><code>
DataFrame chr11 = sqlContext.read().parquet(localDir+"//parquet/humangenome/20160517/hg38/chr11");
chr11.registerTempTable("chr11");
DataFrame sickeCellSNP = sqlContext.sql("select * from chr11 where position = 5227002");
System.out.println("human genome mapping to UniProt for SNP:");
sickeCellSNP.show();
</code></pre>
<p>This displays the following information for one nucleotide mapped to UniProt, while considering the correct UniProt isoforms (and mapping to the canonical isoform)</p>
human genome mapping to UniProt for SNP:
<pre><code>
human genome mapping to UniProt for SNP:
+---+--------------+-------+--------+----------+--------+-----+--------------------------+---------+-----------+-----+--------+---------+----------+
|cds|chromosomeName|exonNum|geneName|geneSymbol|inCoding|inUtr|isoformCorrectedUniprotPos|isoformNr|orientation|phase|position|uniProtId|uniProtPos|
+---+--------------+-------+--------+----------+--------+-----+--------------------------+---------+-----------+-----+--------+---------+----------+
| 20| chr11| 3| HBB| HBB| false|false| 7| 0| -| 1| 5227002| P68871| 7|
+---+--------------+-------+--------+----------+--------+-----+--------------------------+---------+-----------+-----+--------+---------+----------+
</code></pre>
<p> Now let's map this position to PDB</p>
<pre><code>
sickeCellSNP.registerTempTable("snp");
// join genomic info with UniProt to PDB mapping
DataFrame map2PDB = sqlContext.sql("select * from snp left join uniprotPDB where snp.uniProtId = uniprotPDB.uniProtId and snp.uniProtPos = uniprotPDB.uniProtPos ");
System.out.println("All PDB entries that map to this SNP");
map2PDB.show();
</code></pre>
<p>This gives the following mapping to PDB (note that there are many hemoglobins in PDB, as such many PDB entries can get mapped to the SNP)</p>
<pre> <code>
All PDB entries that map to this SNP
+---+--------------+-------+--------+----------+--------+-----+--------------------------+---------+-----------+-----+--------+---------+----------+-------+-------+----------+-----+---------+----------+
|cds|chromosomeName|exonNum|geneName|geneSymbol|inCoding|inUtr|isoformCorrectedUniprotPos|isoformNr|orientation|phase|position|uniProtId|uniProtPos|chainId|insCode|pdbAtomPos|pdbId|uniProtId|uniProtPos|
+---+--------------+-------+--------+----------+--------+-----+--------------------------+---------+-----------+-----+--------+---------+----------+-------+-------+----------+-----+---------+----------+
| 20| chr11| 3| HBB| HBB| false|false| 7| 0| -| 1| 5227002| P68871| 7| B| null| 6| 1A00| P68871| 7|
| 20| chr11| 3| HBB| HBB| false|false| 7| 0| -| 1| 5227002| P68871| 7| D| null| 6| 1A00| P68871| 7|
| 20| chr11| 3| HBB| HBB| false|false| 7| 0| -| 1| 5227002| P68871| 7| B| null| 6| 1A01| P68871| 7|
| 20| chr11| 3| HBB| HBB| false|false| 7| 0| -| 1| 5227002| P68871| 7| D| null| 6| 1A01| P68871| 7|
| 20| chr11| 3| HBB| HBB| false|false| 7| 0| -| 1| 5227002| P68871| 7| B| null| 6| 1A0U| P68871| 7|
| 20| chr11| 3| HBB| HBB| false|false| 7| 0| -| 1| 5227002| P68871| 7| D| null| 6| 1A0U| P68871| 7|
| 20| chr11| 3| HBB| HBB| false|false| 7| 0| -| 1| 5227002| P68871| 7| B| null| 6| 1A0Z| P68871| 7|
| 20| chr11| 3| HBB| HBB| false|false| 7| 0| -| 1| 5227002| P68871| 7| D| null| 6| 1A0Z| P68871| 7|
| 20| chr11| 3| HBB| HBB| false|false| 7| 0| -| 1| 5227002| P68871| 7| B| null| 6| 1A3N| P68871| 7|
| 20| chr11| 3| HBB| HBB| false|false| 7| 0| -| 1| 5227002| P68871| 7| D| null| 6| 1A3N| P68871| 7|
| 20| chr11| 3| HBB| HBB| false|false| 7| 0| -| 1| 5227002| P68871| 7| B| null| 6| 1A3O| P68871| 7|
| 20| chr11| 3| HBB| HBB| false|false| 7| 0| -| 1| 5227002| P68871| 7| D| null| 6| 1A3O| P68871| 7|
| 20| chr11| 3| HBB| HBB| false|false| 7| 0| -| 1| 5227002| P68871| 7| B| null| 6| 1ABW| P68871| 7|
| 20| chr11| 3| HBB| HBB| false|false| 7| 0| -| 1| 5227002| P68871| 7| D| null| 6| 1ABW| P68871| 7|
| 20| chr11| 3| HBB| HBB| false|false| 7| 0| -| 1| 5227002| P68871| 7| B| null| 6| 1ABY| P68871| 7|
| 20| chr11| 3| HBB| HBB| false|false| 7| 0| -| 1| 5227002| P68871| 7| D| null| 6| 1ABY| P68871| 7|
| 20| chr11| 3| HBB| HBB| false|false| 7| 0| -| 1| 5227002| P68871| 7| B| null| 6| 1AJ9| P68871| 7|
| 20| chr11| 3| HBB| HBB| false|false| 7| 0| -| 1| 5227002| P68871| 7| B| null| 149| 1B86| P68871| 7|
| 20| chr11| 3| HBB| HBB| false|false| 7| 0| -| 1| 5227002| P68871| 7| D| null| 549| 1B86| P68871| 7|
| 20| chr11| 3| HBB| HBB| false|false| 7| 0| -| 1| 5227002| P68871| 7| B| null| 6| 1BAB| P68871| 7|
+---+--------------+-------+--------+----------+--------+-----+--------------------------+---------+-----------+-----+--------+---------+----------+-------+-------+----------+-----+---------+----------+
only showing top 20 rows
</code></pre>
</div>
</section>
</div> <!-- end of examples -->