ArrayExpress::Curator::Common.pm - a module providing some simple utility functions and regexps.
use ArrayExpress::Curator::Common qw(date_now $RE_EMPTY_STRING);
if ( $test =~ $RE_EMPTY_STRING ) {
print date_now();
}
This is a simple module providing utility functions and regexp patterns used elsewhere in the Tab2MAGE package.
strip_discards( $indexcols, $line_array
)Sub to strip values out of an arrayref ($line_array) based on an arrayref of unwanted array indices ($indexcols). Does not modify the input lists, but instead returns a suitably stripped arrayref.
round(
$number, $precision )A simple rounding function that returns $number rounded to $precision decimal places.
get_indexcol( $list, $name
)Function to return the first index within @$list matching the string or regexp passed as $name. Returns -1 on failure.
check_linebreaks( $path
)Takes a filename as an argument, checks for Mac, Unix or DOS line endings by reading the whole file in chunks, and regexp matching the various linebreak types. Returns the appropriate linebreak for acceptable line breaks (line breaks must be unanimous), undef if a consensus is unreachable.
clean_hash( $hashref
)Strip out undef or empty string values from $hashref.
date_now()Return current date and time as a MAGE best practice date-time string (uses mage_date(), below).
mage_date( $time )When passed the return value from e.g. perl's
time() built-in, returns a MAGE best practice
date-time string. This string will always be from the UTC/GMT time
zone.
untaint(
$string )A convenient data untainting function which replaces any run of non-whitelisted characters with a single underscore.
find_cdf( $name, $dir
)Given a filename and an optional directory, returns an actual filename found in a case-insensitive fashion. Preferentially checks the main Affy library directory if set in $CONFIG (see the ArrayExpress::Curator::Config manpage).
decamelize( $string
)Function to convert CamelCase strings to underscore_delimited.
get_filepath_from_uri( $string,
$dir )Given a string and an optional directory argument, this function determines which URI scheme is in use (default is ``file://''), and downloads ``http://'' and ``ftp://'' URIs to either the indicated filesystem directory or the current working directory. Returns the filesystem path to the file.
$RE_EMPTY_STRINGMatches an empty string (whitespace ignored).
$RE_COMMENTED_STRINGMatches a string beginning with #.
$RE_SURROUNDED_BY_WHITESPACEMatches a string with whitespace on either side; $1 contains the string minus the whitespace.
$RE_WITHIN_PARENTHESESMatches a string with parentheses on either side; $1 contains the string minus the parentheses.
$RE_WITHIN_BRACKETSMatches a string with brackets on either side; $1 contains the string minus the brackets.
$RE_SQUARE_BRACKETSMatches either [ or ]; $1 contains the matched character.
$RE_LINE_BREAKMatches a linebreak (DOS, Unix or MacOS).
Tim Rayner (rayner@ebi.ac.uk), ArrayExpress team, EBI, 2008.
Acknowledgements go to the ArrayExpress curation team for feature requests, bug reports and other valuable comments.