예제 #1
0
std::vector<std::string> IndexedFastaReader::Names(void) const
{
    REQUIRE_FAIDX_LOADED;
    std::vector<std::string> names;
    names.reserve(NumSequences());
    for (size_t i = 0; i < NumSequences(); ++i)
        names.push_back(faidx_iseq(handle_, i));
    return names;
}
예제 #2
0
std::string IndexedFastaReader::Name(const size_t idx) const
{
    REQUIRE_FAIDX_LOADED;
    if (idx >= NumSequences())
        throw std::runtime_error("FASTA index out of range");
    return std::string(faidx_iseq(handle_, idx));
}
예제 #3
0
/*
 * set the "active" sequence in a given direction
 */
int
Set_Active_Seq(int seq_num,
	       int direction)
{
    /* nip */
    if (direction == -1)
	active_seq = seq_num;

    if (direction == HORIZONTAL) {
	horizontal = seq_num;
    } else if (direction == VERTICAL) {
	vertical = seq_num;
    } else {
	return -1;
    }
    /* 
     * HACK to deal with h and v set to be the same value, default to the
     * latest change and set the other to be -1
     */
    /*   if (horizontal == vertical) {
	if (direction == HORIZONTAL){ 
	    vertical = -1;
	} else if (direction == VERTICAL) {
	    horizontal = -1;
	}
	}*/

     /*yy:Set horizontal sequence as active sequence  in sequence array
     */
    if (horizontal == vertical){
	if (direction == HORIZONTAL) { 
	    vertical = -1;
	}else if (direction == VERTICAL) { 
	    if( NumSequences() > 1 ){	       
	    horizontal = 0;                   
	    }else if (NumSequences()==1) {
		vertical = -1;
		horizontal = 0;
	    }
	}
    }

    return 0;
}
예제 #4
0
/* check if adding same sequence name, if are, remove previous seq */
void RemoveDuplicateSeq(Tcl_Interp *interp,
			char *name)
{
    int n_seqs;
    int i;
    /*
     * need to check if entry_name already exists in the database. If it does
     * then must delete current sequence (and all its results) and add the
     * new entry_name
     */
    n_seqs = NumSequences();
    for (i = 0; i < n_seqs; i++) {
	if (strcmp(name, GetSeqName(i)) == 0) {
	    verror(ERR_WARN, "RemoveDuplicateSeq", 
		   "%s already exists in. Removing previous sequence and adding new sequence\n", name); 
	    DeleteSequence(interp, i--);
	    n_seqs--;
	}
    }
}