use of org.rcsb.mmtf.api.StructureDataInterface in project mm-dev by sbl-sdsc.
the class MergeMmtf method MergeStructures.
public static StructureDataInterface MergeStructures(String structureId, StructureDataInterface... structures) {
for (StructureDataInterface s : structures) {
if (s.getNumModels() != 1) {
throw new IllegalArgumentException("ERROR: Cannot merge structures with more than one model");
}
}
AdapterToStructureData complex = new AdapterToStructureData();
initStructure(structureId, structures, complex);
addEntityInfo(structures, complex);
for (StructureDataInterface structure : structures) {
addStructure(structure, complex);
}
complex.finalizeStructure();
return complex;
}
use of org.rcsb.mmtf.api.StructureDataInterface in project mm-dev by sbl-sdsc.
the class D3RLigandProteinMerger method main.
public static void main(String[] args) throws IOException {
long start = System.nanoTime();
// instantiate Spark
SparkConf conf = new SparkConf().setMaster("local[*]").setAppName("D3RLigandProteinMerger");
JavaSparkContext sc = new JavaSparkContext(conf);
// String path = "/Users/peter/Downloads/Pose_prediction/417-1-hciq4/";
String path = "/Users/peter/Downloads/Pose_prediction/";
JavaPairRDD<String, StructureDataInterface> ligands = Molmporter.importMolFiles(path, sc);
ligands = ligands.mapToPair(t -> new Tuple2<String, StructureDataInterface>(removeExtension(t._1), t._2));
JavaPairRDD<String, StructureDataInterface> proteins = MmtfImporter.importPdbFiles(path, sc);
proteins = proteins.mapToPair(t -> new Tuple2<String, StructureDataInterface>(removeExtension(t._1), t._2));
JavaPairRDD<String, Tuple2<StructureDataInterface, StructureDataInterface>> pairs = proteins.join(ligands);
JavaPairRDD<String, StructureDataInterface> complexes = pairs.mapToPair(t -> new Tuple2<String, StructureDataInterface>(t._1, MergeMmtf.MergeStructures(t._1, t._2._1, t._2._2)));
complexes.foreach(t -> TraverseStructureHierarchy.printChainInfo(t._2));
// System.out.println("Complexes: " + complexes.count());
// complexes.keys().foreach(k -> System.out.println(k));
// TraverseStructureHierarchy.printChainInfo(complexes.first()._2);
sc.close();
long end = System.nanoTime();
System.out.println("Time: " + (end - start) / 1E9 + " sec.");
}
use of org.rcsb.mmtf.api.StructureDataInterface in project mm-dev by sbl-sdsc.
the class DownloadSwissModelFiles method main.
/**
* Converts a directory containing Rosetta-style PDB files into an MMTF-Hadoop Sequence file.
* The input directory is traversed recursively to find PDB files.
*
* <p> Example files from Gremlin website:
* https://gremlin2.bakerlab.org/meta/aah4043_final.zip
*
* @param args args[0] <path-to-pdb_files>, args[1] <path-to-mmtf-hadoop-file>
*
* @throws FileNotFoundException
*/
public static void main(String[] args) throws FileNotFoundException {
// instantiate Spark
SparkConf conf = new SparkConf().setMaster("local[*]").setAppName("DownloadSwissProtModelFiles");
JavaSparkContext sc = new JavaSparkContext(conf);
List<String> uniProtIds = Arrays.asList("P22629", "Q9H2C2", "Q8WXK3");
// List<String> uniProtIds = Arrays.asList("P07900");
// read PDB files recursively starting the specified directory
// TODO: Empty structure record for Q8WXK3
JavaPairRDD<String, StructureDataInterface> structures = MmtfImporter.downloadSwissModelsByUniProtIds(uniProtIds, sc);
structures.foreach(t -> TraverseStructureHierarchy.printStructureData(t._2));
// save as an MMTF-Hadoop Sequence File
// MmtfWriter.writeSequenceFile(mmtfPath, sc, structures);
// close Spark
sc.close();
}
use of org.rcsb.mmtf.api.StructureDataInterface in project mm-dev by sbl-sdsc.
the class PdbToMmtfFull method main.
/**
* Converts a directory containing Rosetta-style PDB files into an MMTF-Hadoop Sequence file.
* The input directory is traversed recursively to find PDB files.
*
* <p> Example files from Gremlin website:
* https://gremlin2.bakerlab.org/meta/aah4043_final.zip
*
* @param args args[0] <path-to-pdb_files>, args[1] <path-to-mmtf-hadoop-file>
*
* @throws FileNotFoundException
*/
public static void main(String[] args) throws FileNotFoundException {
if (args.length != 2) {
System.out.println("Usage: RosettaToMmtfFull <path-to-pdb_files> <path-to-mmtf-hadoop-file>");
}
// path to input directory
String pdbPath = args[0];
// path to output directory
String mmtfPath = args[1];
// instantiate Spark
SparkConf conf = new SparkConf().setMaster("local[*]").setAppName("RosettaToMmtfFull");
JavaSparkContext sc = new JavaSparkContext(conf);
// read PDB files recursively starting the specified directory
JavaPairRDD<String, StructureDataInterface> structures = MmtfImporter.importPdbFiles(pdbPath, sc);
structures.foreach(t -> TraverseStructureHierarchy.printStructureData(t._2));
// save as an MMTF-Hadoop Sequence File
MmtfWriter.writeSequenceFile(mmtfPath, sc, structures);
// close Spark
sc.close();
}
use of org.rcsb.mmtf.api.StructureDataInterface in project mm-dev by sbl-sdsc.
the class RosettaToMmtfFull method main.
/**
* Converts a directory containing Rosetta-style PDB files into an MMTF-Hadoop Sequence file.
* The input directory is traversed recursively to find PDB files.
*
* <p> Example files from Gremlin website:
* https://gremlin2.bakerlab.org/meta/aah4043_final.zip
*
* @param args args[0] <path-to-pdb_files>, args[1] <path-to-mmtf-hadoop-file>
*
* @throws FileNotFoundException
*/
public static void main(String[] args) throws FileNotFoundException {
if (args.length != 2) {
System.out.println("Usage: RosettaToMmtfFull <path-to-pdb_files> <path-to-mmtf-hadoop-file>");
}
// path to input directory
String pdbPath = args[0];
// path to output directory
String mmtfPath = args[1];
// instantiate Spark
SparkConf conf = new SparkConf().setMaster("local[*]").setAppName("RosettaToMmtfFull");
JavaSparkContext sc = new JavaSparkContext(conf);
// read PDB files recursively starting the specified directory
JavaPairRDD<String, StructureDataInterface> structures = MmtfImporter.importPdbFiles(pdbPath, sc);
// save as an MMTF-Hadoop Sequence File
MmtfWriter.writeSequenceFile(mmtfPath, sc, structures);
// close Spark
sc.close();
}
Aggregations