I have been converting the sentieon/readwriter mod...
# random
r
I have been converting the sentieon/readwriter module test to nftest and am running into an issue where the header is not consistent. the header mismatches like so:
Copy code
-t 2 -i test.single_end.sorted.bam -i test.paired_end.methylated.sorted.bam -i test.paired_end.sorted.bam --algo ReadWriter  

vs

-t 2 -i test.single_end.sorted.bam -i test.paired_end.sorted.bam -i test.paired_end.methylated.sorted.bam --algo ReadWriter
Copy code
the `input` is sorted before the script is run like this
def input_str = input.sort().collect{"-i $it"}.join(' ')``` clearly the sort order is not consistent. any groovy experts know why and which would be the correct method to use?
a
I suspect this might have to do with the default sort order for file objects in groovy? I’m not entirely sure what it is but I think you can try to sort them by their name explicitly using something like
Copy code
def input_str       = input.sort{ it.getName() }.collect{"-i $it"}.join(' ')
Maybe try this and see if it fixes your issue
s
but whatever the default sort order is, it should be consistent between runs
a
Not if it's sorting on eg the fully qualified path after resolving a symlink and the work dir names differ (since they are random)
🙌 1
s
yes, that'll be it
presumably that does the same conversion to just the file name?
a
I don't know if that's what it happening but it's the most likely thing I can think of. I have found it impossible to successfully Google the natural sort order for path objects in groovy. More coffee may be required
a
It might be sorting by the file path, so instead you need to sort by the basename.
Ah I see @Arthur has already mentioned that
r
works, thank you @Arthur 🙇