Types
This page describes the standard types in the Nextflow standard library.
Bag<E>
Implements the stdlib-types-iterable trait.
A bag is an unordered collection of values of type E.
The following operations are supported for bags: Concatenates two bags. Given a value and a bag, returns + : (Bag<E>, Bag<E>) -> Bag<E>in, !in : (E, Bag<E>) -> Booleantrue if the bag contains the value (or not).
Boolean
A boolean can be true or false.
The following operations are supported for booleans:
&&: logical AND||: logical OR!: logical NOT
Booleans in Nextflow can be backed by any of the following Java types: boolean, Boolean.
Channel<E>
A channel (also known as a dataflow channel or queue channel) is an asynchronous sequence of values of type E. It is used to facilitate dataflow logic in a workflow.
See dataflow-page for an overview of dataflow types. See operator-page for the available methods for channels.
Duration
A Duration represents a duration of time with millisecond precision.
A Duration can be created by adding a unit suffix to an integer (e.g. 1.h), or by explicitly casting to Duration:
// integer with suffix
oneDay = 24.h
// integer value (milliseconds)
oneSecond = 1000 as Duration
// simple string value
oneHour = '1h' as Duration
// complex string value
complexDuration = '1day 6hours 3minutes 30seconds' as Duration
The following suffixes are available:
| Unit | Description |
|---|---|
ms, milli, millis | Milliseconds |
s, sec, second, seconds | Seconds |
m, min, minute, minutes | Minutes |
h, hour, hours | Hours |
d, day, days | Days |
Durations can be compared like numbers, and they support basic arithmetic operations:
a = 1.h
b = 2.h
assert a < b
assert a + a == b
assert b - a == a
assert a * 2 == b
assert b / 2 == a
The following methods are available for a Duration: Get the duration value in days (rounded down). Get the duration value in hours (rounded down). Get the duration value in milliseconds. Get the duration value in minutes (rounded down). Get the duration value in seconds (rounded down). These methods are also available as toDays() -> IntegertoHours() -> IntegertoMillis() -> IntegertoMinutes() -> IntegertoSeconds() -> IntegergetDays(), getHours(), getMillis(), getMinutes(), and getSeconds().
Float
A float is a floating-point number (i.e. real number) that can be positive or negative.
The following operations are supported for floats:
+, -, *, /: addition, subtraction, multiplication, division**: exponentation
Floats in Nextflow can be backed by any of the following Java types: float, double, Float, Double.
Integer
An integer is a whole number that can be positive or negative.
The following operations are supported for integers:
+, -, *, /: addition, subtraction, multiplication, integer division%: remainder of integer division (i.e. modulus)**: exponentation&,|,^,~: bitwise AND, OR, XOR, NOT<<,>>: left and right bit-shift
Integers in Nextflow can be backed by any of the following Java types: int, long, Integer, Long.
Iterable<E>
Implemented by the following types: stdlib-types-bag, stdlib-types-list, stdlib-types-set
Iterable is a trait implemented by collection types that support iteration.
Types that implement Iterable can be passed as an Iterable parameter of a method, and they can use all of the methods described below.
The following methods are available for iterables: Returns Returns a new iterable with each element transformed by the given closure. Transforms each element in the iterable into a collection with the given closure and concatenates the resulting collections into a list. Returns Invokes the given closure for each element in the iterable. Returns Returns the elements in the iterable that satisfy the given condition. Collect the elements of an iterable into groups based on a matching key. The closure should return the key for a given element. Apply the given accumulator to each element in the iterable and return the final accumulated value. The closure should accept two parameters, corresponding to the current accumulated value and the current iterable element, and return the next accumulated value.
The first element from the iterable is used as the initial accumulated value. Apply the given accumulator to each element in the iterable and return the final accumulated value. The closure should accept two parameters, corresponding to the current accumulated value and the current iterable element, and return the next accumulated value. Returns Concatenates the string representation of each element in the iterable, with the given string as the separator between each element. Returns the maximum element in the iterable. Returns the maximum element in the iterable according to the given closure.
The closure should follow the same semantics as the closure parameter of Returns the maximum element in the iterable according to the given closure.
The closure should follow the same semantics as the closure parameter of Returns the minimum element in the iterable. Returns the minimum element in the iterable according to the given closure.
The closure should follow the same semantics as the closure parameter of Returns the minimum element in the iterable according to the given closure.
The closure should follow the same semantics as the closure parameter of Returns the number of elements in the iterable. Returns the sum of the elements in the iterable. The elements should support addition ( Transforms each element in the iterable with the given closure and returns the sum. The values returned by the closure should support addition ( Converts the iterable to a list. Converting an unordered collection to a list can lead to non-deterministic behavior. Consider using Converts the iterable to a set. Duplicate elements are excluded. Returns a sorted list of the iterable's elements. Returns the iterable as a list sorted according to the given closure.
The closure should accept one parameter and transform each element into the value that will be used for comparisons. Returns the iterable as a list sorted according to the given closure.
The closure should accept two parameters and return a negative integer, zero, or a positive integer to denote whether the first argument is less than, equal to, or greater than the second. Returns a shallow copy of the iterable with duplicate elements excluded. Returns a shallow copy of the iterable with duplicate elements excluded.
The closure should follow the same semantics as the closure parameter of any( condition: (E) -> Boolean ) -> Booleantrue if any element in the iterable satisfies the given condition.collect( transform: (E) -> R ) -> Iterable<R>collectMany( transform: (E) -> Iterable<R> ) -> Iterable<R>contains( value: E ) -> Booleantrue if the iterable contains the given value.each( action: (E) -> () )every( condition: (E) -> Boolean ) -> Booleantrue if every element in the iterable satisfies the given condition.findAll( condition: (E) -> Boolean ) -> Iterable<E>groupBy( transform: (E) -> K ) -> Map<K,Iterable<E>>inject( accumulator: (E,E) -> E ) -> Einject( initialValue: R, accumulator: (R,E) -> R ) -> RisEmpty() -> Booleantrue if the iterable is empty.join( separator: String = '' ) -> Stringmax() -> Emax( comparator: (E) -> R ) -> EtoSorted().max( comparator: (E,E) -> Integer ) -> EtoSorted().min() -> Emin( comparator: (E) -> R ) -> EtoSorted().min( comparator: (E,E) -> Integer ) -> EtoSorted().size() -> Integersum() -> E+).sum( transform: (E) -> R ) -> R+).toList() -> List<E>toSorted() instead to ensure a deterministic ordering. See cache-nondeterministic-inputs for more information.toSet() -> Set<E>toSorted() -> List<E>toSorted( comparator: (E) -> R ) -> List<E>toSorted( comparator: (E,E) -> Integer ) -> List<E>toUnique() -> Iterable<E>toUnique( comparator: (E) -> R ) -> Iterable<E>toUnique( comparator: (E,E) -> Integer ) -> Iterable<E>toSorted().
List<E>
Implements the stdlib-types-iterable trait.
A list is an ordered collection of values of type E. See [Lists]]script-list for an overview of lists.
The following operations are supported for lists: Concatenates two lists. Given a list and an integer n, repeats the list n times. Given a list and an index, returns the element at the given index in the list, or Given a value and a list, returns The following methods are available for a list: Collates the list into a list of sub-lists of length For example: Collates the list into a list of sub-lists of length For example: Returns the first element in the list that satisfies the given condition. Returns the first element in the list. Raises an error if the list is empty. Returns the list of integers from 0 to n - 1, where n is the number of elements in the list. Equivalent to Returns the index of the first occurrence of the given value in the list, or -1 if the list does not contain the value. Returns a shallow copy of the list with the last element excluded. Returns the last element in the list. Raises an error if the list is empty. Returns a shallow copy of the list with the elements reversed. Returns the portion of the list between the given Returns a shallow copy of the list with the first element excluded. Returns the first n elements of the list. Returns the longest prefix of the list where each element satisfies the given condition. Returns a list of 2-tuples corresponding to the value and index of each element in the list.+ : (List<E>, List<E>) -> List<E>* : (List<E>, Integer) -> List<E>[] : (List<E>, Integer) -> Enull if the index is out of range.in, !in : (E, List<E>) -> Booleantrue if the list contains the value (or not).collate( size: Integer, keepRemainder: Boolean = true ) -> List<List<E>>size. If keepRemainder is true, any remaining elements are included as a partial sub-list, otherwise they are excluded.assert [1, 2, 3, 4, 5, 6, 7].collate(3) == [[1, 2, 3], [4, 5, 6], [7]]
assert [1, 2, 3, 4, 5, 6, 7].collate(3, false) == [[1, 2, 3], [4, 5, 6]]collate( size: Integer, step: Integer, keepRemainder: Boolean = true ) -> List<List<E>>size, stepping through the list step elements for each sub-list. If keepRemainder is true, any remaining elements are included as a partial sub-list, otherwise they are excluded.assert [1, 2, 3, 4].collate(3, 1) == [[1, 2, 3], [2, 3, 4], [3, 4], [4]]
assert [1, 2, 3, 4].collate(3, 1, false) == [[1, 2, 3], [2, 3, 4]]find( condition: (E) -> Boolean ) -> Efirst() -> EgetIndices() -> List<Integer>head() -> Efirst().indexOf( value: E ) -> Integerinit() -> List<E>last() -> Ereverse() -> List<E>subList( fromIndex: Integer, toIndex: Integer ) -> List<E>fromIndex (inclusive) and toIndex (exclusive).tail() -> List<E>take( n: Integer ) -> List<E>takeWhile( condition: (E) -> Boolean ) -> List<E>withIndex() -> List<(E,Integer)>
Map<K,V>
A map associates or "maps" keys of type K to values of type V. Each key can map to at most one value -- a map cannot contain duplicate keys. See Maps for an overview of maps.
The following operations are supported for maps: Concatenates two maps. If a key exists in both maps, the mapping from the right-hand side is used. Given a map and a key, returns the value for the given key in the map, or Given a key and a map, returns The following methods are available for a map: Returns Returns Returns Invokes the given closure for each key-value pair in the map. The closure should accept two parameters corresponding to the key and value of an entry. Returns a set of the key-value pairs in the map. Returns Returns Returns a set of the keys in the map. Returns the number of key-value pairs in the map. Returns a sub-map containing the given keys. Returns a collection of the values in the map.+ : (Map<K,V>, Map<K,V>) -> Map<K,V>[] : (Map<K,V>, K) -> Vnull if the key is not in the map.in, !in : (K, Map<K,V>) -> Booleantrue if the map contains the key and the corresponding value is truthy (e.g. not null, 0, or false).any( condition: (K,V) -> Boolean ) -> Booleantrue if any key-value pair in the map satisfies the given condition. The closure should accept two parameters corresponding to the key and value of an entry.containsKey( key: K ) -> Booleantrue if the map contains a mapping for the given key.containsValue( value: V ) -> Booleantrue if the map maps one or more keys to the given value.each( action: (K,V) -> () )entrySet() -> Set<(K,V)>every( condition: (K,V) -> Boolean ) -> Booleantrue if every key-value pair in the map satisfies the given condition. The closure should accept two parameters corresponding to the key and value of an entry.isEmpty() -> Booleantrue if the map is empty.keySet() -> Set<K>size() -> IntegersubMap( keys: Iterable<K> ) -> Map<K,V>values() -> Bag<V>
MemoryUnit
A MemoryUnit represents a quantity of bytes.
A MemoryUnit can be created by adding a unit suffix to an integer (e.g. 1.GB), or by explicitly casting to MemoryUnit:
// integer with suffix
oneMegabyte = 1.MB
// integer value (bytes)
oneKilobyte = 1024 as MemoryUnit
// string value
oneGigabyte = '1 GB' as MemoryUnit
The following suffixes are available:
| Unit | Description |
|---|---|
B | Bytes |
KB | Kilobytes |
MB | Megabytes |
GB | Gigabytes |
TB | Terabytes |
PB | Petabytes |
EB | Exabytes |
ZB | Zettabytes |
Technically speaking, a kilobyte is equal to 1000 bytes, whereas 1024 bytes is called a "kibibyte" and abbreviated as "KiB", and so on for the other units. In practice, however, kilobyte is commonly understood to mean 1024 bytes, and Nextflow follows this convention in its implementation as well as this documentation.
Memory units can be compared like numbers, and they support basic arithmetic operations:
a = 1.GB
b = 2.GB
assert a < b
assert a + a == b
assert b - a == a
assert a * 2 == b
assert b / 2 == a
The following methods are available for a Get the memory value in bytes (B). Get the memory value in gigabytes (rounded down), where 1 GB = 1024 MB. Get the memory value in kilobytes (rounded down), where 1 KB = 1024 B. Get the memory value in megabytes (rounded down), where 1 MB = 1024 KB. Get the memory value in terms of a given unit (rounded down). The unit can be one of: These methods are also available as MemoryUnit object:toBytes() -> IntegertoGiga() -> IntegertoKilo() -> IntegertoMega() -> IntegertoUnit( unit: String ) -> Integer'B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB'.getBytes(), getGiga(), getKilo(), and getMega().
Path
A Path is a handle for hierarchichal paths such as local files and directories, HTTP/FTP URLs, and object storage paths (e.g. Amazon S3).
The file() function can be used to get a Path for a given filename or URL:
def hello = file('hello.txt')
println hello.text
The files() function can be used to get a collection of Paths from a glob pattern:
def inputs = files('*.txt')
inputs.each { input ->
println "${input.name}: ${input.text}"
}
The following sections describe the methods that are available for paths.
Operations
The following operations are supported for paths: Resolves a relative path string against a directory path. Equivalent to Appends text to a file without replacing existing content. Equivalent to The following properties are available: The path name without its extension, e.g. The path extension, e.g. The path name, e.g. The path parent path, e.g. The path URI scheme, e.g. The path name without any extension, e.g. The following methods are available for getting filesystem attributes: Returns true if the path exists. Returns Gets the path name without any extension, e.g. Gets the path parent path, e.g. Gets the path URI scheme, e.g. Returns Returns Returns Returns Returns Returns the path last modified timestamp in Unix time (i.e. milliseconds since January 1, 1970). Returns the relative path between this path and the given path. Resolves the given path string against this path. Resolves the given path string against this path's parent path. Gets the file size in bytes. Gets the file path along with the protocol scheme: The following methods are available for reading files: Iterates over the file, applying the specified closure to each line. Returns the file content as a string. Reads the file line by line and returns the content as a list of strings. Invokes the given closure with a BufferedReader, which can be used to read the file one line at a time using the The following methods are available for writing to files: Appends text to a file without replacing existing content. Writes text to a file. Equivalent to setting the Writes a string to a file, replacing any existing content. The following methods are available for manipulating files and directories in a filesystem: Copies a source file or directory to a target file or directory. When copying a file to another file: if the target file already exists, it will be replaced. When copying a file to a directory: the file will be copied into the directory, replacing any file with the same name. When copying a directory to another directory: if the target directory already exists, the source directory will be copied into the target directory, replacing any sub-directory with the same name. If the target path does not exist, it will be created automatically. The result of the above example depends on the existence of the target directory. If the target directory exists, the source is moved into the target directory, resulting in the path The Deletes the file or directory at the given path, returning If a directory is not empty, it will not be deleted and Deletes a directory and all of its contents. Returns a file’s permissions using the symbolic notation, e.g. 'rw-rw-r--'. Returns the first-level elements (files and directories) of a directory as a list of strings. Returns the first-level elements (files and directories) of a directory as a list of Paths. Creates a directory at the given path, returning If the parent directories do not exist, the directory will not be created and Creates a directory at the given path, including any nonexistent parent directories: Creates a filesystem link to a given path: Returns the Path of the link to create. Available options: When When Moves a source file or directory to a target file or directory. Follows the same semantics as Rename a file or directory: Sets a file's permissions using the symbolic notation: Sets a file's permissions using the numeric notation, i.e. as three digits representing the owner, group, and other permissions: The following methods are available for listing and traversing directories: Iterates through first-level directories only. Iterates through directories whose names match the given filter. Iterates through directories depth-first (regular files are ignored). Iterates through first-level files and directories. Iterates through files and directories whose names match the given filter. Iterates through files and directories depth-first. Returns the first-level elements (files and directories) in a directory. Use Returns the first-level elements (files and directories) in a directory. The following methods are available for splitting and counting the records in files: Counts the number of records in a FASTA file. See the operator-splitfasta operator for available options. Counts the number of records in a FASTQ file. See the operator-splitfastq operator for available options. Counts the number of records in a JSON file. See the operator-splitjson operator for available options. Counts the number of lines in a text file. See the operator-splittext operator for available options. Splits a CSV file into a list of records. See the operator-splitcsv operator for available options. Splits a FASTA file into a list of records. See the operator-splitfasta operator for available options. Splits a FASTQ file into a list of records. See the operator-splitfastq operator for available options. Splits a JSON file into a list of records. See the operator-splitjson operator for available options. Splits a text file into a list of lines. See the operator-splittext operator for available options./ : (Path, String) -> Pathresolve().<< : (Path, String)append().Filesystem attributes
baseName: String/some/path/file.tar.gz -> file.tar.extension: String/some/path/file.txt -> txt.name: String/some/path/file.txt -> file.txt.parent: Path/some/path/file.txt -> /some/path.scheme: Strings3://some-bucket/hello.txt -> s3.simpleName: String/some/path/file.tar.gz -> file.exists() -> BooleanisDirectory() -> Booleantrue if the path is a directory.getSimpleName() -> String/some/path/file.tar.gz -> file.getParent() -> Path/some/path/file.txt -> /some/path.getScheme() -> Strings3://some-bucket/hello.txt -> s3.isDirectory() -> Booleantrue if the path is a directory.isEmpty() -> Booleantrue if the path is empty or does not exist.isFile() -> Booleantrue if the path is a file (i.e. not a directory).isHidden() -> Booleantrue if the path is hidden.isLink() -> Booleantrue if the path is a symbolic link.lastModified() -> Integerrelativize(other: Path) -> Pathresolve(other: String) -> PathresolveSibling(other: String) -> Pathsize() -> IntegertoUriString() -> Stringdef ref = file('s3://some-bucket/hello.txt')
assert ref.toString() == '/some-bucket/hello.txt'
assert "$ref" == '/some-bucket/hello.txt'
assert ref.toUriString() == 's3://some-bucket/hello.txt'Reading
eachLine( action: (String) -> () )getText() -> StringreadLines() -> List<String>withReader( action: (BufferedReader) -> () )readLine() method.Writing
append( text: String )setText( text: String )text property.write( text: String )Filesystem operations
copyTo( target: Path )file('/some/path/my_file.txt').copyTo('/another/path/new_file.txt')file('/some/path/my_file.txt').copyTo('/another/path')file('/any/dir_a').moveTo('/any/dir_b')/any/dir_b/dir_a. If the target directory does not exist, the source is just renamed to the target name, resulting in the path /any/dir_b.copyTo() function follows the semantics of the Linux command cp -r <source> <target>, with the following caveat: while Linux tools often treat paths ending with a slash (e.g. /some/path/name/) as directories, and those not (e.g. /some/path/name) as regular files, Nextflow (due to its use of the Java files API) views both of these paths as the same file system object. If the path exists, it is handled according to its actual type (i.e. as a regular file or as a directory). If the path does not exist, it is treated as a regular file, with any missing parent directories created automatically.delete() -> Booleantrue if the operation succeeds, and false otherwise:myFile = file('some/file.txt')
result = myFile.delete()
println result ? "OK" : "Cannot delete: $myFile"delete() will return false.deleteDir() -> Booleanfile('any/path').deleteDir()getPermissions() -> Stringlist() -> List<String>listFiles() -> List<Path>mkdir() -> Booleantrue if the directory is created successfully, and false otherwise:myDir = file('any/path')
result = myDir.mkdir()
println result ? "OK" : "Cannot create directory: $myDir"mkdir() will return false.mkdirs() -> Booleanfile('any/path').mkdirs()mklink( linkName: String, [options] ) -> PathmyFile = file('/some/path/file.txt')
myFile.mklink('/user/name/link-to-file.txt')hard: Booleantrue, creates a hard link, otherwise creates a soft (aka symbolic) link (default: false).overwrite: Booleantrue, overwrites any existing file with the same name, otherwise throws a FileAlreadyExistsException (default: false).moveTo( target: Path )copyTo().renameTo( target: String ) -> Booleanfile('my_file.txt').renameTo('new_file_name.txt')setPermissions( permissions: String ) -> BooleanmyFile.setPermissions('rwxr-xr-x')setPermissions( owner: Integer, group: Integer, other: Integer ) -> BooleanmyFile.setPermissions(7,5,5)eachDir( action: (Path) -> () )eachDirMatch( nameFilter: String, action: (Path) -> () )eachDirRecurse( action: (Path) -> () )eachFile( action: (Path) -> () )eachFileMatch( nameFilter: String, action: (Path) -> () )eachFileRecurse( action: (Path) -> () )listDirectory() -> Iterable<Path>listFiles() -> Iterable<Path>listDirectory() instead.Splitting files
countFasta() -> IntegercountFastq() -> IntegercountJson() -> IntegercountLines() -> IntegersplitCsv() -> List<?>splitFasta() -> List<?>splitFastq() -> List<?>splitJson() -> List<?>splitText() -> List<String>
Set<E>
Implements the stdlib-types-iterable trait.
A set is an unordered collection of values of type E which cannot contain duplicates.
A set can be created from a list using the toSet() method:
[1, 2, 2, 3].toSet()
// -> [1, 2, 3]
The following operations are supported for sets: Given a set and an iterable, returns a new set containing the elements of both collections. Given a set and an iterable, returns a shallow copy of the set minus the elements of the iterable. Given a value and a set, returns The following methods are available for a set: Returns the intersection of the set and the given iterable.+ : (Set<E>, Iterable<E>) -> Set<E>- : (Set<E>, Iterable<E>) -> Set<E>in, !in : (E, Set<E>) -> Booleantrue if the set contains the value (or not).intersect( right: Iterable<E> ) -> Set<E>
String
A string is an immutable sequence of characters. See Strings for an overview of strings.
The following operations are supported for strings: Concatenates two strings. Given a string and an integer n, repeats the string n times. Given a string and an index, returns the character at the given index in the string. Creates a regular expression from a string.
See Pattern in the Java standard library for more information. Given a string and a pattern, creates a matcher that is truthy if the pattern occurs anywhere in the string.
See Matcher in the Java standard library for more information. Given a string and a pattern, returns The following methods are available for a string: Returns Returns Execute the string as a command. Returns a Process which provides the exit status and standard input/output/error of the executed command. Returns the index within the string of the first occurrence of the given substring. Returns -1 if the string does not contain the substring. Returns the index within the string of the first occurrence of the given substring, starting the search at the given index. Returns -1 if the string does not contain the substring. Returns Returns Returns Returns Returns Returns Returns the index within the string of the last occurrence of the given substring. Returns -1 if the string does not contain the substring. Returns the index within the string of the last occurrence of the given substring, searching backwards starting at the given index. Returns -1 if the string does not contain the substring. Returns the length of the string. Returns the MD5 checksum of the string. Returns a new string in which each occurrence of the target string is replaced with the given replacement string. Returns a new string in which each occurrence of the given regular expression is replaced with the given replacement string. Returns a new string in which the first occurrence of the given regular expression is replaced with the given replacement string. Returns the SHA-256 checksum of the string. Returns Returns a copy of the string with all leading and trailing whitespace removed. Returns a copy of the string with leading spaces on each line removed.
The number of spaces to remove is determined by the line with the least number of leading spaces, excluding lines with only whitespace. Returns a copy of the string with all leading whitespace removed. Returns a copy of the string with all trailing whitespace removed. Returns a substring of this string. Returns a substring of this string. Returns Parses the string into a 64-bit (double precision) floating-point number. Parses the string into a 32-bit floating-point number. Parses the string into a 32-bit integer. Parses the string into a 64-bit (long) integer. Returns a copy of this string with all characters converted to lower case. Returns a copy of this string with all characters converted to upper case. Splits the string into a list of substrings using the given delimiters. Each character in the delimiter string is treated as a separate delimiter.+ : (String, String) -> String* : (String, Integer) -> String[] : (String, Integer) -> char~ : (String) -> Pattern=~ : (String, String) -> Matcher==~ : (String, String) -> Booleantrue if the string matches the pattern exactly.contains( str: String ) -> Booleantrue if the given substring occurs anywhere in the string.endsWith( suffix: String ) -> Booleantrue if the string ends with the given suffix.execute() -> ProcessindexOf( str: String ) -> IntegerindexOf( str: String, fromIndex: Integer ) -> IntegerisBlank() -> Booleantrue if the string is empty or contains only whitespace characters.isEmpty() -> Booleantrue if the string is empty (i.e. length() is 0).isDouble() -> Booleantrue if the string can be parsed as a 64-bit (double precision) floating-point number.isFloat() -> Booleantrue if the string can be parsed as a 32-bit floating-point number.isInteger() -> Booleantrue if the string can be parsed as a 32-bit integer.isLong() -> Booleantrue if the string can be parsed as a 64-bit (long) integer.lastIndexOf( str: String ) -> IntegerlastIndexOf( str: String, fromIndex: Integer ) -> Integerlength() -> Integermd5() -> Stringreplace( target: String, replacement: String ) -> StringreplaceAll( regex: String, replacement: String ) -> StringreplaceFirst( regex: String, replacement: String ) -> Stringsha256() -> StringstartsWith( prefix: String ) -> Booleantrue if the string ends with the given prefix.strip() -> StringstripIndent() -> StringstripLeading() -> StringstripTrailing() -> Stringsubstring( beginIndex: Integer ) -> Stringsubstring( beginIndex: Integer, endIndex: Integer ) -> StringtoBoolean() -> Booleantrue if the trimmed string is "true", "y", or "1" (ignoring case).toDouble() -> FloattoFloat() -> FloattoInteger() -> IntegertoLong() -> IntegertoLowerCase() -> StringtoUpperCase() -> Stringtokenize( delimiters: String ) -> List<String>
Tuple
A tuple is a fixed sequence of values, where each value can have its own type. Tuples can be created using the tuple function.
The following operations are supported for tuples: Given a tuple and an index, returns the tuple element at the index.[] : (Tuple, Integer) -> ?
Value<V>
A dataflow value (also known as a value channel) is an asynchronous value of type V. It is used to facilitate dataflow logic in a workflow.
See dataflow-page for an overview of dataflow types.
The following methods are available for a dataflow value: Transforms the dataflow value into a collection with the given closure and emits the resulting values in a dataflow channel. Transforms the dataflow value into another dataflow value with the given closure. Invokes the given closure on the dataflow value. Prints the dataflow value to standard output. Transforms the dataflow value using the given closure and print the result to standard output.flatMap( transform: (V) -> Iterable<R> ) -> Channel<R>map( transform: (V) -> R ) -> Value<R>subscribe( action: (V) -> () )view() -> Value<V>view( transform: (V) -> String ) -> Value<V>
VersionNumber
A VersionNumber represents a semantic or calendar version number.
The following methods are available for a VersionNumber: Get the major version number, i.e. the first version component. Get the minor version number, i.e. the second version component. Get the patch version number, i.e. the third version component. Check whether the version satisfies a version requirement. The version requirement string can be prefixed with the usual comparison operators: For example: Multiple constraints can be specified as a comma-separated list, e.g. Alternatively, the version can be postfixed with getMajor() -> StringgetMinor() -> StringgetPatch() -> Stringmatches( condition: String ) -> Boolean
= or ==: equal to< (<=): less than (or equal to)> (>=): greater than (or equal to)!= or <>: not equalif( !nextflow.version.matches('>=23.10') ) {
error "This workflow requires Nextflow version 23.10 or greater -- You are running version $nextflow.version"
}>=23.10, <=24.10.+, which is similar to == but also allows the last version part to be greater. For example, 23.10.1+ is satisfied by 23.10.1 and 23.10.2, but not 23.11.x or 23.09.x. Additionally, 23.10.+ is equivalent to 23.10.0+. This operator is a useful way to enforce a specific version while allowing for newer patch releases.