ribolands/utils.py
def parse_vienna_stdin(stdin, chars = 'ACUGN&', skip = '-'):
    """Parse name and sequence information from file with fasta format.

    Only one input-sequence is allowed at a time.

    Args:
      stdin (list): Input to parse, ususally :obj:`sys.stdin`
      chars (string, optional): Allowed characters in a sequence.

    Returns:
      str, str: name and sequence.
    """
    name = 'NoName'
    seq = ''
    for line in stdin:
        if re.match('>', line):
            if name != 'NoName':
                raise NotImplementedError(
                    'Only single-sequence fasta format supported!')
            else:
                name = line.strip().split()[0][1:]
        else:
            seq += line.strip()
    seq = seq.translate({ord(c): None for c in skip})
    m = re.search('[^' + chars + ']', seq)
    if m:
        raise RiboUtilsError("Does not look like RNA: ('{}' in '{}')".format(
            m.string[m.span()[0]], seq))
    return name, seq
Parse name and sequence information from file with fasta format.

    Only one input-sequence is allowed at a time.

    Args:
      stdin (list): Input to parse, ususally :obj:`sys.stdin`
      chars (string, optional): Allowed characters in a sequence.

    Returns:
      str, str: name and sequence.
    
Parse name and sequence information from file with fasta format.
Only one input-sequence is allowed at a time.
Parse name and sequence information from file with fasta format . Only one input - sequence is allowed at a time .
def parse_vienna_stdin(stdin, chars = 'ACUGN&', skip = '-'):
    name = 'NoName'
    seq = ''
    for line in stdin:
        if re.match('>', line):
            if name != 'NoName':
                raise NotImplementedError(
                    'Only single-sequence fasta format supported!')
            else:
                name = line.strip().split()[0][1:]
        else:
            seq += line.strip()
    seq = seq.translate({ord(c): None for c in skip})
    m = re.search('[^' + chars + ']', seq)
    if m:
        raise RiboUtilsError("Does not look like RNA: ('{}' in '{}')".format(
            m.string[m.span()[0]], seq))
    return name, seq
def parse_vienna_stdin ( stdin , chars = 'ACUGN&' , skip = '-' ) : name = 'NoName' seq = '' for line in stdin : if re . match ( '>' , line ) : if name != 'NoName' : raise NotImplementedError ( 'Only single-sequence fasta format supported!' ) else : name = line . strip ( ) . split ( ) [ 0 ] [ 1 : ] else : seq += line . strip ( ) seq = seq . translate ( { ord ( c ) : None for c in skip } ) m = re . search ( '[^' + chars + ']' , seq ) if m : raise RiboUtilsError ( "Does not look like RNA: ('{}' in '{}')" . format ( m . string [ m . span ( ) [ 0 ] ] , seq ) ) return name , seq
Parse name and sequence information from file with fasta format.
Parse name and sequence information from file with fasta format .
"""Parse name and sequence information from file with fasta format.

    Only one input-sequence is allowed at a time.

    Args:
      stdin (list): Input to parse, ususally :obj:`sys.stdin`
      chars (string, optional): Allowed characters in a sequence.

    Returns:
      str, str: name and sequence.
    """
str, str: name and sequence.
str str : name and sequence .
stdin
Input to parse, ususally :obj:`sys.stdin`
Input to parse ususally : obj : ` sys . stdin `
chars
Allowed characters in a sequence.
Allowed characters in a sequence .
skip