Skip to content

Commit 52c3edb

Browse files
committed
Add constructors for the MMTFFilereader
1 parent eb0a882 commit 52c3edb

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

biojava-structure/src/main/java/org/biojava/nbio/structure/io/MMTFFileReader.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import java.io.InputStream;
55

66
import org.biojava.nbio.structure.Structure;
7+
import org.biojava.nbio.structure.align.util.UserConfiguration;
78
import org.biojava.nbio.structure.io.mmtf.MmtfActions;
89

910
/**
@@ -18,14 +19,32 @@ public class MMTFFileReader extends LocalPDBDirectory {
1819
public static final String[] MMTF_OBSOLETE_DIR = new String[]{"data","structures","obsolete","mmtf"};
1920

2021
public static void main(String[] args) throws Exception {
21-
2222
MMTFFileReader reader = new MMTFFileReader();
2323
FileParsingParameters params = new FileParsingParameters();
2424
reader.setFileParsingParameters(params);
2525
Structure struc = reader.getStructureById("1m4x");
2626
System.out.println(struc);
2727
}
2828

29+
/**
30+
* Constructs a new {@link MMTFFileReader}, initializing the extensions member variable.
31+
* The path is initialized in the same way as {@link UserConfiguration},
32+
* i.e. to system property/environment variable {@link UserConfiguration#PDB_DIR}.
33+
* Both autoFetch and splitDir are initialized to false
34+
*/
35+
public MMTFFileReader() {
36+
this(null);
37+
}
38+
39+
/**
40+
* Constructs a new {@link MMTFFileReader}, initializing the extensions member variable.
41+
* The path is initialized to the given path, both autoFetch and splitDir are initialized to false.
42+
*/
43+
public MMTFFileReader(String path) {
44+
super(path);
45+
addExtension(".mmtf");
46+
addExtension(".mmtf.gz");
47+
}
2948

3049
@Override
3150
public Structure getStructure(InputStream inStream) throws IOException {

0 commit comments

Comments
 (0)