本文整理汇总了Java中org.biojava.nbio.structure.Structure类的典型用法代码示例。如果您正苦于以下问题:Java Structure类的具体用法?Java Structure怎么用?Java Structure使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Structure类属于org.biojava.nbio.structure包,在下文中一共展示了Structure类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getBiojavaRdd
import org.biojava.nbio.structure.Structure; //导入依赖的package包/类
/**
* Get an {@link JavaPairRDD} of {@link String} {@link Structure} from a file path.
* @param filePath the input path to the hadoop sequence file
* @return the {@link JavaPairRDD} of {@link String} {@link Structure}
*/
public static JavaPairRDD<String, Structure> getBiojavaRdd(String filePath) {
return SparkUtils.getSparkContext()
.sequenceFile(filePath, Text.class, BytesWritable.class, 8)
// Roughly thirty seconds
.mapToPair(t -> new Tuple2<String, byte[]>(t._1.toString(), ReaderUtils.deflateGzip(t._2.getBytes())))
// Roughly a minute
.mapToPair(t -> new Tuple2<String, MmtfStructure>(t._1, new MessagePackSerialization().deserialize(new ByteArrayInputStream(t._2))))
// Roughly a minute
.mapToPair(t -> new Tuple2<String, StructureDataInterface>(t._1, new GenericDecoder(t._2)))
// Now convert to Biojava strcutre
.mapToPair(t -> {
MmtfStructureReader mmtfStructureReader = new MmtfStructureReader();
new StructureDataToAdapter(t._2, mmtfStructureReader);
return new Tuple2<String, Structure>(t._1, mmtfStructureReader.getStructure());
});
}
开发者ID:biojava,项目名称:biojava-spark,代码行数:22,代码来源:BiojavaSparkUtils.java
示例2: getMetaModel
import org.biojava.nbio.structure.Structure; //导入依赖的package包/类
@Override
public Structure getMetaModel() throws InvalidParameterException, InvalidInputException {
try {
Structure structure = (Structure) getStructure();
PDBHeader pdbHeader = new PDBHeader();
pdbHeader.setTitle(inputParser.getTitleFromFile(getInputFile()));
PDBCrystallographicInfo pdbCrystallographicInfo = new PDBCrystallographicInfo();
List<Chain> modelFromFile = inputParser.getModelFromFile(getInputFile());
structure.setModel(0, modelFromFile);
pdbCrystallographicInfo.setSpaceGroup(new SpaceGroup(0, 1, 1, "P 1", "P 1", BravaisLattice.CUBIC));
CrystalCell crystalCell = pdbCrystallographicInfo.getSpaceGroup().getBravLattice().getExampleUnitCell();
//call always after getModelFromFile --> box calculation
inputParser.getCrystlCell(getInputFile(), crystalCell);
pdbCrystallographicInfo.setCrystalCell(crystalCell);
pdbHeader.setCrystallographicInfo(pdbCrystallographicInfo);
structure.setPDBHeader(pdbHeader);
return structure;
} catch (IOException e) {
getConsoleHandler().printErrorln(e.getMessage());
throw new InvalidInputException(getName() + " wasn't able to parse input file!");
}
}
开发者ID:ccaleman,项目名称:MDConverter,代码行数:25,代码来源:GromacsReader.java
示例3: testUpdateSuperposition
import org.biojava.nbio.structure.Structure; //导入依赖的package包/类
/**
* Tests that {@link AlignmentTools#updateSuperposition(AFPChain, Atom[], Atom[])} calculates the correct RMSD and TM-score for an AFPChain of 1 block.
* TODO: Write a test with 2 blocks
*/
public void testUpdateSuperposition() throws IOException, StructureException {
Structure s = StructureTools.getStructure("31BI");
Atom[] ca1 = StructureTools.getRepresentativeAtomArray(s);
Atom[] ca2 = StructureTools.getRepresentativeAtomArray(s);
StringBuilder sb = new StringBuilder();
BufferedReader br = new BufferedReader(new FileReader("src/test/resources/align/31BI_symm_align.xml"));
String line = "";
while ((line = br.readLine()) != null) {
sb.append(line);
}
br.close();
AFPChain afpChain = AFPChainXMLParser.fromXML(sb.toString(), ca1, ca2);
afpChain.setTMScore(-1);
afpChain.setTotalRmsdOpt(-1);
AlignmentTools.updateSuperposition(afpChain, ca1, ca2);
assertEquals("TM-score is wrong", 0.62779, afpChain.getTMScore(), 0.001);
assertEquals("RMSD is wrong", 2.50569, afpChain.getTotalRmsdOpt(), 0.001);
}
开发者ID:biojava,项目名称:biojava,代码行数:23,代码来源:AlignmentToolsTest.java
示例4: testSites1a4w
import org.biojava.nbio.structure.Structure; //导入依赖的package包/类
@Test
public void testSites1a4w()throws IOException, StructureException {
AtomCache cache = new AtomCache();
StructureIO.setAtomCache(cache);
cache.setUseMmCif(true);
Structure sCif = StructureIO.getStructure("1A4W");
assertNotNull(sCif);
// After it has read the file, it should check that expected SITES are present.
List<Site> sites = sCif.getSites();
// 1a4w has 5 sites from ligands.
assertEquals(5, sites.size());
// Check for each site that it has parsed all residues.
assertEquals(3, getGroupsInSite(sCif, "CAT"));
assertEquals(6, getGroupsInSite(sCif, "AC1")); // Site has residue with insertion code.
assertEquals(6, getGroupsInSite(sCif, "AC2"));
assertEquals(14, getGroupsInSite(sCif, "AC3"));
assertEquals(14, getGroupsInSite(sCif, "AC4"));
}
开发者ID:biojava,项目名称:biojava,代码行数:26,代码来源:TestParseMmCIFFeatures.java
示例5: test4Q7U
import org.biojava.nbio.structure.Structure; //导入依赖的package包/类
@Test
public void test4Q7U() throws Exception {
AtomCache cache = new AtomCache();
cache.setUseMmCif(true);
StructureIO.setAtomCache(cache);
Structure s = StructureIO.getStructure("4q7u");
assertNotNull(s);
Chain c = s.getPolyChain("A");
String seq = c.getSeqResSequence();
assertNotNull(seq);
assertEquals(245, seq.length());
assertFalse(seq.contains("?"));
assertTrue(seq.contains("X"));
}
开发者ID:biojava,项目名称:biojava,代码行数:19,代码来源:TestStructWithMultiparentChemComp.java
示例6: testDivideInternally
import org.biojava.nbio.structure.Structure; //导入依赖的package包/类
/**
* Test {@link SubunitCluster#divideInternally(SubunitClustererParameters)}
*
* @throws StructureException
* @throws IOException
*/
@Test
public void testDivideInternally() throws StructureException, IOException {
Structure s = StructureIO.getStructure("4e3e");
// Create a SubunitCluster for the chain
SubunitCluster sc1 = new SubunitCluster(
new Subunit(StructureTools.getRepresentativeAtomArray(s
.getChainByIndex(0)), "chain 0", null, s));
SubunitClustererParameters clustererParameters = new SubunitClustererParameters();
clustererParameters.setStructureCoverageThreshold(0.8);
clustererParameters.setRMSDThreshold(3.0);
clustererParameters.setMinimumSequenceLength(20);
// Clusters should be merged by identity
boolean divided = sc1.divideInternally(clustererParameters);
// Divided has to be true, and Subunit length shorter than half
assertTrue(divided);
assertEquals(sc1.size(), 2);
assertTrue(sc1.length() < 178);
assertEquals(sc1.getAlignedAtomsSubunit(0).length,
sc1.getAlignedAtomsSubunit(1).length);
}
开发者ID:biojava,项目名称:biojava,代码行数:32,代码来源:TestSubunitCluster.java
示例7: testHelicalLocal
import org.biojava.nbio.structure.Structure; //导入依赖的package包/类
/**
* A structure with local helical symmetry: 5JLF
*
* @throws IOException
* @throws StructureException
*/
@Test
public void testHelicalLocal() throws IOException, StructureException {
Structure pdb = StructureIO.getStructure("BIO:5JLF:1");
SubunitClustererParameters cp = new SubunitClustererParameters();
QuatSymmetryParameters symmParams = new QuatSymmetryParameters();
List<QuatSymmetryResults> results = QuatSymmetryDetector
.calcLocalSymmetries(pdb, symmParams, cp);
// H symmetry A5 stoichiometry
assertEquals("H", results.get(0).getSymmetry());
assertEquals("A5", results.get(0).getStoichiometry());
}
开发者ID:biojava,项目名称:biojava,代码行数:22,代码来源:TestQuatSymmetryDetectorExamples.java
示例8: initCoords
import org.biojava.nbio.structure.Structure; //导入依赖的package包/类
@Override
protected void initCoords() {
try {
if (multAln == null) {
if (structure != null)
setStructure(structure);
else {
logger.error("Could not find anything to display!");
return;
}
}
Structure artificial = MultipleAlignmentTools.toMultimodelStructure(multAln, transformedAtoms);
setStructure(artificial);
logger.info(artificial.getPDBHeader().getTitle());
} catch (StructureException e) {
e.printStackTrace();
}
}
开发者ID:biojava,项目名称:biojava,代码行数:19,代码来源:MultipleAlignmentJmol.java
示例9: addChainMultiModel
import org.biojava.nbio.structure.Structure; //导入依赖的package包/类
/**
* Adds a chain to the given structure to form a biological assembly,
* adding the symmetry expanded chains as new models per transformId.
* @param s
* @param newChain
* @param transformId
*/
private void addChainMultiModel(Structure s, Chain newChain, String transformId) {
// multi-model bioassembly
if ( modelIndex.size() == 0)
modelIndex.add("PLACEHOLDER FOR ASYM UNIT");
int modelCount = modelIndex.indexOf(transformId);
if ( modelCount == -1) {
modelIndex.add(transformId);
modelCount = modelIndex.indexOf(transformId);
}
if (modelCount == 0) {
s.addChain(newChain);
} else if (modelCount > s.nrModels()) {
List<Chain> newModel = new ArrayList<Chain>();
newModel.add(newChain);
s.addModel(newModel);
} else {
s.addChain(newChain, modelCount-1);
}
}
开发者ID:biojava,项目名称:biojava,代码行数:32,代码来源:BiologicalAssemblyBuilder.java
示例10: testMultipleConformations
import org.biojava.nbio.structure.Structure; //导入依赖的package包/类
@Test
public void testMultipleConformations()throws IOException, StructureException {
AtomCache cache = new AtomCache();
// This needs MMCIF
cache.setUseMmCif(true);
StructureIO.setAtomCache(cache);
cache.setUseMmCif(true);
ChemCompGroupFactory.setChemCompProvider(new DownloadChemCompProvider());
FileParsingParameters params = cache.getFileParsingParams();
params.setCreateAtomBonds(true);
StructureIO.setAtomCache(cache);
Structure sCif = StructureIO.getStructure("3UCB");
//Verify that we have all atoms from all conformations of the ligands
assertEquals(ATOM_COUNT_3UCB, countBondedAtomsInLigandGroups(sCif));
}
开发者ID:biojava,项目名称:biojava,代码行数:22,代码来源:TestParseMmCIFLigands.java
示例11: testHelical
import org.biojava.nbio.structure.Structure; //导入依赖的package包/类
/**
* A structure with helical symmetry: 1B47
*
* @throws IOException
* @throws StructureException
*/
@Test
public void testHelical() throws IOException, StructureException {
Structure pdb = StructureIO.getStructure("BIO:1B47:1");
SubunitClustererParameters cp = new SubunitClustererParameters();
QuatSymmetryParameters symmParams = new QuatSymmetryParameters();
QuatSymmetryResults symmetry = QuatSymmetryDetector.calcGlobalSymmetry(
pdb, symmParams, cp);
// H symmetry A3 stoichiometry
assertEquals("H", symmetry.getSymmetry());
assertEquals("A3", symmetry.getStoichiometry());
}
开发者ID:biojava,项目名称:biojava,代码行数:22,代码来源:TestQuatSymmetryDetectorExamples.java
示例12: testDownload
import org.biojava.nbio.structure.Structure; //导入依赖的package包/类
@Test
public void testDownload() throws IOException, StructureException {
System.out.println("Starting performance test for "+PDB_IDS.length+" PDB ids");
long start = System.currentTimeMillis();
for (String pdbId:PDB_IDS) {
Structure cifS = getCifStructure(pdbId);
Structure pdbS = getPdbStructure(pdbId);
assertNotNull(cifS);
assertNotNull(pdbS);
assertEquals(pdbId,cifS.getPDBCode().toLowerCase());
assertEquals(cifS.getPDBCode(),pdbS.getPDBCode());
//System.out.print(".");
}
System.out.println();
long end = System.currentTimeMillis();
System.out.printf("Done in %5.1f s\n",(end-start)/1000.0);
}
开发者ID:biojava,项目名称:biojava,代码行数:23,代码来源:TestAtomCachePerformance.java
示例13: testLigandConnections
import org.biojava.nbio.structure.Structure; //导入依赖的package包/类
@Test
public void testLigandConnections()throws IOException, StructureException {
AtomCache cache = new AtomCache();
// This needs MMCIF
cache.setUseMmCif(true);
StructureIO.setAtomCache(cache);
cache.setUseMmCif(true);
ChemCompGroupFactory.setChemCompProvider(new DownloadChemCompProvider());
FileParsingParameters params = cache.getFileParsingParams();
params.setCreateAtomBonds(true);
StructureIO.setAtomCache(cache);
Structure sCif = StructureIO.getStructure("4HHB");
//Verify that we have all HEM atoms from the CIF file.
assertEquals( HEM_COUNT_4HHB, countBondedAtomsInLigandGroups(sCif) );
}
开发者ID:biojava,项目名称:biojava,代码行数:21,代码来源:TestParseMmCIFLigands.java
示例14: Subunit
import org.biojava.nbio.structure.Structure; //导入依赖的package包/类
/**
* A Subunit is solely defined by the coordinates of the representative
* Atoms of its residues. It can be identified with a StructureIdentifier
* and/or a name and stores a reference to the Structure from which the
* Atoms were obtained.
*
* @param reprAtoms
* representative Atoms. It cannot be null or empty
* @param name
* String field that identifies the Subunit. It can be null
* @param identifier
* StructureIdentifier. It can be null
* @param structure
* parent Structure object. It can be null
*/
public Subunit(Atom[] reprAtoms, String name,
StructureIdentifier identifier, Structure structure) {
if (reprAtoms == null)
throw new IllegalArgumentException(
"Representative Atom Array of the Subunit is null");
if (reprAtoms.length==0)
throw new IllegalArgumentException(
"Representative Atom Array of the Subunit has 0 length");
this.reprAtoms = reprAtoms;
this.name = name;
this.identifier = identifier;
this.structure = structure;
}
开发者ID:biojava,项目名称:biojava,代码行数:31,代码来源:Subunit.java
示例15: testSecondMultiLineJRNL
import org.biojava.nbio.structure.Structure; //导入依赖的package包/类
@Test
public void testSecondMultiLineJRNL() throws IOException{
// System.out.println("Testing JRNL record parsing from 1gpb");
String jrnlString =
"JRNL AUTH K.R.ACHARYA,D.I.STUART,K.M.VARVILL,L.N.JOHNSON " + newline +
"JRNL TITL GLYCOGEN PHOSPHORYLASE B: DESCRIPTION OF THE " + newline +
"JRNL TITL 2 PROTEIN STRUCTURE " + newline +
"JRNL REF GLYCOGEN PHOSPHORYLASE B: 1 1991 " + newline +
"JRNL REF 2 DESCRIPTION OF THE PROTEIN " + newline +
"JRNL REF 3 STRUCTURE " + newline +
"JRNL PUBL WORLD SCIENTIFIC PUBLISHING CO.,SINGAPORE " + newline +
"JRNL REFN ";
BufferedReader br = new BufferedReader(new StringReader(jrnlString));
Structure s = null;
s = parser.parsePDBFile(br);
// String jrnl = s.getJournalArticle().toString();
// System.out.println(jrnl);
JournalArticle journalArticle = s.getJournalArticle();
assertEquals("", journalArticle.getVolume());
assertEquals("1", journalArticle.getStartPage());
assertEquals(1991, journalArticle.getPublicationDate());
assertEquals("GLYCOGEN PHOSPHORYLASE B: DESCRIPTION OF THE PROTEIN STRUCTURE", journalArticle.getJournalName());
}
开发者ID:biojava,项目名称:biojava,代码行数:26,代码来源:PDBFileParserTest.java
示例16: testSpeed
import org.biojava.nbio.structure.Structure; //导入依赖的package包/类
public void testSpeed() {
// Force using a file reader.
MMCIFFileReader fr = new MMCIFFileReader();
FileParsingParameters par = new FileParsingParameters();
//par.setAlignSeqRes(true);
// par.setHeaderOnly(true);
par.setHeaderOnly(false);
fr.setFileParsingParameters(par);
fr.setFetchBehavior(FetchBehavior.FETCH_FILES);
Structure s = null;
long start = System.nanoTime();
try {
// Medium sized structure parsed in 0.549s (no header) vs .676s (header) ~ 20% faster
s = fr.getStructureById("4WZ6");
// A larger structure could be parsed ~ 4.991s (no header) vs 5.867s (header) ~ 16% faster
// s = fr.getStructureById("4V60");
} catch (IOException e) {
e.printStackTrace();
System.exit(1);
}
long stop = System.nanoTime();
double diff = (stop - start) / 1000000000.0;
logger.info(String.format("[%s] Elapsed time: %.3f s", s.getIdentifier(), diff));
}
开发者ID:biojava,项目名称:biojava,代码行数:26,代码来源:TestHeaderOnly.java
示例17: test4hhb
import org.biojava.nbio.structure.Structure; //导入依赖的package包/类
@Test
public void test4hhb() throws Exception {
AtomCache cache = new AtomCache();
// at the moment implemented only in mmcif
cache.setUseMmCif(true);
StructureIO.setAtomCache(cache);
Structure s = StructureIO.getStructure("4hhb");
// 4hhb is one of the few entries that aren't in the standard coordinate frame convention
assertTrue(s.getCrystallographicInfo().isNonStandardCoordFrameConvention());
// 4hhn has a standard SG
assertFalse(s.getCrystallographicInfo().isNonStandardSg());
assertNotNull(s.getCrystallographicInfo().getSpaceGroup());
}
开发者ID:biojava,项目名称:biojava,代码行数:18,代码来源:TestCrystallographicMetadata.java
示例18: testHomoEquivalent
import org.biojava.nbio.structure.Structure; //导入依赖的package包/类
/**
* Proliferating cell nuclear antigens (3IFV, 3HI8) are structurally
* equivalent C3 homotrimers.
*/
@Test
public void testHomoEquivalent() throws StructureException, IOException {
Structure s1 = StructureIO.getStructure("3ifv");
Structure s2 = StructureIO.getStructure("BIO:3hi8:1");
SubunitClustererParameters clusterParams = new SubunitClustererParameters();
QsAlignParameters alignParams = new QsAlignParameters();
QsAlignResult result = QsAlign
.align(s1, s2, clusterParams, alignParams);
assertEquals(result.length(), 3);
assertEquals(result.getRelation(), QsRelation.EQUIVALENT);
assertTrue(result.getRmsd() < 10.0);
}
开发者ID:biojava,项目名称:biojava,代码行数:22,代码来源:TestQsAlignExamples.java
示例19: calculateDsspSecondaryStructure
import org.biojava.nbio.structure.Structure; //导入依赖的package包/类
/**
* Generate the secondary structure for a Biojava structure object.
* @param bioJavaStruct the Biojava structure for which it is to be calculate.
*/
public static void calculateDsspSecondaryStructure(Structure bioJavaStruct) {
SecStrucCalc ssp = new SecStrucCalc();
try{
ssp.calculate(bioJavaStruct, true);
}
catch(StructureException e) {
LOGGER.warn("Could not calculate secondary structure (error {}). Will try to get a DSSP file from the RCSB web server instead.", e.getMessage());
try {
DSSPParser.fetch(bioJavaStruct.getPDBCode(), bioJavaStruct, true); //download from PDB the DSSP result
} catch(Exception bige){
LOGGER.warn("Could not get a DSSP file from RCSB web server. There will not be secondary structure assignment for this structure ({}). Error: {}", bioJavaStruct.getPDBCode(), bige.getMessage());
}
}
}
开发者ID:biojava,项目名称:biojava,代码行数:21,代码来源:MmtfUtils.java
示例20: testToBePublishedJRNL
import org.biojava.nbio.structure.Structure; //导入依赖的package包/类
@Test
public void testToBePublishedJRNL() throws IOException{
// System.out.println("Testing JRNL record parsing from 1i2c");
String jrnlString =
"JRNL AUTH M.J.THEISEN,S.L.SANDA,S.L.GINELL,C.BENNING, " + newline +
"JRNL AUTH 2 R.M.GARAVITO " + newline +
"JRNL TITL CHARACTERIZATION OF THE ACTIVE SITE OF " + newline +
"JRNL TITL 2 UDP-SULFOQUINOVOSE SYNTHASE: FORMATION OF THE " + newline +
"JRNL TITL 3 SULFONIC ACID PRODUCT IN THE CRYSTALLINE STATE. " + newline +
"JRNL REF TO BE PUBLISHED " + newline +
"JRNL REFN ";
BufferedReader br = new BufferedReader(new StringReader(jrnlString));
Structure s = null;
s = parser.parsePDBFile(br);
JournalArticle journalArticle = s.getJournalArticle();
assertNull(journalArticle.getVolume());
assertNull(journalArticle.getStartPage());
assertEquals(0,journalArticle.getPublicationDate());
assertEquals("TO BE PUBLISHED", journalArticle.getJournalName());
}
开发者ID:biojava,项目名称:biojava,代码行数:24,代码来源:PDBFileParserTest.java
注:本文中的org.biojava.nbio.structure.Structure类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论