Sequence number can be generated in transformer by running the stage in sequential mode easily but to generate the sequence number while running the stage in parallel, following formula needs to be used in derivation -
@PARTITIONNUM + (@NUMPARTITIONS * (@INROWNUM-1))