Dear all,
I tried to reproduce the python code provided at the link Download datasets - Open Targets Platform Documentation.
from pyspark import SparkConf
from pyspark.sql import SparkSession
import pyspark.sql.functions as F
# path to ClinVar (EVA) evidence dataset
# directory stored on your local machine
evidencePath = "local directory path - e.g. /User/downloads/sourceId=eva"
# establish spark connection
spark = (
SparkSession.builder
.master('local[*]')
.getOrCreate()
)
# read evidence dataset
evd = spark.read.parquet(evidencePath)
# Browse the evidence schema
evd.printSchema()
# select fields of interest
evdSelect = (evd
.select("targetId",
"diseaseId",
"variantRsId",
"studyId",
F.explode("clinicalSignificances").alias("cs"),
"confidence")
)
evdSelect.show()
# Convert to a Pandas Dataframe
evdSelect.toPandas()
However I got the following output
2021-11-28 15:36:34 WARN Utils:66 - Your hostname, mac503381.local resolves to a loopback address: 127.0.0.1; using 192.168.113.132 instead (on interface en1)
2021-11-28 15:36:34 WARN Utils:66 - Set SPARK_LOCAL_IP if you need to bind to another address
2021-11-28 15:36:36 WARN NativeCodeLoader:62 - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Setting default log level to "WARN".
To adjust logging level use sc.setLogLevel(newLevel). For SparkR, use setLogLevel(newLevel).
Py4JJavaError Traceback (most recent call last)
~/opt/anaconda3/envs/my-rdkit-env/lib/python3.7/site-packages/pyspark/sql/utils.py in deco(*a, **kw)
62 try:
---> 63 return f(*a, **kw)
64 except py4j.protocol.Py4JJavaError as e:
~/opt/anaconda3/envs/my-rdkit-env/lib/python3.7/site-packages/py4j/protocol.py in get_return_value(answer, gateway_client, target_id, name)
327 "An error occurred while calling {0}{1}{2}.\n".
--> 328 format(target_id, ".", name), value)
329 else:
Py4JJavaError: An error occurred while calling o27.parquet.
: org.apache.spark.sql.AnalysisException: Path does not exist: file:/Users/arr4007/Documents/Projects/Alex/COVPDB/Scripts/local directory path - e.g. /User/downloads/sourceId=eva;
at org.apache.spark.sql.execution.datasources.DataSource$$anonfun$org$apache$spark$sql$execution$datasources$DataSource$$checkAndGlobPathIfNecessary$1.apply(DataSource.scala:558)
at org.apache.spark.sql.execution.datasources.DataSource$$anonfun$org$apache$spark$sql$execution$datasources$DataSource$$checkAndGlobPathIfNecessary$1.apply(DataSource.scala:545)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
at scala.collection.immutable.List.foreach(List.scala:392)
at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:241)
at scala.collection.immutable.List.flatMap(List.scala:355)
at org.apache.spark.sql.execution.datasources.DataSource.org$apache$spark$sql$execution$datasources$DataSource$$checkAndGlobPathIfNecessary(DataSource.scala:545)
at org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:359)
at org.apache.spark.sql.DataFrameReader.loadV1Source(DataFrameReader.scala:223)
at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:211)
at org.apache.spark.sql.DataFrameReader.parquet(DataFrameReader.scala:643)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)
at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357)
at py4j.Gateway.invoke(Gateway.java:282)
at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
at py4j.commands.CallCommand.execute(CallCommand.java:79)
at py4j.GatewayConnection.run(GatewayConnection.java:238)
at java.lang.Thread.run(Thread.java:748)
During handling of the above exception, another exception occurred:
AnalysisException Traceback (most recent call last)
~/Documents/Projects/Alex/COVPDB/Scripts/Pathology_classificator.py in <module>
63
64 # read evidence dataset
---> 65 evd = spark.read.parquet(evidencePath)
66
67 # Browse the evidence schema
~/opt/anaconda3/envs/my-rdkit-env/lib/python3.7/site-packages/pyspark/sql/readwriter.py in parquet(self, *paths)
314 [('name', 'string'), ('year', 'int'), ('month', 'int'), ('day', 'int')]
315 """
--> 316 return self._df(self._jreader.parquet(_to_seq(self._spark._sc, paths)))
317
318 @ignore_unicode_prefix
~/opt/anaconda3/envs/my-rdkit-env/lib/python3.7/site-packages/py4j/java_gateway.py in __call__(self, *args)
1284 answer = self.gateway_client.send_command(command)
1285 return_value = get_return_value(
-> 1286 answer, self.gateway_client, self.target_id, self.name)
1287
1288 for temp_arg in temp_args:
~/opt/anaconda3/envs/my-rdkit-env/lib/python3.7/site-packages/pyspark/sql/utils.py in deco(*a, **kw)
67 e.java_exception.getStackTrace()))
68 if s.startswith('org.apache.spark.sql.AnalysisException: '):
---> 69 raise AnalysisException(s.split(': ', 1)[1], stackTrace)
70 if s.startswith('org.apache.spark.sql.catalyst.analysis'):
71 raise AnalysisException(s.split(': ', 1)[1], stackTrace)
AnalysisException: 'Path does not exist: file:/Users/arr4007/Documents/Projects/Alex/COVPDB/Scripts/local directory path - e.g. /User/downloads/sourceId=eva;'
any idea what it might be?