1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601
|
From: Michael R. Crusoe <michael.crusoe@gmail.com>
Subject: Don't hardcode number of --CPU (especially above 2)
blastn -num_threads will not accept a number larger than the cores/CPUs it
detects and will exit with an error. Some Debian test (virtual) machines only
have two cores and thus they failed our testing.
With this patch we detect in a unix/macOS friendly way the number of cores
using `nproc` or `sysctl -n hw.physicalcpu` (respectively). Thus execution of
the sample_data tests will be much faster for most developers/users.
Perhaps Trinity itself could be taught this trick and the --CPU option would
not be needed by default.
--- trinityrnaseq.orig/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe.diff_kmer_length.sh
+++ trinityrnaseq/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe.diff_kmer_length.sh
@@ -19,14 +19,14 @@
gunzip -c reads2.left.fq.gz > reads2.left.fq
fi
-
+CPU=$(nproc || sysctl -n hw.physicalcpu)
#######################################################
## Run Trinity to Generate Transcriptome Assemblies ##
#######################################################
## use jellyfish
-../../Trinity --seqType fq --JM 2G --left reads.left.fq.gz,reads2.left.fq.gz --right reads.right.fq.gz,reads2.right.fq.gz --SS_lib_type RF --CPU 4 --trimmomatic --normalize_reads --no_cleanup --KMER_SIZE $KMER_SIZE
+../../Trinity --seqType fq --JM 2G --left reads.left.fq.gz,reads2.left.fq.gz --right reads.right.fq.gz,reads2.right.fq.gz --SS_lib_type RF --CPU ${CPU} --trimmomatic --normalize_reads --no_cleanup --KMER_SIZE $KMER_SIZE
##### Done Running Trinity #####
--- trinityrnaseq.orig/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_CuffFly.sh
+++ trinityrnaseq/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_CuffFly.sh
@@ -9,14 +9,14 @@
gunzip -c reads.left.fq.gz > reads.left.fq
fi
-
+CPU=$(nproc || sysctl -n hw.physicalcpu)
#######################################################
## Run Trinity to Generate Transcriptome Assemblies ##
#######################################################
## use jellyfish
-../../Trinity.pl --seqType fq --JM 2G --left reads.left.fq --right reads.right.fq --SS_lib_type RF --CPU 4 --CuffFly
+../../Trinity.pl --seqType fq --JM 2G --left reads.left.fq --right reads.right.fq --SS_lib_type RF --CPU ${CPU} --CuffFly
##### Done Running Trinity #####
--- trinityrnaseq.orig/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_PasaFly.sh
+++ trinityrnaseq/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_PasaFly.sh
@@ -9,14 +9,14 @@
gunzip -c reads.left.fq.gz > reads.left.fq
fi
-
+CPU=$(nproc || sysctl -n hw.physicalcpu)
#######################################################
## Run Trinity to Generate Transcriptome Assemblies ##
#######################################################
## use jellyfish
-../../Trinity.pl --seqType fq --JM 2G --left reads.left.fq --right reads.right.fq --SS_lib_type RF --CPU 4 --PasaFly
+../../Trinity.pl --seqType fq --JM 2G --left reads.left.fq --right reads.right.fq --SS_lib_type RF --CPU ${CPU} --PasaFly
##### Done Running Trinity #####
--- trinityrnaseq.orig/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_as_DS.sh
+++ trinityrnaseq/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_as_DS.sh
@@ -4,8 +4,10 @@
## Run Trinity to Generate Transcriptome Assemblies ##
#######################################################
+CPU=$(nproc || sysctl -n hw.physicalcpu)
+
## use jellyfish
-../../Trinity.pl --seqType fq --JM 2G --left reads.left.fq.gz --right reads.right.fq.gz --CPU 4
+../../Trinity.pl --seqType fq --JM 2G --left reads.left.fq.gz --right reads.right.fq.gz --CPU ${CPU}
##### Done Running Trinity #####
--- trinityrnaseq.orig/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_bowtie_components.sh
+++ trinityrnaseq/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_bowtie_components.sh
@@ -9,14 +9,14 @@
gunzip -c reads.left.fq.gz > reads.left.fq
fi
-
+CPU=$(nproc || sysctl -n hw.physicalcpu)
#######################################################
## Run Trinity to Generate Transcriptome Assemblies ##
#######################################################
## use jellyfish
-../../Trinity.pl --seqType fq --JM 2G --left reads.left.fq --right reads.right.fq --SS_lib_type RF --CPU 4 --bowtie_comp
+../../Trinity.pl --seqType fq --JM 2G --left reads.left.fq --right reads.right.fq --SS_lib_type RF --CPU ${CPU} --bowtie_comp
##### Done Running Trinity #####
--- trinityrnaseq.orig/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_full_cleanup.sh
+++ trinityrnaseq/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_full_cleanup.sh
@@ -4,8 +4,10 @@
## Run Trinity to Generate Transcriptome Assemblies ##
#######################################################
+CPU=$(nproc || sysctl -n hw.physicalcpu)
+
## use jellyfish
-../../Trinity --seqType fq --max_memory 2G --left reads.left.fq.gz --right reads.right.fq.gz --SS_lib_type RF --CPU 2 --full_cleanup
+../../Trinity --seqType fq --max_memory 2G --left reads.left.fq.gz --right reads.right.fq.gz --SS_lib_type RF --CPU ${CPU} --full_cleanup
##### Done Running Trinity #####
--- trinityrnaseq.orig/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_include_long_reads.sh
+++ trinityrnaseq/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_include_long_reads.sh
@@ -4,13 +4,14 @@
## Run Trinity to Generate Transcriptome Assemblies ##
#######################################################
+CPU=$(nproc || sysctl -n hw.physicalcpu)
${TRINITY_HOME}/Trinity --seqType fq \
--max_memory 2G \
--left reads.left.fq.gz \
--right reads.right.fq.gz \
--SS_lib_type RF \
- --CPU 4 \
+ --CPU ${CPU} \
--no_cleanup \
--long_reads longReads.fa \
--output test_trinity_long_reads
--- trinityrnaseq.orig/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_no_cleanup.sh
+++ trinityrnaseq/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_no_cleanup.sh
@@ -4,8 +4,10 @@
## Run Trinity to Generate Transcriptome Assemblies ##
#######################################################
+CPU=$(nproc || sysctl -n hw.physicalcpu)
+
## use jellyfish
-../../Trinity.pl --seqType fq --JM 2G --left reads.left.fq.gz --right reads.right.fq.gz --SS_lib_type RF --CPU 2 --no_cleanup
+../../Trinity.pl --seqType fq --JM 2G --left reads.left.fq.gz --right reads.right.fq.gz --SS_lib_type RF --CPU ${CPU} --no_cleanup
##### Done Running Trinity #####
--- trinityrnaseq.orig/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_parallel_iworm_assembly.sh
+++ trinityrnaseq/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_parallel_iworm_assembly.sh
@@ -9,14 +9,14 @@
gunzip -c reads.left.fq.gz > reads.left.fq
fi
-
+CPU=$(nproc || sysctl -n hw.physicalcpu)
#######################################################
## Run Trinity to Generate Transcriptome Assemblies ##
#######################################################
## use jellyfish
-../../Trinity.pl --seqType fq --JM 2G --left reads.left.fq --right reads.right.fq --SS_lib_type RF --CPU 4 --PARALLEL_IWORM
+../../Trinity.pl --seqType fq --JM 2G --left reads.left.fq --right reads.right.fq --SS_lib_type RF --CPU ${CPU} --PARALLEL_IWORM
##### Done Running Trinity #####
--- trinityrnaseq.orig/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_piecemeal.sh
+++ trinityrnaseq/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_piecemeal.sh
@@ -4,17 +4,19 @@
## Run Trinity to Generate Transcriptome Assemblies ##
#######################################################
+CPU=$(nproc || sysctl -n hw.physicalcpu)
+
# stop before inchworm (just in silico norm)
-${TRINITY_HOME}/Trinity --seqType fq --max_memory 2G --left reads.left.fq.gz --right reads.right.fq.gz --CPU 4 --output trinity_piecemeal --no_run_inchworm
+${TRINITY_HOME}/Trinity --seqType fq --max_memory 2G --left reads.left.fq.gz --right reads.right.fq.gz --CPU ${CPU} --output trinity_piecemeal --no_run_inchworm
# stop before chrysalis
-${TRINITY_HOME}/Trinity --seqType fq --max_memory 2G --left reads.left.fq.gz --right reads.right.fq.gz --CPU 4 --output trinity_piecemeal --no_run_chrysalis
+${TRINITY_HOME}/Trinity --seqType fq --max_memory 2G --left reads.left.fq.gz --right reads.right.fq.gz --CPU ${CPU} --output trinity_piecemeal --no_run_chrysalis
# stop before phase 2
-${TRINITY_HOME}/Trinity --seqType fq --max_memory 2G --left reads.left.fq.gz --right reads.right.fq.gz --CPU 4 --output trinity_piecemeal --no_distributed_trinity_exec
+${TRINITY_HOME}/Trinity --seqType fq --max_memory 2G --left reads.left.fq.gz --right reads.right.fq.gz --CPU ${CPU} --output trinity_piecemeal --no_distributed_trinity_exec
# finish it up
-${TRINITY_HOME}/Trinity --seqType fq --max_memory 2G --left reads.left.fq.gz --right reads.right.fq.gz --CPU 4 --output trinity_piecemeal
+${TRINITY_HOME}/Trinity --seqType fq --max_memory 2G --left reads.left.fq.gz --right reads.right.fq.gz --CPU ${CPU} --output trinity_piecemeal
--- trinityrnaseq.orig/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_trin_complete.sh
+++ trinityrnaseq/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_trin_complete.sh
@@ -4,10 +4,12 @@
## Run Trinity to Generate Transcriptome Assemblies ##
#######################################################
+CPU=$(nproc || sysctl -n hw.physicalcpu)
+
../../Trinity --seqType fq --max_memory 2G \
--left reads.left.fq.gz \
--right reads.right.fq.gz \
--SS_lib_type RF \
- --CPU 4 --trinity_complete --no_cleanup --output trinity_complete
+ --CPU ${CPU} --trinity_complete --no_cleanup --output trinity_complete
--- trinityrnaseq.orig/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_use_bowtie2.sh
+++ trinityrnaseq/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_use_bowtie2.sh
@@ -4,6 +4,8 @@
## Run Trinity to Generate Transcriptome Assemblies ##
#######################################################
+CPU=$(nproc || sysctl -n hw.physicalcpu)
+
## use jellyfish
../../Trinity \
--seqType fq \
@@ -11,7 +13,7 @@
--left reads.left.fq.gz \
--right reads.right.fq.gz \
--SS_lib_type RF \
- --CPU 4 \
+ --CPU ${CPU} \
--no_cleanup \
--use_bowtie2 \
--output test_trinity_bowtie2
--- trinityrnaseq.orig/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_use_my_ramdisk.sh
+++ trinityrnaseq/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_use_my_ramdisk.sh
@@ -15,11 +15,13 @@
## Run Trinity to Generate Transcriptome Assemblies ##
#######################################################
+CPU=$(nproc || sysctl -n hw.physicalcpu)
+
../../Trinity --seqType fq --max_memory 2G \
--left reads.left.fq \
--right reads.right.fq \
--SS_lib_type RF \
- --CPU 4 \
+ --CPU ${CPU} \
--workdir /Volumes/RamDisk/trinity.workdir.$$ --full_cleanup
--- trinityrnaseq.orig/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_use_workdir.sh
+++ trinityrnaseq/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_use_workdir.sh
@@ -15,11 +15,13 @@
## Run Trinity to Generate Transcriptome Assemblies ##
#######################################################
+CPU=$(nproc || sysctl -n hw.physicalcpu)
+
${TRINITY_HOME}/Trinity --seqType fq --max_memory 2G \
--left reads.left.fq \
--right reads.right.fq \
--SS_lib_type RF \
- --CPU 4 \
+ --CPU ${CPU}\
--output trinity_with_workdir \
--workdir /tmp/trinity.workdir.$$ --full_cleanup
--- trinityrnaseq.orig/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_using_Grid_LSF.sh
+++ trinityrnaseq/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_using_Grid_LSF.sh
@@ -4,8 +4,6 @@
## Run Trinity to Generate Transcriptome Assemblies ##
#######################################################
-
-
-../../Trinity --seqType fq --JM 2G --left reads.left.fq.gz --right reads.right.fq.gz --SS_lib_type RF --CPU 4 --grid_conf_file ../../htc_conf/BroadInst_LSF.test.conf
+../../Trinity --seqType fq --JM 2G --left reads.left.fq.gz --right reads.right.fq.gz --SS_lib_type RF --CPU $4 --grid_conf_file ../../htc_conf/BroadInst_LSF.test.conf
--- trinityrnaseq.orig/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_w_monitoring.sh
+++ trinityrnaseq/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_w_monitoring.sh
@@ -15,6 +15,8 @@
## Run Trinity to Generate Transcriptome Assemblies ##
#######################################################
+CPU=$(nproc || sysctl -n hw.physicalcpu)
+
# monitoring at 1 second intervals because this test runs very quick. You might monitor on the order of minutes rather than seconds for 'regular' runs.
-../../Trinity --seqType fq --max_memory 1G --left reads.left.fq --right reads.right.fq --SS_lib_type RF --CPU 4 --monitoring --monitor_sec 1 --output trinity_out_dir_monitored
+../../Trinity --seqType fq --max_memory 1G --left reads.left.fq --right reads.right.fq --SS_lib_type RF --CPU ${CPU} --monitoring --monitor_sec 1 --output trinity_out_dir_monitored
--- trinityrnaseq.orig/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_with_qual_trimming.sh
+++ trinityrnaseq/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_with_qual_trimming.sh
@@ -15,6 +15,7 @@
## Run Trinity to Generate Transcriptome Assemblies ##
#######################################################
+CPU=$(nproc || sysctl -n hw.physicalcpu)
${TRINITY_HOME}/Trinity \
--seqType fq \
@@ -22,7 +23,7 @@
--left reads.left.fq \
--right reads.right.fq \
--SS_lib_type RF \
- --CPU 4 \
+ --CPU ${CPU} \
--no_normalize_reads \
--trimmomatic \
--output __test_trinity_with_trimmomatic
--- trinityrnaseq.orig/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_with_qual_trimming_and_normalization.sh
+++ trinityrnaseq/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_with_qual_trimming_and_normalization.sh
@@ -15,8 +15,9 @@
## Run Trinity to Generate Transcriptome Assemblies ##
#######################################################
+CPU=$(nproc || sysctl -n hw.physicalcpu)
-${TRINITY_HOME}/Trinity --seqType fq --max_memory 2G --left reads.left.fq --right reads.right.fq --SS_lib_type RF --CPU 4 --trimmomatic --normalize_reads --output __test_trinity_qual_and_norm
+${TRINITY_HOME}/Trinity --seqType fq --max_memory 2G --left reads.left.fq --right reads.right.fq --SS_lib_type RF --CPU ${CPU} --trimmomatic --normalize_reads --output __test_trinity_qual_and_norm
##### Done Running Trinity #####
--- trinityrnaseq.orig/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_with_qual_trimming_and_normalize_libs_separately.sh
+++ trinityrnaseq/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_with_qual_trimming_and_normalize_libs_separately.sh
@@ -22,13 +22,14 @@
## Run Trinity to Generate Transcriptome Assemblies ##
#######################################################
+CPU=$(nproc || sysctl -n hw.physicalcpu)
${TRINITY_HOME}/Trinity --seqType fq \
--max_memory 2G \
--left reads.left.fq,reads2.left.fq \
--right reads.right.fq,reads2.right.fq \
--SS_lib_type RF \
- --CPU 4 \
+ --CPU ${CPU} \
--trimmomatic \
--normalize_reads \
--normalize_by_read_set \
--- trinityrnaseq.orig/sample_data/test_Trinity_Assembly/misc_run_tests/__test_runMe.singleFQ.sh
+++ trinityrnaseq/sample_data/test_Trinity_Assembly/misc_run_tests/__test_runMe.singleFQ.sh
@@ -6,7 +6,9 @@
## Run Trinity to Generate Transcriptome Assemblies ##
#######################################################
-../../Trinity.pl --seqType fq --single reads.left.fq.gz --JM 1G --CPU 4 --output trinity_single_outdir
+CPU=$(nproc || sysctl -n hw.physicalcpu)
+
+../../Trinity.pl --seqType fq --single reads.left.fq.gz --JM 1G --CPU {CPU} --output trinity_single_outdir
--- trinityrnaseq.orig/sample_data/test_Trinity_Assembly/misc_run_tests/__test_runMe_NO_normalization.sh
+++ trinityrnaseq/sample_data/test_Trinity_Assembly/misc_run_tests/__test_runMe_NO_normalization.sh
@@ -15,13 +15,15 @@
## Run Trinity to Generate Transcriptome Assemblies ##
#######################################################
+CPU=$(nproc || sysctl -n hw.physicalcpu)
+
## use jellyfish
${TRINITY_HOME}/Trinity --seqType fq \
--max_memory 2G \
--left reads.left.fq \
--right reads.right.fq \
--SS_lib_type RF \
- --CPU 4 \
+ --CPU ${CPU} \
--no_normalize_reads \
--output __test_trinity_wo_normalization
--- trinityrnaseq.orig/sample_data/test_Trinity_Assembly/misc_run_tests/__test_runMe_docker.sh
+++ trinityrnaseq/sample_data/test_Trinity_Assembly/misc_run_tests/__test_runMe_docker.sh
@@ -1,2 +1,4 @@
-docker run --rm -v`pwd`:`pwd` trinityrnaseq/trinityrnaseq Trinity --seqType fq --single `pwd`/reads.left.fq.gz --max_memory 1G --CPU 2 --output `pwd`/trinity_out_dir_docker
+CPU=$(nproc || sysctl -n hw.physicalcpu)
+
+docker run --rm -v`pwd`:`pwd` trinityrnaseq/trinityrnaseq Trinity --seqType fq --single `pwd`/reads.left.fq.gz --max_memory 1G --CPU ${CPU} --output `pwd`/trinity_out_dir_docker
--- trinityrnaseq.orig/sample_data/test_Trinity_Assembly/misc_run_tests/__test_runMe_include_normalization.sh
+++ trinityrnaseq/sample_data/test_Trinity_Assembly/misc_run_tests/__test_runMe_include_normalization.sh
@@ -15,8 +15,10 @@
## Run Trinity to Generate Transcriptome Assemblies ##
#######################################################
+CPU=$(nproc || sysctl -n hw.physicalcpu)
+
## use jellyfish
-../../Trinity --seqType fq --max_memory 2G --left reads.left.fq --right reads.right.fq --SS_lib_type RF --CPU 4 --normalize_reads --output __test_trinity_w_normalization
+../../Trinity --seqType fq --max_memory 2G --left reads.left.fq --right reads.right.fq --SS_lib_type RF --CPU ${CPU} --normalize_reads --output __test_trinity_w_normalization
##### Done Running Trinity #####
--- trinityrnaseq.orig/sample_data/test_Trinity_Assembly/misc_run_tests/__test_runMe_lenient_path_extension.sh
+++ trinityrnaseq/sample_data/test_Trinity_Assembly/misc_run_tests/__test_runMe_lenient_path_extension.sh
@@ -15,7 +15,9 @@
## Run Trinity to Generate Transcriptome Assemblies ##
#######################################################
+CPU=$(nproc || sysctl -n hw.physicalcpu)
+
## use jellyfish
-../../Trinity --seqType fq --max_memory 2G --left reads.left.fq --right reads.right.fq --SS_lib_type RF --CPU 4 --path_reinforcement_distance 1 --output __test_trinity_lenient_path_ext
+../../Trinity --seqType fq --max_memory 2G --left reads.left.fq --right reads.right.fq --SS_lib_type RF --CPU ${CPU} --path_reinforcement_distance 1 --output __test_trinity_lenient_path_ext
--- trinityrnaseq.orig/sample_data/test_Trinity_Assembly/misc_run_tests/runMe_no_qualTrim.sh
+++ trinityrnaseq/sample_data/test_Trinity_Assembly/misc_run_tests/runMe_no_qualTrim.sh
@@ -6,8 +6,10 @@
## Run Trinity to Generate Transcriptome Assemblies ##
#######################################################
+CPU=$(nproc || sysctl -n hw.physicalcpu)
+
## use jellyfish
-../../Trinity --seqType fq --max_memory 2G --left reads.left.fq.gz,reads2.left.fq.gz --right reads.right.fq.gz,reads2.right.fq.gz --SS_lib_type RF --CPU 4 --normalize_reads --no_cleanup --output trinity_test_no_qtrim
+../../Trinity --seqType fq --max_memory 2G --left reads.left.fq.gz,reads2.left.fq.gz --right reads.right.fq.gz,reads2.right.fq.gz --SS_lib_type RF --CPU ${CPU} --normalize_reads --no_cleanup --output trinity_test_no_qtrim
##### Done Running Trinity #####
--- trinityrnaseq.orig/sample_data/test_Trinity_Assembly/runMe.sh
+++ trinityrnaseq/sample_data/test_Trinity_Assembly/runMe.sh
@@ -9,12 +9,13 @@
exit 1
fi
+CPU=$(nproc || sysctl -n hw.physicalcpu)
${TRINITY_HOME}/Trinity --seqType fq --max_memory 2G \
--left reads.left.fq.gz \
--right reads.right.fq.gz \
--SS_lib_type RF \
- --CPU 4
+ --CPU ${CPU}
##### Done Running Trinity #####
--- trinityrnaseq.orig/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe.noSeqtk.sh
+++ trinityrnaseq/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe.noSeqtk.sh
@@ -9,11 +9,12 @@
exit 1
fi
+CPU=$(nproc || sysctl -n hw.physicalcpu)
${TRINITY_HOME}/Trinity --seqType fq --max_memory 2G \
--left reads.left.fq.gz \
--right reads.right.fq.gz \
--SS_lib_type RF \
- --CPU 4 \
+ --CPU ${CPU} \
--output trinity_out_dir_noseqtk --NO_SEQTK
--- trinityrnaseq.orig/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_include_supertranscripts.sh
+++ trinityrnaseq/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_include_supertranscripts.sh
@@ -4,11 +4,13 @@
## Run Trinity to Generate Transcriptome Assemblies ##
#######################################################
+CPU=$(nproc || sysctl -n hw.physicalcpu)
+
${TRINITY_HOME}/Trinity --seqType fq --max_memory 2G \
--left reads.left.fq.gz \
--right reads.right.fq.gz \
--SS_lib_type RF \
- --CPU 4 --include_supertranscripts --output trinity_incl_supertrans
+ --CPU ${CPU} --include_supertranscripts --output trinity_incl_supertrans
exit 0
--- trinityrnaseq.orig/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_no_para_iworm.sh
+++ trinityrnaseq/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_no_para_iworm.sh
@@ -1,5 +1,7 @@
#!/bin/bash -ve
+CPU=$(nproc || sysctl -n hw.physicalcpu)
+
#######################################################
## Run Trinity to Generate Transcriptome Assemblies ##
#######################################################
@@ -14,7 +16,7 @@
--left reads.left.fq.gz \
--right reads.right.fq.gz \
--SS_lib_type RF \
- --CPU 4 --NO_PARALLEL_IWORM
+ --CPU ${CPU} --NO_PARALLEL_IWORM
##### Done Running Trinity #####
--- trinityrnaseq.orig/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_no_salmon_no_cleanup.sh
+++ trinityrnaseq/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_no_salmon_no_cleanup.sh
@@ -1,5 +1,7 @@
#!/bin/bash -ve
+CPU=$(nproc || sysctl -n hw.physicalcpu)
+
#######################################################
## Run Trinity to Generate Transcriptome Assemblies ##
#######################################################
@@ -14,7 +16,7 @@
--left reads.left.fq.gz \
--right reads.right.fq.gz \
--SS_lib_type RF \
- --CPU 4 --no_salmon --no_cleanup --verbose
+ --CPU ${CPU} --no_salmon --no_cleanup --verbose
##### Done Running Trinity #####
--- trinityrnaseq.orig/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_wSuperReads.sh
+++ trinityrnaseq/sample_data/test_Trinity_Assembly/misc_run_tests/__runMe_wSuperReads.sh
@@ -1,5 +1,7 @@
#!/bin/bash -ve
+CPU=$(nproc || sysctl -n hw.physicalcpu)
+
#######################################################
## Run Trinity to Generate Transcriptome Assemblies ##
#######################################################
@@ -14,7 +16,7 @@
--left reads.left.fq.gz \
--right reads.right.fq.gz \
--SS_lib_type RF \
- --CPU 4 --output trinity_out_dir_SR --NO_PARALLEL_IWORM --SUPER_READS --no_cleanup
+ --CPU ${CPU} --output trinity_out_dir_SR --NO_PARALLEL_IWORM --SUPER_READS --no_cleanup
##### Done Running Trinity #####
--- trinityrnaseq.orig/trinity_ext_sample_data/test_InSilicoReadNormalization/test_PE_normalization.mult_read_sets.sh
+++ trinityrnaseq/trinity_ext_sample_data/test_InSilicoReadNormalization/test_PE_normalization.mult_read_sets.sh
@@ -1,10 +1,12 @@
#!/bin/bash -ve
+CPU=$(nproc || sysctl -n hw.physicalcpu)
+
# just for testing purposes, use --max_cov 30 or higher for real applications.
$TRINITY_HOME/util/insilico_read_normalization.pl --JM 2G \
--left ../test_DATA/reads.left.fq.gz,../test_DATA/reads2.left.fq.gz \
--right ../test_DATA/reads.right.fq.gz,../test_DATA/reads2.right.fq.gz \
- --seqType fq --max_cov 5 --pairs_together --no_cleanup --CPU 4 --tmp_dir_name tmp_PE_mult_norm_dir \
+ --seqType fq --max_cov 5 --pairs_together --no_cleanup --CPU ${CPU} --tmp_dir_name tmp_PE_mult_norm_dir \
--output test_multi_read_sets_norm_outdir
--- trinityrnaseq.orig/trinity_ext_sample_data/test_InSilicoReadNormalization/test_PE_normalization.sh
+++ trinityrnaseq/trinity_ext_sample_data/test_InSilicoReadNormalization/test_PE_normalization.sh
@@ -1,7 +1,9 @@
#!/bin/bash -ve
+CPU=$(nproc || sysctl -n hw.physicalcpu)
+
# just for testing purposes, use --max_cov 30 or higher for real applications.
-$TRINITY_HOME/util/insilico_read_normalization.pl --JM 2G --left ../test_DATA/reads.left.fq.gz --right ../test_DATA/reads.right.fq.gz --seqType fq --max_cov 5 --pairs_together --no_cleanup --CPU 4 --tmp_dir_name tmp_PE_norm_dir --min_cov 2
+$TRINITY_HOME/util/insilico_read_normalization.pl --JM 2G --left ../test_DATA/reads.left.fq.gz --right ../test_DATA/reads.right.fq.gz --seqType fq --max_cov 5 --pairs_together --no_cleanup --CPU ${CPU} --tmp_dir_name tmp_PE_norm_dir --min_cov 2
--- trinityrnaseq.orig/util/support_scripts/tests/tests.py
+++ trinityrnaseq/util/support_scripts/tests/tests.py
@@ -13,6 +13,7 @@
# Trinity
# Copy the .gz files in sample_data/test_Trinity_Assembly to current directory
# Run using nosetests
+CPUT = len(os.sched_getaffinity(0))
MEM_FLAG = "--max_memory 2G"
TEMP_FILES = ['both.fa', 'inchworm.K25.L25.fa', 'jellyfish.kmers.fa']
@@ -32,7 +33,7 @@
def test_sample_data_seq_count(self):
print "When assembling the sample data, the number of sequences assembled should be between 75 and 100"
self.trinity(
- "Trinity --seqType fq %s --left reads.left.fq.gz,reads2.left.fq.gz --right reads.right.fq.gz,reads2.right.fq.gz --SS_lib_type RF --CPU 4 --no_cleanup" % MEM_FLAG)
+ "Trinity --seqType fq %s --left reads.left.fq.gz,reads2.left.fq.gz --right reads.right.fq.gz,reads2.right.fq.gz --SS_lib_type RF --CPU %d --no_cleanup" % (MEM_FLAG, CPU))
handle = open("trinity_out_dir/Trinity.fasta", "rU")
seq_count = len([x for x in SeqIO.parse(handle, "fasta")])
handle.close()
@@ -41,7 +42,7 @@
def test_sample_data_trimmed_and_normalized(self):
print "When assembling the sample data with the --trimmomatic --normalize_reads flags, the number of sequences assembled should be between 75 and 85"
self.trinity(
- "Trinity --seqType fq %s --left reads.left.fq.gz,reads2.left.fq.gz --right reads.right.fq.gz,reads2.right.fq.gz --SS_lib_type RF --CPU 4 --trimmomatic --normalize_reads --no_cleanup" % MEM_FLAG)
+ "Trinity --seqType fq %s --left reads.left.fq.gz,reads2.left.fq.gz --right reads.right.fq.gz,reads2.right.fq.gz --SS_lib_type RF --CPU %d --trimmomatic --normalize_reads --no_cleanup" % (MEM_FLAG, CPU))
handle = open("trinity_out_dir/Trinity.fasta", "rU")
seq_count = len([x for x in SeqIO.parse(handle, "fasta")])
handle.close()
@@ -50,14 +51,14 @@
def test_no_cleanup_leaves_temp_files(self):
print "The --no_cleanup flag should ensure that the output directory is left behind"
self.trinity(
- "Trinity --seqType fq %s --left reads.left.fq.gz,reads2.left.fq.gz --right reads.right.fq.gz,reads2.right.fq.gz --SS_lib_type RF --CPU 4 --no_cleanup" % MEM_FLAG)
+ "Trinity --seqType fq %s --left reads.left.fq.gz,reads2.left.fq.gz --right reads.right.fq.gz,reads2.right.fq.gz --SS_lib_type RF --CPU %d --no_cleanup" % (MEM_FLAG, CPU))
for f in TEMP_FILES:
self.assertTrue(os.path.exists("trinity_out_dir/%s" % f), msg="%s not found with no_cleanup" % f)
def test_cleanup_removes_temp_files(self):
print "The --full_cleanup flag should ensure that the output directory is gone but the output file remains"
self.trinity(
- "Trinity --seqType fq %s --left reads.left.fq.gz,reads2.left.fq.gz --right reads.right.fq.gz,reads2.right.fq.gz --SS_lib_type RF --CPU 4 --full_cleanup" % MEM_FLAG)
+ "Trinity --seqType fq %s --left reads.left.fq.gz,reads2.left.fq.gz --right reads.right.fq.gz,reads2.right.fq.gz --SS_lib_type RF --CPU %d --full_cleanup" % (MEM_FLAG, CPU))
time.sleep(5) # Make sure the system has time to recognize the directory is gone
self.assertFalse(os.path.exists("trinity_out_dir"), msg="Did full_cleanup but trinity_out_dir exists")
self.assertTrue(os.path.isfile("trinity_out_dir.Trinity.fasta"),
|