valerius.utilities

Utility functions for reading in data.

valerius.utilities.open(path)[source]

Opens a sequence file and returns a processed Sequence.

If the file is a FASTA file this will be detected and parsed accordingly.

Parameters

path (str) – the location of the sequence file.

Return type

Sequence

valerius.utilities.split_string(string)[source]

Takes a raw string and splits it into individual raw sequences.

Parameters

string (str) – the string to split.

Return type

list

valerius.utilities.get_sequence_class(string)[source]

Looks at a string sequence and tries to guess what kind of sequence it is before returning the appropriate class.

Parameters

string (str) – the string sequence to inspect.

Return type

class

valerius.utilities.from_string(string)[source]

Takes a filestring and turns it into a Sequence, parsing from FASTA if required.

Parameters

string (str) – the string to convert.

Return type

Sequence

valerius.utilities.is_fasta(filestring)[source]

Checks whether a filestring is FASTA formatted.

Parameters

filestring (str) – the filestring to check.

Return type

bool

valerius.utilities.fetch(accession, db='uniprot')[source]

Fetches a sequence from UNIPROT by accession code.

Parameters
  • accession (str) – the UNIPROT accession ID.

  • db (str) – an alternative database, such as NCBI.

Return type

Sequence