git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
5f201ab
)
JAL-2344 use ".cif" for saved mmCIF file (and refactor fetch as file)
author
gmungoc
<g.m.carstairs@dundee.ac.uk>
Wed, 30 Nov 2016 12:38:29 +0000
(12:38 +0000)
committer
gmungoc
<g.m.carstairs@dundee.ac.uk>
Wed, 30 Nov 2016 12:38:29 +0000
(12:38 +0000)
src/MCview/PDBViewer.java
patch
|
blob
|
history
src/jalview/datamodel/PDBEntry.java
patch
|
blob
|
history
src/jalview/ws/dbsources/EmblXmlSource.java
patch
|
blob
|
history
src/jalview/ws/dbsources/Pdb.java
patch
|
blob
|
history
src/jalview/ws/dbsources/Uniprot.java
patch
|
blob
|
history
src/jalview/ws/ebi/EBIFetchClient.java
patch
|
blob
|
history
diff --git
a/src/MCview/PDBViewer.java
b/src/MCview/PDBViewer.java
index
40edc73
..
f108fc2
100755
(executable)
--- a/
src/MCview/PDBViewer.java
+++ b/
src/MCview/PDBViewer.java
@@
-151,7
+151,7
@@
public class PDBViewer extends JInternalFrame implements Runnable
{
EBIFetchClient ebi = new EBIFetchClient();
String query = "pdb:" + pdbentry.getId();
{
EBIFetchClient ebi = new EBIFetchClient();
String query = "pdb:" + pdbentry.getId();
- pdbentry.setFile(ebi.fetchDataAsFile(query, "default", ".xml")
+ pdbentry.setFile(ebi.fetchDataAsFile(query, "default", "xml")
.getAbsolutePath());
if (pdbentry.getFile() != null)
.getAbsolutePath());
if (pdbentry.getFile() != null)
diff --git
a/src/jalview/datamodel/PDBEntry.java
b/src/jalview/datamodel/PDBEntry.java
index
97fb08d
..
8debacf
100755
(executable)
--- a/
src/jalview/datamodel/PDBEntry.java
+++ b/
src/jalview/datamodel/PDBEntry.java
@@
-46,11
+46,21
@@
public class PDBEntry
public enum Type
{
public enum Type
{
- // TODO is FILE needed; if not is this needed or can we
+ // TODO is FILE needed; if not is this enum needed, or can we
// use FileFormatI for PDB, MMCIF?
// use FileFormatI for PDB, MMCIF?
- PDB("pdb", "xml"), MMCIF("mmcif", "mmcif"), FILE("?", "?");
+ PDB("pdb", "pdb"), MMCIF("mmcif", "cif"), FILE("?", "?");
+
+ /*
+ * file extension for cached structure file; must be one that
+ * is recognised by Chimera 'open' command
+ * @see https://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/filetypes.html
+ */
String ext;
String ext;
+ /*
+ * format specifier used in dbfetch request
+ * @see http://www.ebi.ac.uk/Tools/dbfetch/dbfetch/dbfetch.databases#pdb
+ */
String format;
private Type(String fmt, String ex)
String format;
private Type(String fmt, String ex)
diff --git
a/src/jalview/ws/dbsources/EmblXmlSource.java
b/src/jalview/ws/dbsources/EmblXmlSource.java
index
b139574
..
b2fb808
100644
(file)
--- a/
src/jalview/ws/dbsources/EmblXmlSource.java
+++ b/
src/jalview/ws/dbsources/EmblXmlSource.java
@@
-64,7
+64,7
@@
public abstract class EmblXmlSource extends EbiFileRetrievedProxy
{
reply = dbFetch.fetchDataAsFile(
emprefx.toLowerCase() + ":" + query.trim(), "display=xml",
{
reply = dbFetch.fetchDataAsFile(
emprefx.toLowerCase() + ":" + query.trim(), "display=xml",
- ".xml");
+ "xml");
} catch (Exception e)
{
stopQuery();
} catch (Exception e)
{
stopQuery();
diff --git
a/src/jalview/ws/dbsources/Pdb.java
b/src/jalview/ws/dbsources/Pdb.java
index
68dda88
..
982c399
100644
(file)
--- a/
src/jalview/ws/dbsources/Pdb.java
+++ b/
src/jalview/ws/dbsources/Pdb.java
@@
-38,6
+38,7
@@
import jalview.structure.StructureImportSettings;
import jalview.util.MessageManager;
import jalview.ws.ebi.EBIFetchClient;
import jalview.util.MessageManager;
import jalview.ws.ebi.EBIFetchClient;
+import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.ArrayList;
import java.util.List;
@@
-141,12
+142,19
@@
public class Pdb extends EbiFileRetrievedProxy
stopQuery();
return null;
}
stopQuery();
return null;
}
+
+ /*
+ * ensure that an mmCIF format structure file is saved with extension.cif,
+ * because the Chimera "open" command recognises this extension
+ */
Type pdbFileFormat = StructureImportSettings
.getDefaultStructureFileFormat();
Type pdbFileFormat = StructureImportSettings
.getDefaultStructureFileFormat();
- String ext = "." + pdbFileFormat.getExtension();
+ String ext = pdbFileFormat.getExtension();
+ String fetchFormat = pdbFileFormat.getFormat();
+
EBIFetchClient ebi = new EBIFetchClient();
EBIFetchClient ebi = new EBIFetchClient();
- file = ebi.fetchDataAsFile("pdb:" + id, pdbFileFormat.getFormat(), ext)
- .getAbsolutePath();
+ File tmpFile = ebi.fetchDataAsFile("pdb:" + id, fetchFormat, ext);
+ file = tmpFile.getAbsolutePath();
stopQuery();
if (file == null)
{
stopQuery();
if (file == null)
{
@@
-155,8
+163,7
@@
public class Pdb extends EbiFileRetrievedProxy
try
{
// todo get rid of Type and use FileFormatI instead?
try
{
// todo get rid of Type and use FileFormatI instead?
- // todo get rid of "ext" and just use "tmp"?
- FileFormatI fileFormat = pdbFileFormat == Type.PDB ? FileFormat.PDB
+ FileFormatI fileFormat = (pdbFileFormat == Type.PDB) ? FileFormat.PDB
: FileFormat.MMCif;
pdbAlignment = new FormatAdapter().readFile(file,
DataSourceType.FILE, fileFormat);
: FileFormat.MMCif;
pdbAlignment = new FormatAdapter().readFile(file,
DataSourceType.FILE, fileFormat);
diff --git
a/src/jalview/ws/dbsources/Uniprot.java
b/src/jalview/ws/dbsources/Uniprot.java
index
b6f53cd
..
3afe8ec
100644
(file)
--- a/
src/jalview/ws/dbsources/Uniprot.java
+++ b/
src/jalview/ws/dbsources/Uniprot.java
@@
-165,7
+165,7
@@
public class Uniprot extends DbSourceProxyImpl
// uniprotxml parameter required since december 2007
// uniprotkb dbname changed introduced december 2008
File file = ebi.fetchDataAsFile("uniprotkb:" + queries, "uniprotxml",
// uniprotxml parameter required since december 2007
// uniprotkb dbname changed introduced december 2008
File file = ebi.fetchDataAsFile("uniprotkb:" + queries, "uniprotxml",
- ".xml");
+ "xml");
Vector<UniprotEntry> entries = getUniprotEntries(new FileReader(file));
if (entries != null)
Vector<UniprotEntry> entries = getUniprotEntries(new FileReader(file));
if (entries != null)
diff --git
a/src/jalview/ws/ebi/EBIFetchClient.java
b/src/jalview/ws/ebi/EBIFetchClient.java
index
f6928c4
..
3e8c55e
100644
(file)
--- a/
src/jalview/ws/ebi/EBIFetchClient.java
+++ b/
src/jalview/ws/ebi/EBIFetchClient.java
@@
-91,7
+91,7
@@
public class EBIFetchClient
* @param format
* the format wanted
* @param extension
* @param format
* the format wanted
* @param extension
- * for the temporary file to hold response
+ * for the temporary file to hold response (without separator)
* @return the file holding the response
* @throws OutOfMemoryError
*/
* @return the file holding the response
* @throws OutOfMemoryError
*/
@@
-102,7
+102,7
@@
public class EBIFetchClient
File outFile = null;
try
{
File outFile = null;
try
{
- outFile = File.createTempFile("jalview", ext);
+ outFile = File.createTempFile("jalview", "." + ext);
outFile.deleteOnExit();
fetchData(ids, format, outFile);
if (outFile.length() == 0)
outFile.deleteOnExit();
fetchData(ids, format, outFile);
if (outFile.length() == 0)