Commit c246de3d authored by karius's avatar karius

safety commit

parent ae599035
No preview for this file type
No preview for this file type
......@@ -14,34 +14,46 @@ CXlinkRegister::CXlinkRegister() {
bool CXlinkRegister::registerXlinkrecord(
ncbi::CRR_Row<ncbi::CRowReaderStream_IANA_CSV> row) {
std::string xl_type = row["XLType"].Get<std::string>();
if (XLINKTYPECONVERSION.find(xl_type) != XLINKTYPECONVERSION.end()) {
EXlinkType type = XLINKTYPECONVERSION.find(xl_type)->second;
//TODO: adapt this so that it can read a given range of formats
// std::string xl_type = row["XLType"].Get<std::string>();
// if (XLINKTYPECONVERSION.find(xl_type) != XLINKTYPECONVERSION.end()) {
// EXlinkType type = XLINKTYPECONVERSION.find(xl_type)->second;
EXlinkType type = eInterlink;
//temporary!
// std::string res1key = "Residue1";
// std::string res2key = "Residue2";
std::string res1key = "AbsPos1";
std::string res2key = "AbsPos2";
if (true){
SXlink_record record;
record.XLType = type;
record.Protein1 = row["Protein1"].Get<std::string>();
record.Protein2 = row["Protein1"].Get<std::string>();
record.ld_Score = row["ld-Score"].Get<float>();
// record.ld_Score = row["ld-Score"].Get<float>();
record.ld_Score = row["Score"].Get<float>();
record.LineFile = m_RowReader.GetCurrentLineNo();
record.FilePath = m_currentFile;
switch (type) {
case eIntralink:
case eInterlink:
record.Residue1 = ncbi::NStr::StringToInt(
ncbi::CTempString(row["Residue1"].Get<std::string>()));
record.Residue2 = ncbi::NStr::StringToInt(
ncbi::CTempString(row["Residue2"].Get<std::string>()));
//TODO: add function for this
if (row[res1key].GetOriginalData().length()>0)
record.Residue1 = row[res1key].Get<int>();
if (row[res2key].GetOriginalData().length()>0)
record.Residue2 = row[res2key].Get<int>();
return x_ParseTwoEndId(record, row["Id"].Get<std::string>());
case eMonolink:
try {
record.Residue1 = ncbi::NStr::StringToInt(
ncbi::CTempString(row["Residue1"].Get<std::string>()));
ncbi::CTempString(row[res1key].Get<std::string>()));
} catch (const std::exception& e) {
record.Residue1 = -1;
}
try {
record.Residue2 = ncbi::NStr::StringToInt(
ncbi::CTempString(row["Residue2"].Get<std::string>()));
ncbi::CTempString(row[res2key].Get<std::string>()));
} catch (const std::exception& e) {
record.Residue2 = -1;
}
......@@ -70,7 +82,13 @@ bool CXlinkRegister::addXlinkFile(boost::filesystem::path xlink_Filepath) {
&& boost::filesystem::is_regular_file(xlink_Filepath)) {
m_RowReader.SetDataSource(xlink_Filepath.string().c_str());
m_currentFile = xlink_Filepath;
// bool header = true;
for (const auto & row : m_RowReader) {
// //TODO:
// if (header){
// header = false;
// continue;
// }
success = registerXlinkrecord(row) && success;
}
}
......
No preview for this file type
......@@ -13,13 +13,16 @@ CUDA_LINKS = -L/usr/local/cuda-10.0/lib64/ -lcusolver -lcudart -lcublas -lcuda
LFLAGS=-L. $(IMP_LINKS) $(BOOST_LINKS) $(CUDA_LINKS)
all: CRotationGrid.o
$(NVCC) $(CFLAGS) $(LFLAGS) testareal.cu -o testareal CRotationGrid.o CMrcReader.o
all: CRotationGrid.o FitterIMPResources.o CMrcReader.o
$(NVCC) $(CFLAGS) $(LFLAGS) testareal.cu -o testareal CRotationGrid.o CMrcReader.o FitterIMPResources.o
CMrcReader.o: CMrcReader.cpp
$(NVCC) -c -o $@ $< $(CFLAGS)
CRotationGrid.o: CRotationGrid.cpp
$(NVCC) -c -o $@ $< $(CFLAGS)
FitterIMPResources.o: FitterIMPResources.cpp
$(NVCC) -c -o $@ $< $(CFLAGS)
......@@ -143,10 +143,6 @@ bool ProjectManager::addSequenceFile(boost::filesystem::path file){
return false;
}
void ProjectManager::printDatabase(){
m_DB->DumpToConsole();
}
ProjectManager::ProjectManager(const boost::filesystem::path& source) :
m_sourcedir(source), m_LogFile(&(std::cout)), m_BlastOptionsHandleptr(
ncbi::blast::CBlastOptionsFactory::Create(ncbi::blast::eBlastp,
......@@ -209,12 +205,14 @@ bool ProjectManager::alignPdbs() {
ncbi::CRef<ncbi::objects::CSeq_align> alignmentptr;
ncbi::CBioseq_Handle subject;
ncbi::CBioseq_Handle query;
double score = -1.0;
for (ncbi::objects::CSeq_align_set::Tdata::iterator it = data.begin();it!=data.end();++it) {
alignmentptr.Reset(*it);
query=m_Pdbscopeptr->GetBioseqHandle(alignmentptr->GetSeq_id(0));
subject=m_scopeptr->GetBioseqHandle(alignmentptr->GetSeq_id(1));
alignmentptr->GetNamedScore(ncbi::objects::CSeq_align::EScoreType::eScore_EValue,score);
//if the pdb actually aligns
if (query.GetBioseqLength()==alignmentptr->GetAlignLength(true)) {
if (score < align_eval) {
ncbi::CRef<ncbi::objects::CSeq_loc> seq_locptr(new ncbi::objects::CSeq_loc(ncbi::objects::CSeq_loc::e_Int));
ncbi::CSeq_id id(subject.GetId().front().AsString(), ncbi::CSeq_id::fParse_ValidLocal);
ncbi::CRef<ncbi::objects::CSeq_loc> retval(new ncbi::objects::CSeq_loc());
......@@ -788,6 +786,21 @@ bool ProjectManager::x_SetupLocalPdbDB() {
return success;
}
bool ProjectManager::setupLocalPdbDB(){
return x_SetupLocalPdbDB();
}
bool ProjectManager::addPdbfile(boost::filesystem::path file){
if (boost::filesystem::exists(file)){
if (std::find(m_PdbList.begin(),m_PdbList.end(),file) == m_PdbList.end()){
m_PdbList.push_back(file);
return true;
}
}
return false;
}
bool ProjectManager::x_SetupLocalXlinkseqDB() {
bool success = true;
// ncbi::blast::CBlastOptions opt;
......
......@@ -54,6 +54,7 @@
#include <objects/mmdb1/Biomol_descr.hpp>
#include <objects/seq/Seq_annot.hpp>
#include <objects/seq/seq_macros.hpp>
#include <objects/seqalign/Seq_align.hpp>
#include <objects/general/general_macros.hpp>
#include <CBlastPdbInputSource.h>
......@@ -70,6 +71,8 @@ const std::string XLINK_FASTA_FILE_NAME("xlink_sequences.fasta");
const std::string BLAST_DB_NAME("/tmp/pm_blast");
const std::string CHUNKY("chunky");
const double align_eval = 1e-100;
typedef std::map<std::string, std::list<ncbi::CRef<ncbi::objects::CSeq_annot>>> TAnnotMap ;
class ProjectManager {
......@@ -87,6 +90,7 @@ public:
bool alignXlinkSeqs(void);
bool alignXlinkSignals(void);
bool addXlinkfile(boost::filesystem::path file);
bool addPdbfile(boost::filesystem::path file);
void createIMPTopologyFile(std::string pdb_config_id,std::string name,bool pdb_rigid=true);
void createIMPTopologyAlternatives(boost::filesystem::path out_dir,std::string prefix);
void createXiNETFiles(std::string name);
......@@ -95,6 +99,7 @@ public:
void printDatabase(void);
void printPdbConfiguration(std::string id);
void addManualPdbLocation(std::string seq_id,boost::filesystem::path pdb_path, std::string chain_id,int from,int to);
bool setupLocalPdbDB(void);
std::vector<std::vector<std::vector<std::string>>> getAlternatives(void){return m_PdbAlternatives;}
private:
......
No preview for this file type
......@@ -209,7 +209,14 @@ int CBlastDemoApplication::Run(void) {
ProjectManager pm(
"/home/kkarius/git/TFIIICmodeling/workflow/data/vorlaender/03.12.2019");
pm.addSequenceFile("/home/kkarius/git/TFIIICmodeling/workflow/data/vorlaender/03.12.2019/AA_sequences_TauA_BTBdN.fasta");
// pm.alignPdbs();
pm.addXlinkfile("/home/kkarius/git/TFIIICmodeling/workflow/data/vorlaender/03.12.2019/tauA_Brf1-TBP_crosslinks_corrected_for_xlinkviewer.csv");
// pm.addPdbfile("/home/kkarius/git/TFIIICmodeling/workflow/data/vorlaender/03.12.2019/Brf1-TBP.pdb");
// pm.addPdbfile("/home/kkarius/git/TFIIICmodeling/workflow/data/vorlaender/03.12.2019/tauA.pdb");
pm.setupLocalPdbDB();
pm.alignPdbs();
pm.alignXlinkSignals();
pm.printPdbLocations();
// pm.alignPdbs();
// pm.createIMPTopol/home/kkarius/git/TFIIICmodeling/workflow/data/vorlaender/03.12.2019ogyFile("chunky","/home/kkarius/topology.txt");
// pm.addManualPdbLocation("lcl|NHistagPaf1w",
// boost::filesystem::path(
......
No preview for this file type
No preview for this file type
File deleted
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment