clustal-omega-1.2.4/src/clustal/hhalign_wrapper.c
/**
 * @brief get rid of unknown residues
 *
 * @note HHalignWrapper can be entered in 2 different ways: (i) all
 * sequences are un-aligned (ii) there are 2 (aligned) profiles.  in
 * the un-aligned case (i) the sequences come straight from Squid,
 * that is, they have been sanitised, all non-alphabetic residues 
 * have been rendered as X's. In profile mode (ii) one profile may 
 * have been produced internally. In that case residues may have 
 * been translated back into their 'native' form, that is, they may
 * contain un-sanitised residues. These will cause trouble  during
 * alignment
 * FS, r213->214
 */
@brief get rid of unknown residues

@note HHalignWrapper can be entered in 2 different ways: (i) all
sequences are un-aligned (ii) there are 2 (aligned) profiles.  in
the un-aligned case (i) the sequences come straight from Squid,
that is, they have been sanitised, all non-alphabetic residues
have been rendered as X's. In profile mode (ii) one profile may
have been produced internally. In that case residues may have
been translated back into their 'native' form, that is, they may
contain un-sanitised residues. These will cause trouble  during
alignment
FS, r213->214
@brief get rid of unknown residues @note HHalignWrapper can be entered in 2 different ways : ( i ) all sequences are un - aligned ( ii ) there are 2 ( aligned ) profiles . in the un - aligned case ( i ) the sequences come straight from Squid that is they have been sanitised all non - alphabetic residues have been rendered as X ' s . In profile mode ( ii ) one profile may have been produced internally . In that case residues may have been translated back into their ' native ' form that is they may contain un - sanitised residues . These will cause trouble during alignment FS r213 - > 214
void
SanitiseUnknown(mseq_t *mseq)
{
    int iS; 
    char *pcRes = NULL;
    for (iS = 0; iS < mseq->nseqs; iS++){
        for (pcRes = mseq->seq[iS]; '\0' != *pcRes; pcRes++){
            if (isgap(*pcRes)){
                *pcRes = '-';
                continue;
            }
            if (mseq->seqtype==SEQTYPE_PROTEIN) {
                if (NULL == strchr(AMINO_ALPHABET, toupper(*pcRes))) {
                    *pcRes = AMINOACID_ANY;
                }
            } else if (mseq->seqtype==SEQTYPE_DNA) {
                if (NULL == strchr(DNA_ALPHABET, toupper(*pcRes))) {
                    *pcRes = NUCLEOTIDE_ANY;
                }
            } else if (mseq->seqtype==SEQTYPE_RNA) {
                if (NULL == strchr(RNA_ALPHABET, toupper(*pcRes))) {
                    *pcRes = NUCLEOTIDE_ANY;
                }
            }
        } 
    } 
    return;
}
void SanitiseUnknown ( mseq_t * mseq ) { int iS ; char * pcRes = NULL ; for ( iS = 0 ; iS < mseq -> nseqs ; iS ++ ) { for ( pcRes = mseq -> seq [ iS ] ; ' \0 ' != * pcRes ; pcRes ++ ) { if ( isgap ( * pcRes ) ) { * pcRes = ' ' ; continue ; } if ( mseq -> seqtype == SEQTYPE_PROTEIN ) { if ( NULL == strchr ( AMINO_ALPHABET , toupper ( * pcRes ) ) ) { * pcRes = AMINOACID_ANY ; } } else if ( mseq -> seqtype == SEQTYPE_DNA ) { if ( NULL == strchr ( DNA_ALPHABET , toupper ( * pcRes ) ) ) { * pcRes = NUCLEOTIDE_ANY ; } } else if ( mseq -> seqtype == SEQTYPE_RNA ) { if ( NULL == strchr ( RNA_ALPHABET , toupper ( * pcRes ) ) ) { * pcRes = NUCLEOTIDE_ANY ; } } } } return ; }
@brief get rid of unknown residues
@brief get rid of unknown residues
/* iterator for sequence */ /*int iR;*/ /* iterator for residue */ /*int iLen;*/ /* length of sequence */ /* don't like MSF gap characters ('~'), 
                   sanitise them (and '.' and ' '); FS, r258 -> r259 */ /* !EO String */ /* 0 <= iS < mseq->nseqs */