Esempio n. 1
0
void CVPath::x_Init(const CVFSManager& mgr, const string& path, EType type)
{
    VPath* vpath = 0;
    if ( type == eSys ) {
        if ( rc_t rc = VFSManagerMakeSysPath(mgr, &vpath, path.c_str()) ) {
            *x_InitPtr() = 0;
            NCBI_THROW2_FMT(CSraException, eInitFailed,
                            "Cannot create sys VPath: "<<path, rc);
        }
    }
    else if ( type == eAcc ) {
        if ( rc_t rc = VFSManagerMakeAccPath(mgr, &vpath, path.c_str()) ) {
            *x_InitPtr() = 0;
            NCBI_THROW2_FMT(CSraException, eInitFailed,
                            "Cannot create acc VPath: "<<path, rc);
        }
    }
    else {
        if ( rc_t rc = VFSManagerMakePath(mgr, &vpath, path.c_str()) ) {
            *x_InitPtr() = 0;
            NCBI_THROW2_FMT(CSraException, eInitFailed,
                            "Cannot create VPath: "<<path, rc);
        }
    }
    *x_InitPtr() = vpath;
}
Esempio n. 2
0
LIB_EXPORT rc_t LegacyVPathMakeSysPath ( VPath ** new_path, const char * sys_path )
{
    VFSManager * vfs;
    rc_t rc = VFSManagerMake ( & vfs );
    if ( rc == 0 )
    {
        rc = VFSManagerMakeSysPath ( vfs, new_path, sys_path );
        VFSManagerRelease ( vfs );
    }
    return rc;
}
Esempio n. 3
0
int LowLevelTest()
{
    cout << "Running LowLevelTest()." << endl;
    const AlignAccessMgr* mgr = 0;
    CALL(AlignAccessMgrMake(&mgr));
    VFSManager* vfs_mgr;
    CALL(VFSManagerMake(&vfs_mgr));
    VPath* bam_path = 0;
#ifdef _MSC_VER
# define BAM_FILE "//traces04/1kg_pilot_data/ftp/pilot_data/data/NA10851/alignment/NA10851.SLX.maq.SRP000031.2009_08.bam"
#else
# define BAM_FILE "/netmnt/traces04/1kg_pilot_data/ftp/pilot_data/data/NA10851/alignment/NA10851.SLX.maq.SRP000031.2009_08.bam"
#endif
    cout << "Testing BAM file: "<<BAM_FILE<<endl;
    CALL(VFSManagerMakeSysPath(vfs_mgr, &bam_path, BAM_FILE));
    VPath* bai_path = 0;
    CALL(VFSManagerMakeSysPath(vfs_mgr, &bai_path, BAM_FILE ".bai"));
    
    const AlignAccessDB* bam = 0;
    CALL(AlignAccessMgrMakeIndexBAMDB(mgr, &bam, bam_path, bai_path));

#ifdef _MSC_VER
    InitializeCriticalSection(&sdk_mutex);
#endif

    const size_t kNumCursors = 8;
    const size_t kNumThreads = 3;
    SThreadInfo tinfo[kNumCursors];
    const char* ids[kNumCursors] = {
        "NT_113960",
        "NT_113945",
        "NT_113880",
        "NT_113960",
        "NT_113960",
        "NT_113960",
        "NT_113945",
        "NT_113880"
    };
    for ( size_t i = 0; i < kNumThreads; ++i ) {
        tinfo[i].init(i, bam, ids[i]);
    }
    for ( size_t i = 0; i < kNumThreads; ++i ) {
        cout << "Starting thread " << i << " for " << ids[i] << endl;
#ifdef _MSC_VER
        tinfo[i].thread_id = CreateThread(NULL, 0, read_thread_func,
                                            &tinfo[i], 0, NULL);
#else
        pthread_create(&tinfo[i].thread_id, 0, read_thread_func, &tinfo[i]);
#endif
    }
    for ( size_t i = 0; i < kNumThreads; ++i ) {
        cout << "Waiting for thread " << i << endl;
        void* ret = 0;
#ifdef _MSC_VER
        WaitForSingleObject(tinfo[i].thread_id, INFINITE);
        CloseHandle(tinfo[i].thread_id);
#else
        pthread_join(tinfo[i].thread_id, &ret);
#endif
        cout << "Align count: " << tinfo[i].count << endl;
    }

    CALL(AlignAccessDBRelease(bam));
        
    CALL(VPathRelease(bam_path));
    CALL(VPathRelease(bai_path));
    CALL(AlignAccessMgrRelease(mgr));
    CALL(VFSManagerRelease(vfs_mgr));
    cout << "Success." << endl;
    return 0;
}