Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions biojava3-structure/src/main/java/demo/DemoMMCIFReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public static void main(String[] args){
System.out.println(h.getAtomSequence());
System.out.println(h.getAtomGroups(GroupType.HETATM));

System.out.println("Compounds: " + s.getCompounds());

} catch (Exception e) {
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
import org.biojava.bio.structure.io.mmcif.model.DatabasePDBrev;
import org.biojava.bio.structure.io.mmcif.model.Entity;
import org.biojava.bio.structure.io.mmcif.model.EntityPolySeq;
import org.biojava.bio.structure.io.mmcif.model.EntitySrcGen;
import org.biojava.bio.structure.io.mmcif.model.EntitySrcNat;
import org.biojava.bio.structure.io.mmcif.model.EntitySrcSyn;
import org.biojava.bio.structure.io.mmcif.model.Exptl;
import org.biojava.bio.structure.io.mmcif.model.PdbxChemCompDescriptor;
import org.biojava.bio.structure.io.mmcif.model.PdbxChemCompIdentifier;
Expand Down Expand Up @@ -215,4 +218,21 @@ public void newPdbxChemCompDescriptor(PdbxChemCompDescriptor desc) {

}

@Override
public void newEntitySrcGen(EntitySrcGen entitySrcGen) {
// TODO Auto-generated method stub

}
@Override
public void newEntitySrcNat(EntitySrcNat entitySrcNat) {
// TODO Auto-generated method stub

}

@Override
public void newEntitySrcSyn(EntitySrcSyn entitySrcSyn) {
// TODO Auto-generated method stub

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
import org.biojava.bio.structure.io.mmcif.model.DatabasePDBrev;
import org.biojava.bio.structure.io.mmcif.model.Entity;
import org.biojava.bio.structure.io.mmcif.model.EntityPolySeq;
import org.biojava.bio.structure.io.mmcif.model.EntitySrcGen;
import org.biojava.bio.structure.io.mmcif.model.EntitySrcNat;
import org.biojava.bio.structure.io.mmcif.model.EntitySrcSyn;
import org.biojava.bio.structure.io.mmcif.model.Exptl;
import org.biojava.bio.structure.io.mmcif.model.PdbxChemCompDescriptor;
import org.biojava.bio.structure.io.mmcif.model.PdbxChemCompIdentifier;
Expand Down Expand Up @@ -97,6 +100,9 @@ public interface MMcifConsumer {
public void newPdbxChemCompIndentifier(PdbxChemCompIdentifier id);
public void newChemCompBond(ChemCompBond bond);
public void newPdbxChemCompDescriptor(PdbxChemCompDescriptor desc);
public void newEntitySrcGen(EntitySrcGen entitySrcGen);
public void newEntitySrcNat(EntitySrcNat entitySrcNat);
public void newEntitySrcSyn(EntitySrcSyn entitySrcSyn);

/** AuditAuthor contains the info from the PDB-AUTHOR records.
*
Expand All @@ -116,4 +122,10 @@ public interface MMcifConsumer {
public FileParsingParameters getFileParsingParameters();








}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.biojava.bio.structure.AtomImpl;
import org.biojava.bio.structure.Chain;
import org.biojava.bio.structure.ChainImpl;
import org.biojava.bio.structure.Compound;
import org.biojava.bio.structure.DBRef;
import org.biojava.bio.structure.Element;
import org.biojava.bio.structure.Group;
Expand All @@ -64,6 +65,9 @@
import org.biojava.bio.structure.io.mmcif.model.DatabasePDBrev;
import org.biojava.bio.structure.io.mmcif.model.Entity;
import org.biojava.bio.structure.io.mmcif.model.EntityPolySeq;
import org.biojava.bio.structure.io.mmcif.model.EntitySrcGen;
import org.biojava.bio.structure.io.mmcif.model.EntitySrcNat;
import org.biojava.bio.structure.io.mmcif.model.EntitySrcSyn;
import org.biojava.bio.structure.io.mmcif.model.Exptl;
import org.biojava.bio.structure.io.mmcif.model.PdbxChemCompDescriptor;
import org.biojava.bio.structure.io.mmcif.model.PdbxChemCompIdentifier;
Expand Down Expand Up @@ -107,7 +111,9 @@ public class SimpleMMcifConsumer implements MMcifConsumer {
List<PdbxStructOperList> structOpers ; //
List<PdbxStructAssembly> strucAssemblies;
List<PdbxStructAssemblyGen> strucAssemblyGens;

List<EntitySrcGen> entitySrcGens;
List<EntitySrcNat> entitySrcNats;
List<EntitySrcSyn> entitySrcSyns;

Map<String,String> asymStrandId;

Expand Down Expand Up @@ -629,6 +635,9 @@ public void documentStart() {
structOpers = new ArrayList<PdbxStructOperList>();
strucAssemblies = new ArrayList<PdbxStructAssembly>();
strucAssemblyGens = new ArrayList<PdbxStructAssemblyGen>();
entitySrcGens = new ArrayList<EntitySrcGen>();
entitySrcNats = new ArrayList<EntitySrcNat>();
entitySrcSyns = new ArrayList<EntitySrcSyn>();
}


Expand Down Expand Up @@ -669,6 +678,72 @@ public void documentEnd() {
if ( DEBUG )
System.out.println(" seqres: " + asym.getId() + " " + seqres + "<") ;


for (EntitySrcGen esg : entitySrcGens) {
String eId = esg.getEntity_id();
//System.out.println("Checking entity src gens: " + eId + " " + asym.getEntity_id());
if (! eId.equals(asym.getEntity_id()))
continue;

// found the matching EntitySrcGen
// get the corresponding Entity
Compound c = structure.getCompoundById(eId);
if ( c == null){
c = createNewCompoundFromESG(esg, eId);
// add to chain
List<Compound> compounds = structure.getCompounds();
compounds.add(c);
structure.setCompounds(compounds);

}

c.addChain(s);

}

for (EntitySrcNat esn : entitySrcNats) {
String eId = esn.getEntity_id();
//System.out.println("Checking entity src gens: " + eId + " " + asym.getEntity_id());
if (! eId.equals(asym.getEntity_id()))
continue;

// found the matching EntitySrcGen
// get the corresponding Entity
Compound c = structure.getCompoundById(eId);
if ( c == null){
c = createNewCompoundFromESN(esn, eId);
// add to chain
List<Compound> compounds = structure.getCompounds();
compounds.add(c);
structure.setCompounds(compounds);

}

c.addChain(s);

}

for (EntitySrcSyn ess : entitySrcSyns) {
String eId = ess.getEntity_id();
//System.out.println("Checking entity src gens: " + eId + " " + asym.getEntity_id());
if (! eId.equals(asym.getEntity_id()))
continue;

// found the matching EntitySrcGen
// get the corresponding Entity
Compound c = structure.getCompoundById(eId);
if ( c == null){
c = createNewCompoundFromESS(ess, eId);
// add to chain
List<Compound> compounds = structure.getCompounds();
compounds.add(c);
structure.setCompounds(compounds);

}

c.addChain(s);

}
}


Expand Down Expand Up @@ -758,8 +833,66 @@ public void documentEnd() {
structure.getPDBHeader().setBioUnitTranformationMap(transformationMap);



}






private Compound createNewCompoundFromESG(EntitySrcGen esg, String eId) {

Entity e = getEntity(eId);
Compound c = new Compound();
c.setMolId(eId);
if ( e != null)
c.setMolName(e.getPdbx_description());
c.setAtcc(esg.getPdbx_gene_src_atcc());
c.setCell(esg.getPdbx_gene_src_cell());
c.setOrganismCommon(esg.getGene_src_common_name());
c.setOrganismScientific(esg.getPdbx_gene_src_scientific_name());
c.setOrganismTaxId(esg.getPdbx_gene_src_ncbi_taxonomy_id());

return c;

}

private Compound createNewCompoundFromESN(EntitySrcNat esn, String eId) {

Entity e = getEntity(eId);
Compound c = new Compound();
c.setMolId(eId);
if ( e != null)
c.setMolName(e.getPdbx_description());
c.setAtcc(esn.getPdbx_atcc());
c.setCell(esn.getPdbx_cell());
c.setOrganismCommon(esn.getCommon_name());
c.setOrganismScientific(esn.getPdbx_organism_scientific());
c.setOrganismTaxId(esn.getPdbx_ncbi_taxonomy_id());


return c;

}

private Compound createNewCompoundFromESS(EntitySrcSyn ess, String eId) {

Entity e = getEntity(eId);
Compound c = new Compound();
c.setMolId(eId);
if ( e != null)
c.setMolName(e.getPdbx_description());


c.setOrganismCommon(ess.getOrganism_common_name());
c.setOrganismScientific(ess.getOrganism_scientific());
c.setOrganismTaxId(ess.getNcbi_taxonomy_id());


return c;

}

/** This method will return the parsed protein structure, once the parsing has been finished
*
Expand Down Expand Up @@ -1055,6 +1188,37 @@ private Chain getEntityChain(String entity_id){
// return getChainFromList(seqResChains, chainID);
//}


/** Data items in the ENTITY_SRC_GEN category record details of
the source from which the entity was obtained in cases
where the source was genetically manipulated. The
following are treated separately: items pertaining to the tissue
from which the gene was obtained, items pertaining to the host
organism for gene expression and items pertaining to the actual
producing organism (plasmid).
*/

@Override
public void newEntitySrcGen(EntitySrcGen entitySrcGen){

// add to internal list. Map to Compound object later on...
entitySrcGens.add(entitySrcGen);
}

@Override
public void newEntitySrcNat(EntitySrcNat entitySrcNat){

// add to internal list. Map to Compound object later on...
entitySrcNats.add(entitySrcNat);
}

@Override
public void newEntitySrcSyn(EntitySrcSyn entitySrcSyn){

// add to internal list. Map to Compound object later on...
entitySrcSyns.add(entitySrcSyn);
}

/** The EntityPolySeq object provide the amino acid sequence objects for the Entities.
* Later on the entities are mapped to the BioJava Chain and Compound objects.
* @param epolseq the EntityPolySeq record for one amino acid
Expand Down Expand Up @@ -1264,8 +1428,8 @@ public void newPdbxNonPolyScheme(PdbxNonPolyScheme ppss) {

public void newPdbxEntityNonPoly(PdbxEntityNonPoly pen){
// TODO: do something with them...

System.out.println(pen.getEntity_id() + " " + pen.getName() + " " + pen.getComp_id());
// not implemented yet...
//System.out.println(pen.getEntity_id() + " " + pen.getName() + " " + pen.getComp_id());
}

public void newChemComp(ChemComp c) {
Expand Down Expand Up @@ -1329,31 +1493,34 @@ public List<PdbxStructAssemblyGen> getStructAssemblyGens(){
@Override
public void newChemCompAtom(ChemCompAtom atom) {
// TODO Auto-generated method stub

}

@Override
public void newPdbxChemCompIndentifier(PdbxChemCompIdentifier id) {
// TODO Auto-generated method stub

}

@Override
public void newChemCompBond(ChemCompBond bond) {
// TODO Auto-generated method stub

}

@Override
public void newPdbxChemCompDescriptor(PdbxChemCompDescriptor desc) {
// TODO Auto-generated method stub

}








}


Loading