├── LICENSE ├── Makefile ├── README ├── README.md ├── SuperReads_RNA ├── LICENSE.txt ├── PkgConfig.pm ├── README.md ├── create_rna_sr.py ├── dist-bin │ ├── gmake │ └── pkg-config ├── global-1 │ ├── LICENSE.txt │ ├── Makefile.am │ ├── Makefile.in │ ├── SuperReadsR │ │ ├── AUTHORS │ │ ├── COPYING │ │ ├── ChangeLog │ │ ├── INSTALL │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ ├── NEWS │ │ ├── README │ │ ├── all_tests │ │ ├── gtest.mk │ │ ├── include │ │ │ ├── binary_search_tree_iterator.hpp │ │ │ ├── charb.hpp │ │ │ ├── charbuf.hpp │ │ │ ├── exp_buffer.hpp │ │ │ ├── exp_vector.hpp │ │ │ ├── fork_exec.hpp │ │ │ ├── gcc_builtins.hpp │ │ │ ├── gzip_stream.hpp │ │ │ ├── heap.hpp │ │ │ ├── jflib │ │ │ │ ├── multiplexed_io.hpp │ │ │ │ ├── multiplexed_parser.hpp │ │ │ │ └── pool.hpp │ │ │ ├── misc.hpp │ │ │ ├── multi_thread_skip_list_map.hpp │ │ │ ├── multi_thread_skip_list_set.hpp │ │ │ ├── rb_node.hpp │ │ │ ├── rb_tree.hpp │ │ │ ├── reallocators.hpp │ │ │ ├── skip_list_common.hpp │ │ │ ├── skip_list_map.hpp │ │ │ ├── skip_list_set.hpp │ │ │ ├── thread_pool.hpp │ │ │ ├── timer.h │ │ │ └── tmpstream.hpp │ │ ├── lib │ │ │ └── fork_exec.cpp │ │ ├── src │ │ │ ├── MasurcaCommon.pm │ │ │ ├── MasurcaConf.pm │ │ │ ├── MasurcaPaths.pm.in │ │ │ ├── MasurcaSuperReads.pm │ │ │ ├── MurmurHash3.cpp │ │ │ ├── MurmurHash3.h │ │ │ ├── aligned_simple_array.hpp │ │ │ ├── assign_reads.cpp │ │ │ ├── bloom_counter2.hpp │ │ │ ├── bloom_filter.hpp │ │ │ ├── bloom_hash.hpp │ │ │ ├── bloom_query.cc │ │ │ ├── bloom_query_cmdline.hpp │ │ │ ├── createSuperReads_RNA │ │ │ ├── create_k_unitigs_common.hpp │ │ │ ├── create_k_unitigs_large_k.cc │ │ │ ├── create_k_unitigs_large_k2.cc │ │ │ ├── create_k_unitigs_large_k2_cmdline.hpp │ │ │ ├── create_k_unitigs_large_k_cmdline.hpp │ │ │ ├── diskBasedUnitigger.h │ │ │ ├── expand_fastq │ │ │ ├── extract_unjoined_pairs.pl │ │ │ ├── extractreads.pl │ │ │ ├── extractreads_not.pl │ │ │ ├── fibonacci_coding.cc │ │ │ ├── fibonacci_coding.hpp │ │ │ ├── gcc_builtins.cc │ │ │ ├── getNumBasesPerReadInFastaFile.perl │ │ │ ├── homo_trim.cc │ │ │ ├── mergeSuperReadsUniquely.pl │ │ │ ├── read_parser.cc │ │ │ ├── read_parser.hpp │ │ │ ├── reduce_sr.cc │ │ │ ├── reduce_sr_cmdline.hpp │ │ │ ├── rename_filter_fastq.cc │ │ │ ├── rename_filter_fastq_cmdline.hpp │ │ │ ├── reverse_complement.cc │ │ │ ├── semaphore.cc │ │ │ ├── semaphore_cmdline.hpp │ │ │ ├── sorted_merge.cc │ │ │ ├── sorted_merge_cmdline.hpp │ │ │ ├── sr_names.hpp │ │ │ ├── superread_index.cpp │ │ │ └── superread_index.hpp │ │ ├── src2 │ │ │ ├── add_missing_mates.pl │ │ │ ├── createFastaSuperReadSequences.cc │ │ │ ├── createKUnitigMaxOverlaps.cc │ │ │ ├── createSuperReadsForDirectory.perl │ │ │ ├── create_sr_frg.cc │ │ │ ├── eliminateBadSuperReadsUsingList.cc │ │ │ ├── findMatchesBetweenKUnitigsAndReads.cc │ │ │ ├── findMatchesBetweenKUnitigsAndReads_cmdline.hpp │ │ │ ├── getLengthStatisticsForKUnitigsFile.perl │ │ │ ├── getSuperReadInsertCountsFromReadPlacementFile.cc │ │ │ ├── getSuperReadInsertCountsFromReadPlacementFileTwoPasses.cc │ │ │ ├── getSuperReadInsertCountsFromReadPlacementFileTwoPasses_cmdline.hpp │ │ │ ├── getSuperReadInsertCountsFromReadPlacementFile_cmdline.hpp │ │ │ ├── joinKUnitigs_v3.cc │ │ │ ├── joinKUnitigs_v3_cmdline.hpp │ │ │ ├── outputAlekseysJellyfishReductionFile.perl │ │ │ ├── outputRecordsNotOnList.cc │ │ │ ├── splitFileAtNs.cc │ │ │ └── translateReduceFile.perl │ │ └── unittests │ │ │ ├── gtest │ │ │ ├── include │ │ │ │ └── gtest │ │ │ │ │ ├── gtest-death-test.h │ │ │ │ │ ├── gtest-message.h │ │ │ │ │ ├── gtest-param-test.h │ │ │ │ │ ├── gtest-printers.h │ │ │ │ │ ├── gtest-spi.h │ │ │ │ │ ├── gtest-test-part.h │ │ │ │ │ ├── gtest-typed-test.h │ │ │ │ │ ├── gtest.h │ │ │ │ │ ├── gtest_pred_impl.h │ │ │ │ │ ├── gtest_prod.h │ │ │ │ │ └── internal │ │ │ │ │ ├── gtest-death-test-internal.h │ │ │ │ │ ├── gtest-filepath.h │ │ │ │ │ ├── gtest-internal.h │ │ │ │ │ ├── gtest-linked_ptr.h │ │ │ │ │ ├── gtest-param-util-generated.h │ │ │ │ │ ├── gtest-param-util.h │ │ │ │ │ ├── gtest-port.h │ │ │ │ │ ├── gtest-string.h │ │ │ │ │ ├── gtest-tuple.h │ │ │ │ │ └── gtest-type-util.h │ │ │ └── src │ │ │ │ ├── gtest-all.cc │ │ │ │ ├── gtest-death-test.cc │ │ │ │ ├── gtest-filepath.cc │ │ │ │ ├── gtest-internal-inl.h │ │ │ │ ├── gtest-port.cc │ │ │ │ ├── gtest-printers.cc │ │ │ │ ├── gtest-test-part.cc │ │ │ │ ├── gtest-typed-test.cc │ │ │ │ ├── gtest.cc │ │ │ │ └── gtest_main.cc │ │ │ ├── misc.cc │ │ │ ├── misc.hpp │ │ │ ├── test_bloom_counter2.cc │ │ │ ├── test_bloom_filter.cc │ │ │ ├── test_charb.cc │ │ │ ├── test_charbuf.cc │ │ │ ├── test_exp_buffer.cc │ │ │ ├── test_exp_vector.cc │ │ │ ├── test_fork_exec.cc │ │ │ ├── test_hash.cc │ │ │ ├── test_heap.cc │ │ │ ├── test_main.cc │ │ │ ├── test_main_cmdline.hpp │ │ │ ├── test_multi_thread_skip_list_map.cc │ │ │ ├── test_multi_thread_skip_list_set.cc │ │ │ ├── test_rbtree.cc │ │ │ ├── test_read_parser.cc │ │ │ ├── test_skip_list_map.cc │ │ │ ├── test_skip_list_set.cc │ │ │ ├── test_sr_names.cc │ │ │ └── test_thread_pool.cc │ ├── aclocal.m4 │ ├── compile │ ├── config.guess │ ├── config.h.in │ ├── config.log │ ├── config.sub │ ├── configure │ ├── configure.ac │ ├── depcomp │ ├── install-sh │ ├── jellyfish │ │ ├── LICENSE │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ ├── README │ │ ├── doc │ │ │ ├── jellyfish.man │ │ │ └── jellyfish.pdf │ │ ├── gtest.mk │ │ ├── include │ │ │ └── jellyfish │ │ │ │ ├── allocators_mmap.hpp │ │ │ │ ├── atomic_bits_array.hpp │ │ │ │ ├── atomic_field.hpp │ │ │ │ ├── atomic_gcc.hpp │ │ │ │ ├── backtrace.hpp │ │ │ │ ├── binary_dumper.hpp │ │ │ │ ├── bloom_common.hpp │ │ │ │ ├── bloom_counter2.hpp │ │ │ │ ├── bloom_filter.hpp │ │ │ │ ├── circular_buffer.hpp │ │ │ │ ├── compare_and_swap.hpp │ │ │ │ ├── cooperative_pool.hpp │ │ │ │ ├── cooperative_pool2.hpp │ │ │ │ ├── cpp_array.hpp │ │ │ │ ├── divisor.hpp │ │ │ │ ├── dumper.hpp │ │ │ │ ├── err.hpp │ │ │ │ ├── file_header.hpp │ │ │ │ ├── generator_manager.hpp │ │ │ │ ├── generic_file_header.hpp │ │ │ │ ├── hash_counter.hpp │ │ │ │ ├── int128.hpp │ │ │ │ ├── jellyfish.hpp │ │ │ │ ├── json.h │ │ │ │ ├── large_hash_array.hpp │ │ │ │ ├── large_hash_iterator.hpp │ │ │ │ ├── locks_pthread.hpp │ │ │ │ ├── mapped_file.hpp │ │ │ │ ├── mer_dna.hpp │ │ │ │ ├── mer_dna_bloom_counter.hpp │ │ │ │ ├── mer_heap.hpp │ │ │ │ ├── mer_iterator.hpp │ │ │ │ ├── mer_overlap_sequence_parser.hpp │ │ │ │ ├── mer_qual_iterator.hpp │ │ │ │ ├── misc.hpp │ │ │ │ ├── offsets_key_value.hpp │ │ │ │ ├── rectangular_binary_matrix.hpp │ │ │ │ ├── simple_circular_buffer.hpp │ │ │ │ ├── sorted_dumper.hpp │ │ │ │ ├── stdio_filebuf.hpp │ │ │ │ ├── storage.hpp │ │ │ │ ├── stream_iterator.hpp │ │ │ │ ├── stream_manager.hpp │ │ │ │ ├── text_dumper.hpp │ │ │ │ ├── thread_exec.hpp │ │ │ │ ├── time.hpp │ │ │ │ ├── token_ring.hpp │ │ │ │ └── whole_sequence_parser.hpp │ │ ├── jellyfish-2.0.pc.in │ │ ├── jellyfish │ │ │ ├── backtrace.cc │ │ │ ├── dbg.cc │ │ │ ├── dbg.hpp │ │ │ ├── fstream_default.hpp │ │ │ ├── generate_sequence.cc │ │ │ ├── generate_sequence_cmdline.hpp │ │ │ ├── merge_files.cc │ │ │ ├── merge_files.hpp │ │ │ ├── mersenne.cpp │ │ │ └── randomc.h │ │ ├── lib │ │ │ ├── allocators_mmap.cc │ │ │ ├── generator_manager.cc │ │ │ ├── int128.cc │ │ │ ├── jsoncpp.cpp │ │ │ ├── mer_dna.cc │ │ │ ├── misc.cc │ │ │ ├── rectangular_binary_matrix.cc │ │ │ ├── storage.cc │ │ │ ├── thread_exec.cc │ │ │ └── time.cc │ │ ├── sub_commands │ │ │ ├── bc_main.cc │ │ │ ├── bc_main_cmdline.hpp │ │ │ ├── cite_main.cc │ │ │ ├── cite_main_cmdline.hpp │ │ │ ├── count_main.cc │ │ │ ├── count_main_cmdline.hpp │ │ │ ├── dump_main.cc │ │ │ ├── dump_main_cmdline.hpp │ │ │ ├── histo_main.cc │ │ │ ├── histo_main_cmdline.hpp │ │ │ ├── info_main.cc │ │ │ ├── info_main_cmdline.hpp │ │ │ ├── jellyfish.cc │ │ │ ├── mem_main.cc │ │ │ ├── mem_main_cmdline.hpp │ │ │ ├── merge_main.cc │ │ │ ├── merge_main_cmdline.hpp │ │ │ ├── query_main.cc │ │ │ ├── query_main_cmdline.hpp │ │ │ ├── stats_main.cc │ │ │ └── stats_main_cmdline.hpp │ │ ├── swig │ │ │ ├── Makefile.am │ │ │ ├── hash_counter.i │ │ │ ├── hash_set.i │ │ │ ├── jellyfish.i │ │ │ ├── mer_dna.i │ │ │ ├── mer_file.i │ │ │ ├── perl5 │ │ │ │ ├── jellyfish.pm │ │ │ │ ├── swig_wrap.cpp │ │ │ │ └── t │ │ │ │ │ ├── test_hash_counter.t │ │ │ │ │ ├── test_mer_file.t │ │ │ │ │ └── test_string_mers.t │ │ │ ├── python │ │ │ │ ├── swig_wrap.cpp │ │ │ │ ├── test_hash_counter.py │ │ │ │ ├── test_mer_file.py │ │ │ │ └── test_string_mers.py │ │ │ ├── ruby │ │ │ │ ├── swig_wrap.cpp │ │ │ │ ├── test_hash_counter.rb │ │ │ │ ├── test_mer_file.rb │ │ │ │ └── test_string_mers.rb │ │ │ └── string_mers.i │ │ ├── tests │ │ │ ├── big.sh │ │ │ ├── bloom_counter.sh │ │ │ ├── bloom_filter.sh │ │ │ ├── generate_sequence.sh │ │ │ ├── large_key.sh │ │ │ ├── merge.sh │ │ │ ├── multi_file.sh │ │ │ ├── parallel_hashing.sh │ │ │ ├── subset_hashing.sh │ │ │ ├── swig_perl.sh │ │ │ ├── swig_python.sh │ │ │ └── swig_ruby.sh │ │ └── unit_tests │ │ │ ├── gtest │ │ │ ├── gtest.h │ │ │ └── src │ │ │ │ ├── gtest-all.cc │ │ │ │ └── gtest_main.cc │ │ │ ├── test_allocators_mmap.cc │ │ │ ├── test_atomic_bits_array.cc │ │ │ ├── test_cooperative_pool2.cc │ │ │ ├── test_dumpers.cc │ │ │ ├── test_file_header.cc │ │ │ ├── test_generator_manager.cc │ │ │ ├── test_hash_counter.cc │ │ │ ├── test_int128.cc │ │ │ ├── test_large_hash_array.cc │ │ │ ├── test_main.cc │ │ │ ├── test_main.hpp │ │ │ ├── test_main_cmdline.hpp │ │ │ ├── test_mapped_file.cc │ │ │ ├── test_mer_dna.cc │ │ │ ├── test_mer_dna_bloom_counter.cc │ │ │ ├── test_mer_heap.cc │ │ │ ├── test_mer_iterator.cc │ │ │ ├── test_mer_overlap_sequence_parser.cc │ │ │ ├── test_misc.cc │ │ │ ├── test_offsets_key_value.cc │ │ │ ├── test_rectangular_binary_matrix.cc │ │ │ ├── test_simple_circular_buffer.cc │ │ │ ├── test_stdio_filebuf.cc │ │ │ ├── test_stream_iterator.cc │ │ │ ├── test_text_dumper.cc │ │ │ ├── test_token_ring.cc │ │ │ ├── test_whole_sequence_parser.cc │ │ │ └── unit_tests.sh │ ├── ltmain.sh │ ├── m4 │ │ ├── ax_openmp.m4 │ │ ├── libtool.m4 │ │ ├── ltoptions.m4 │ │ ├── ltsugar.m4 │ │ ├── ltversion.m4 │ │ ├── lt~obsolete.m4 │ │ ├── m4-ax_perl_ext.m4 │ │ ├── m4-ax_pkg_swig.m4 │ │ └── m4-ax_swig_enable_cxx.m4 │ ├── missing │ ├── quorum │ │ ├── AUTHORS │ │ ├── COPYING │ │ ├── ChangeLog │ │ ├── INSTALL │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ ├── NEWS │ │ ├── README │ │ ├── data │ │ │ └── adapter.jf │ │ ├── gtest.mk │ │ ├── include │ │ │ ├── gzip_stream.hpp │ │ │ ├── jflib │ │ │ │ ├── locks_pthread.hpp │ │ │ │ ├── multiplexed_io.hpp │ │ │ │ └── pool.hpp │ │ │ └── misc.hpp │ │ ├── src │ │ │ ├── create_database.cc │ │ │ ├── create_database_cmdline.hpp │ │ │ ├── err_log.cc │ │ │ ├── err_log.hpp │ │ │ ├── error_correct_reads.cc │ │ │ ├── error_correct_reads.hpp │ │ │ ├── error_correct_reads_cmdline.hpp │ │ │ ├── histo_mer_database.cc │ │ │ ├── kmer.hpp │ │ │ ├── mer_database.hpp │ │ │ ├── merge_mate_pairs.cc │ │ │ ├── merge_mate_pairs_cmdline.hpp │ │ │ ├── query_mer_database.cc │ │ │ ├── quorum.in │ │ │ ├── split_mate_pairs.cc │ │ │ ├── split_mate_pairs_cmdline.hpp │ │ │ └── verbose_log.hpp │ │ └── unit_tests │ │ │ ├── gtest │ │ │ ├── gtest.h │ │ │ └── src │ │ │ │ ├── gtest-all.cc │ │ │ │ └── gtest_main.cc │ │ │ ├── test_mer_database.cc │ │ │ └── test_misc.hpp │ ├── test-driver │ └── ufasta │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ ├── common.hpp │ │ ├── dgrep.cc │ │ ├── dgrep_cmdline.hpp │ │ ├── dsort.cc │ │ ├── dsort_cmdline.hpp │ │ ├── extract.cc │ │ ├── extract_cmdline.hpp │ │ ├── format.cc │ │ ├── format_cmdline.hpp │ │ ├── head.cc │ │ ├── head_cmdline.hpp │ │ ├── hgrep.cc │ │ ├── hgrep_cmdline.hpp │ │ ├── n50.cc │ │ ├── n50_cmdline.hpp │ │ ├── one.cc │ │ ├── one_cmdline.hpp │ │ ├── rc.cc │ │ ├── rc_cmdline.hpp │ │ ├── sizes.cc │ │ ├── sizes_cmdline.hpp │ │ ├── sort.cc │ │ ├── sort_cmdline.hpp │ │ ├── split.cc │ │ ├── split_cmdline.hpp │ │ ├── tail.cc │ │ ├── tail_cmdline.hpp │ │ ├── tests │ │ ├── test1.fasta │ │ ├── test_dgrep.sh │ │ ├── test_dsort.sh │ │ ├── test_extract.sh │ │ ├── test_format.sh │ │ ├── test_head.sh │ │ ├── test_hgrep.sh │ │ ├── test_n50.sh │ │ ├── test_one.sh │ │ ├── test_rc.sh │ │ ├── test_sizes.sh │ │ ├── test_sort.sh │ │ ├── test_split.sh │ │ ├── test_tail.sh │ │ └── testsh.in │ │ └── ufasta.cc └── install.sh ├── gclib ├── GArgs.cpp ├── GArgs.h ├── GBam.cpp ├── GBam.h ├── GBase.cpp ├── GBase.h ├── GBitVec.h ├── GFaSeqGet.cpp ├── GFaSeqGet.h ├── GFastaIndex.cpp ├── GFastaIndex.h ├── GHash.hh ├── GIntHash.hh ├── GList.hh ├── GStr.cpp ├── GStr.h ├── GThreads.cpp ├── GThreads.h ├── GVec.hh ├── codons.cpp ├── codons.h ├── gdna.cpp ├── gdna.h ├── gff.cpp ├── gff.h ├── proc_mem.cpp └── proc_mem.h ├── prepDE.py ├── prep_linux.sh ├── prep_mac.sh ├── prep_source.sh ├── rlink.cpp ├── rlink.h ├── samtools-0.1.18 ├── AUTHORS ├── COPYING ├── ChangeLog ├── INSTALL ├── Makefile ├── NEWS ├── bam.c ├── bam.h ├── bam2bcf.c ├── bam2bcf.h ├── bam2bcf_indel.c ├── bam2depth.c ├── bam_aux.c ├── bam_cat.c ├── bam_color.c ├── bam_endian.h ├── bam_import.c ├── bam_index.c ├── bam_lpileup.c ├── bam_mate.c ├── bam_md.c ├── bam_pileup.c ├── bam_plcmd.c ├── bam_reheader.c ├── bam_rmdup.c ├── bam_rmdupse.c ├── bam_sort.c ├── bam_stat.c ├── bam_tview.c ├── bamtk.c ├── bedidx.c ├── bgzf.c ├── bgzf.h ├── bgzip.c ├── cut_target.c ├── errmod.c ├── errmod.h ├── faidx.c ├── faidx.h ├── kaln.c ├── kaln.h ├── khash.h ├── klist.h ├── knetfile.c ├── knetfile.h ├── kprobaln.c ├── kprobaln.h ├── kseq.h ├── ksort.h ├── kstring.c ├── kstring.h ├── phase.c ├── razf.c ├── razf.h ├── razip.c ├── sam.c ├── sam.h ├── sam_header.c ├── sam_header.h ├── sam_view.c ├── sample.c ├── sample.h └── samtools.1 ├── stringtie.cpp ├── tablemaker.cpp ├── tablemaker.h ├── tag_git.sh ├── tmerge.cpp └── tmerge.h /SuperReads_RNA/dist-bin/gmake: -------------------------------------------------------------------------------- 1 | /usr/bin/make -------------------------------------------------------------------------------- /SuperReads_RNA/dist-bin/pkg-config: -------------------------------------------------------------------------------- 1 | /home/skovaka/SuperReads_RNA-1.0.1/PkgConfig.pm -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = jellyfish ufasta quorum SuperReadsR 2 | ACLOCAL_AMFLAGS = -I m4 3 | 4 | EXTRA_DIST = LICENSE.txt 5 | 6 | install-special: 7 | @echo $(SUBDIRS) | tr ' ' '\n' | grep -v '^CA' | while read subdir; do \ 8 | echo "Making install in $$subdir pwd `pwd`"; \ 9 | $(MAKE) $(AM_MAKEFLAGS) -C $$subdir install; \ 10 | done 11 | @echo $(SUBDIRS) | tr ' ' '\n' | grep '^CA' | while read subdir; do \ 12 | echo "Making install in $$subdir"; \ 13 | $(MAKE) $(AM_MAKEFLAGS) -C $$subdir install bindir=$(dir $(bindir))/$$subdir/$(LOCAL_NAME)/bin; \ 14 | done 15 | 16 | # Print the value of a variable 17 | print-%: 18 | @echo -n $($*) 19 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/AUTHORS: -------------------------------------------------------------------------------- 1 | Mike Roberts 2 | Aleksey Zimin 3 | Guillaume Marcais 4 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skovaka/stringtie2/647ab5124e18e99164b45a7fa325240ec7a1b56d/SuperReads_RNA/global-1/SuperReadsR/ChangeLog -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skovaka/stringtie2/647ab5124e18e99164b45a7fa325240ec7a1b56d/SuperReads_RNA/global-1/SuperReadsR/NEWS -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/README: -------------------------------------------------------------------------------- 1 | Installation 2 | ============ 3 | 4 | % ./configure 5 | % make 6 | % sudo make install 7 | 8 | See INSTALLATION for more details. 9 | 10 | LEGALESE 11 | ======== 12 | 13 | * GNU parallel is licensed under the GPL version 3 license. 14 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/all_tests: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skovaka/stringtie2/647ab5124e18e99164b45a7fa325240ec7a1b56d/SuperReads_RNA/global-1/SuperReadsR/all_tests -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/gtest.mk: -------------------------------------------------------------------------------- 1 | ############################## 2 | # Gtest build. 3 | ############################## 4 | # Build rules for libraries. 5 | # check_LTLIBRARIES = libgtest.la libgtest_main.la 6 | 7 | # libgtest_la_SOURCES = unittests/gtest/src/gtest-all.cc 8 | # libgtest_main_la_SOURCES = unittests/gtest/src/gtest_main.cc 9 | # libgtest_main_la_LIBADD = libgtest.la 10 | # libgtest_la_CXXFLAGS = -I$(srcdir)/unittests/gtest \ 11 | # -I$(srcdir)/unittests/gtest/include 12 | # libgtest_main_la_CXXFLAGS = -I$(srcdir)/unittests/gtest \ 13 | # -I$(srcdir)/unittests/gtest/include 14 | 15 | check_LIBRARIES = libgtest.a libgtest_main.a 16 | 17 | libgtest_a_SOURCES = unittests/gtest/src/gtest-all.cc 18 | libgtest_main_a_SOURCES = unittests/gtest/src/gtest_main.cc 19 | libgtest_main_a_LIBADD = libgtest.a 20 | libgtest_a_CXXFLAGS = -I$(srcdir)/unittests/gtest \ 21 | -I$(srcdir)/unittests/gtest/include 22 | libgtest_main_a_CXXFLAGS = -I$(srcdir)/unittests/gtest \ 23 | -I$(srcdir)/unittests/gtest/include 24 | 25 | # gtest source files that we don't compile directly. They are 26 | # #included by gtest-all.cc. 27 | GTEST_SRC = unittests/gtest/src/gtest-death-test.cc \ 28 | unittests/gtest/src/gtest-filepath.cc \ 29 | unittests/gtest/src/gtest-internal-inl.h \ 30 | unittests/gtest/src/gtest-port.cc \ 31 | unittests/gtest/src/gtest-printers.cc \ 32 | unittests/gtest/src/gtest-test-part.cc \ 33 | unittests/gtest/src/gtest-typed-test.cc \ 34 | unittests/gtest/src/gtest.cc 35 | 36 | EXTRA_DIST += $(GTEST_SRC) 37 | 38 | # Headers, not installed 39 | GTEST_I = unittests/gtest/include/gtest 40 | noinst_HEADERS += $(GTEST_I)/gtest-death-test.h \ 41 | $(GTEST_I)/gtest-message.h \ 42 | $(GTEST_I)/gtest-param-test.h \ 43 | $(GTEST_I)/gtest-printers.h $(GTEST_I)/gtest-spi.h \ 44 | $(GTEST_I)/gtest-test-part.h \ 45 | $(GTEST_I)/gtest-typed-test.h $(GTEST_I)/gtest.h \ 46 | $(GTEST_I)/gtest_pred_impl.h $(GTEST_I)/gtest_prod.h \ 47 | $(GTEST_I)/internal/gtest-death-test-internal.h \ 48 | $(GTEST_I)/internal/gtest-filepath.h \ 49 | $(GTEST_I)/internal/gtest-internal.h \ 50 | $(GTEST_I)/internal/gtest-linked_ptr.h \ 51 | $(GTEST_I)/internal/gtest-param-util-generated.h \ 52 | $(GTEST_I)/internal/gtest-param-util.h \ 53 | $(GTEST_I)/internal/gtest-port.h \ 54 | $(GTEST_I)/internal/gtest-string.h \ 55 | $(GTEST_I)/internal/gtest-tuple.h \ 56 | $(GTEST_I)/internal/gtest-type-util.h 57 | 58 | 59 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/include/fork_exec.hpp: -------------------------------------------------------------------------------- 1 | /** @file fork_exec.hpp 2 | * Defines a family of functions: fork_exec*. They behave like 3 | * calling fork followed by exec. The return value and errno reflect 4 | * the success of both the fork and exec system call (even though 5 | * technically the exec system call was performed by a child 6 | * process). In other word, if fork_exec* returns a valid PID 7 | * (i.e. not -1), then it is guaranteed that the child process is 8 | * executing. The status returned by `wait` or `waitpid` is whatever 9 | * is returned by the program executed. 10 | */ 11 | 12 | /** 13 | * Fork and exec, like execvp. Return the pid of the child process in 14 | * case of success or -1 in case of failure (of either fork, execvp or 15 | * some other syscall: close, pipe). Errno is set properly. See the 16 | * man page for `exec`. 17 | * 18 | * @param file Path to executable. 19 | * @param argv Null terminated array of arguments (C strings) 20 | * @return -1 on error. Pid of child process on success. 21 | */ 22 | pid_t fork_execvp(const char* file, char *const argv[]); 23 | 24 | /** 25 | * Fork and exec, like execlp. 26 | * 27 | * @param file Path to executable 28 | * @param arg 0th argument (executable name), followed by a 0 terminated list of arguments. 29 | * @return -1 on error. Pid of child process on success. 30 | * @see fork_execvp. 31 | */ 32 | pid_t fork_execlp(const char* file, const char* arg, ...); 33 | 34 | /** 35 | * Split command on white spaces, then fork and exec. Warning: this 36 | * command modifies its input argument. 37 | * 38 | * @param cmd Command to execute. 39 | * @return -1 on error. Pid of child process on success. 40 | * @see fork_execvp 41 | */ 42 | pid_t fork_exec(char* cmd); 43 | 44 | /** 45 | * Split command on white spaces, then fork and exec. @see fork_execvp. 46 | */ 47 | pid_t fork_exec(const char* cmd); 48 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/include/gcc_builtins.hpp: -------------------------------------------------------------------------------- 1 | /* SuperRead pipeline 2 | * Copyright (C) 2012 Genome group at University of Maryland. 3 | * 4 | * This program is free software: you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation, either version 3 of the 7 | * License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | 19 | #ifndef __GCC_BUILTINS_HPP__ 20 | #define __GCC_BUILTINS_HPP__ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | // TODO: check in configure the existence of hardware version 27 | template 28 | int ctz(T x); 29 | 30 | template<> 31 | int ctz(unsigned int x); 32 | template<> 33 | int ctz(unsigned long x); 34 | template<> 35 | int ctz(unsigned long long x); 36 | 37 | #ifdef HAVE_BUILTIN_PREFETCH 38 | inline void prefetch_read_no(const void* addr) { __builtin_prefetch(addr, 0, 0); } 39 | inline void prefetch_read_low(const void* addr) { __builtin_prefetch(addr, 0, 1); } 40 | inline void prefetch_read_med(const void* addr) { __builtin_prefetch(addr, 0, 2); } 41 | inline void prefetch_read_high(const void* addr) { __builtin_prefetch(addr, 0, 3); } 42 | inline void prefetch_write_no(const void* addr) { __builtin_prefetch(addr, 1, 0); } 43 | inline void prefetch_write_low(const void* addr) { __builtin_prefetch(addr, 1, 1); } 44 | inline void prefetch_write_med(const void* addr) { __builtin_prefetch(addr, 1, 2); } 45 | inline void prefetch_write_high(const void* addr) { __builtin_prefetch(addr, 1, 3); } 46 | #else // HAVE_BUILTIN_PREFETCH 47 | inline void prefetch_read_no(const void* addr) { } 48 | inline void prefetch_read_low(const void* addr) { } 49 | inline void prefetch_read_med(const void* addr) { } 50 | inline void prefetch_read_high(const void* addr) { } 51 | inline void prefetch_write_no(const void* addr) { } 52 | inline void prefetch_write_low(const void* addr) { } 53 | inline void prefetch_write_med(const void* addr) { } 54 | inline void prefetch_write_high(const void* addr) { } 55 | #endif // HAVE_BUILTIN_PREFETCH 56 | 57 | 58 | #endif /* __GCC_BUILTINS_HPP__ */ 59 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/include/gzip_stream.hpp: -------------------------------------------------------------------------------- 1 | /* SuperRead pipeline 2 | * Copyright (C) 2012 Genome group at University of Maryland. 3 | * 4 | * This program is free software: you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation, either version 3 of the 7 | * License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | 19 | #ifndef __GZIP_STREAM__ 20 | #define __GZIP_STREAM__ 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | template > 28 | class basic_gzipstream : public std::ostream { 29 | typedef __gnu_cxx::stdio_filebuf<_CharT> stdbuf; 30 | public: 31 | basic_gzipstream(const char *filename) : std::ostream(open_gzip(filename)), closed(false) { } 32 | virtual ~basic_gzipstream() { 33 | close(); 34 | delete rdbuf(); 35 | } 36 | void close() { 37 | if(!closed) { 38 | flush(); 39 | pclose(((stdbuf*)rdbuf())->file()); 40 | closed = true; 41 | } 42 | } 43 | 44 | private: 45 | static stdbuf *open_gzip(const char *filename) { 46 | std::string command("gzip -1 > '"); 47 | command += filename; 48 | command += "'"; 49 | FILE *f = popen(command.c_str(), "w"); 50 | if(!f) 51 | throw std::runtime_error("popen failed"); 52 | return new stdbuf(f, std::ios::out); 53 | } 54 | bool closed; 55 | }; 56 | 57 | typedef basic_gzipstream gzipstream; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/include/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef TIMER_H 2 | #define TIMER_H 3 | 4 | #include 5 | 6 | 7 | class Timer { 8 | private: 9 | clock_t start; 10 | 11 | public: 12 | inline Timer() { 13 | start = clock(); 14 | } 15 | 16 | inline int reset() { 17 | start = clock(); 18 | } 19 | 20 | inline float get() { 21 | return float( (long double)(clock() - start) / 22 | (long double)CLOCKS_PER_SEC ); 23 | } 24 | 25 | inline float lap() { 26 | float ret = get(); 27 | reset(); 28 | return ret; 29 | } 30 | }; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/include/tmpstream.hpp: -------------------------------------------------------------------------------- 1 | /* SuperRead pipeline 2 | * Copyright (C) 2012 Genome group at University of Maryland. 3 | * 4 | * This program is free software: you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation, either version 3 of the 7 | * License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | 19 | #ifndef __TMP_FILE_H_ 20 | #define __TMP_FILE_H_ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | /** Temporary file stream. Wrapper around FILE* tmpfile(). It seems 27 | * that stdio_filebuf creates a memory leak by not closing fclose on 28 | * the file descriptor. Oh well! 29 | */ 30 | 31 | template > 32 | class basic_tmpstream : public std::iostream { 33 | typedef __gnu_cxx::stdio_filebuf<_CharT> stdbuf; 34 | public: 35 | basic_tmpstream() : std::iostream(open_tmp()) { } 36 | virtual ~basic_tmpstream() { close(); delete rdbuf(); } 37 | bool is_open() { return ((stdbuf*)rdbuf())->is_open(); } 38 | void close() { 39 | if(is_open()) { 40 | stdbuf* buf = (stdbuf*)rdbuf(); 41 | ::fclose(buf->file()); 42 | buf->close(); 43 | } 44 | } 45 | private: 46 | static stdbuf * open_tmp() { 47 | FILE *f = tmpfile(); 48 | if(!f) 49 | throw std::runtime_error("Failed to create a temporary file."); 50 | return new stdbuf(f, std::ios::in|std::ios::out); 51 | } 52 | }; 53 | typedef basic_tmpstream tmpstream; 54 | 55 | 56 | #endif /* __TMP_FILE_H_ */ 57 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/src/MasurcaPaths.pm.in: -------------------------------------------------------------------------------- 1 | package MasurcaPaths; 2 | 3 | use strict; 4 | use warnings; 5 | use File::Spec; 6 | 7 | our (@ISA, @EXPORT, @EXPORT_OK); 8 | 9 | BEGIN { 10 | require Exporter; 11 | @ISA = qw(Exporter); 12 | @EXPORT_OK = qw($BINDIR $LIBDIR $PERL_EXT_LIB); 13 | } 14 | 15 | our ($BINDIR, $LIBDIR, $PERL_EXT_LIB); 16 | $BINDIR = "@bindir@"; 17 | $LIBDIR = "@libdir@"; 18 | $PERL_EXT_LIB = "@PERL_EXT_DIR@"; 19 | 20 | sub rel_ext_bin { 21 | return File::Spec->abs2rel($PERL_EXT_LIB, $BINDIR); 22 | } 23 | 24 | 1; 25 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/src/bloom_hash.hpp: -------------------------------------------------------------------------------- 1 | /* SuperRead pipeline 2 | * Copyright (C) 2012 Genome group at University of Maryland. 3 | * 4 | * This program is free software: you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation, either version 3 of the 7 | * License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | 19 | #ifndef __BLOOM_HASH_HPP__ 20 | #define __BLOOM_HASH_HPP__ 21 | 22 | #include 23 | 24 | /* Hash pairs 25 | */ 26 | template 27 | class hash_pair { }; 28 | 29 | template <> 30 | class hash_pair { 31 | public: 32 | void operator()(const char* const key, uint64_t *hashes) const { 33 | MurmurHash3_x64_128(key, strlen(key), 0, hashes); 34 | } 35 | }; 36 | 37 | #endif // __BLOOM_HASH_HPP__ 38 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/src/bloom_query.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | bloom_query_cmdline args; 8 | 9 | struct mer_dna_hash { 10 | void operator()(const jellyfish::mer_dna& m, uint64_t *hashes) const { 11 | MurmurHash3_T_128(m, (m.k() / 4) + (m.k() % 4 != 0), 0, hashes); 12 | } 13 | }; 14 | typedef bloom_counter2 mer_bloom_counter2; 15 | 16 | int main(int argc, char *argv[]) 17 | { 18 | args.parse(argc, argv); 19 | 20 | jellyfish::mer_dna::k(args.mer_arg); 21 | 22 | jellyfish::mapped_file dbf(args.input_arg); 23 | uint64_t* base = (uint64_t*)dbf.base(); 24 | mer_bloom_counter2 mers(base[0], base[1], (unsigned char*)(base + 2)); 25 | 26 | std::string word; 27 | jellyfish::mer_dna m; 28 | jellyfish::mer_dna mq; 29 | while(true) { 30 | std::cin >> word; 31 | if(!std::cin) 32 | break; 33 | m = word; 34 | mq = m; 35 | mq.reverse_complement(); 36 | std::cout << word << " " << mers[m < mq ? m : mq] << "\n"; 37 | } 38 | 39 | return 0; 40 | } 41 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/src/expand_fastq: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | FILE="$1" 4 | 5 | check_fastq () { 6 | [ $1 = "@" ] || { 7 | echo >&2 "File '$FILE' is not a fastq file" 8 | exit 1 9 | } 10 | } 11 | 12 | case $(file -L -b -i "$FILE") in 13 | (application/*gzip*) 14 | FIRST=$(gunzip -c "$FILE" | head -c 1) 15 | check_fastq $FIRST 16 | exec gunzip -c "$FILE" 17 | ;; 18 | 19 | (application/*bzip2*) 20 | FIRST=$(bunzip2 -c "$FILE" | head -c 1) 21 | check_fastq $FIRST 22 | exec bunzip2 -c "$FILE" 23 | ;; 24 | 25 | (application/x-xz*) 26 | FIRST=$(unxz -c "$FILE" | head -c 1) 27 | check_fastq $FIRST 28 | exec unxz -c "$FILE" 29 | ;; 30 | 31 | (text/*) 32 | FIRST=$(head -c 1 "$FILE") 33 | check_fastq $FIRST 34 | exec cat "$FILE" 35 | ;; 36 | 37 | (*) 38 | echo >&2 "WARNING!!! Unknown file type for input file '$FILE', assuming type text/" 39 | FIRST=$(head -c 1 "$FILE") 40 | check_fastq $FIRST 41 | exec cat "$FILE" 42 | ;; 43 | esac 44 | 45 | 46 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/src/extract_unjoined_pairs.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # SuperRead pipeline 3 | # Copyright (C) 2012 Genome group at University of Maryland. 4 | # 5 | # This program is free software: you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License as 7 | # published by the Free Software Foundation, either version 3 of the 8 | # License, or (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | 18 | my $flag=0; 19 | 20 | while($line=) 21 | { 22 | chomp($line); 23 | @F=split(/\s+/,$line); 24 | if($flag==0) 25 | { 26 | $sr_pair=$F[1]; 27 | if(int(substr($F[0],2))%2==0) 28 | { 29 | $insert=$F[0]; 30 | } 31 | else 32 | { 33 | $insert=substr($F[0],0,2).int(substr($F[0],2))-1; 34 | } 35 | $flag=1; 36 | } 37 | elsif($flag==1) 38 | { 39 | $srh{"$sr_pair $F[1]"}.="$insert "; 40 | $srh{"$F[1] $sr_pair"}.="$insert "; 41 | push(@pairs,"$sr_pair $F[1]"); 42 | $flag=0; 43 | } 44 | } 45 | 46 | foreach $v (@pairs) 47 | { 48 | @f=split(/ /,$v); 49 | if(defined($srh{"$f[0] $f[1]"}) && defined($srh{"$f[1] $f[0]"})) 50 | { 51 | print "$v : ",$srh{"$f[0] $f[1]"},"\n"; 52 | } 53 | } 54 | 55 | 56 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/src/extractreads.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # SuperRead pipeline 3 | # Copyright (C) 2012 Genome group at University of Maryland. 4 | # 5 | # This program is free software: you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License as 7 | # published by the Free Software Foundation, either version 3 of the 8 | # License, or (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | 18 | $infile1 = $ARGV[0]; #file with read names 19 | $infile2 = $ARGV[1]; #fasta file 20 | $fieldnum = $ARGV[2]-1; #field number 21 | 22 | open (FILE1, $infile1); 23 | open (FILE2, $infile2); 24 | my %readnames; 25 | while ($line = ){ 26 | chomp($line); 27 | $readnames{$line}=1; 28 | } 29 | close(FILE1); 30 | 31 | my $sequence=""; 32 | my $readname=""; 33 | open (OUTFILE, ">$outfile"); 34 | while ($line = ){ 35 | if ($line =~ /^>/){ 36 | if(defined $readnames{$readname}){ 37 | print ">$readname\n$sequence\n"; 38 | } 39 | chomp($line); 40 | @f=split(/\s+/,substr($line,1)); 41 | $readname=$f[$fieldnum]; 42 | $sequence=""; 43 | }else{ 44 | chomp($line); 45 | $sequence.=$line; 46 | } 47 | } 48 | if(defined $readnames{$readname}) 49 | { 50 | print ">$readname\n$sequence\n"; 51 | } 52 | 53 | close (FILE2); 54 | 55 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/src/extractreads_not.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # SuperRead pipeline 3 | # Copyright (C) 2012 Genome group at University of Maryland. 4 | # 5 | # This program is free software: you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License as 7 | # published by the Free Software Foundation, either version 3 of the 8 | # License, or (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | 18 | $infile1 = $ARGV[0]; #file with read names 19 | $infile2 = $ARGV[1]; #fasta file 20 | $fieldnum = $ARGV[2]-1; #field number 21 | 22 | open (FILE1, $infile1); 23 | open (FILE2, $infile2); 24 | my %readnames; 25 | while ($line = ){ 26 | chomp($line); 27 | $readnames{$line}=1; 28 | } 29 | close(FILE1); 30 | 31 | my $sequence=""; 32 | my $readname=""; 33 | open (OUTFILE, ">$outfile"); 34 | while ($line = ){ 35 | if ($line =~ /^>/){ 36 | if(not(defined $readnames{$readname}) && not($readname eq "")){ 37 | print ">$readname\n$sequence\n"; 38 | } 39 | chomp($line); 40 | @f=split(/\s+/,substr($line,1)); 41 | $readname=$f[$fieldnum]; 42 | $sequence=""; 43 | }else{ 44 | chomp($line); 45 | $sequence.=$line; 46 | } 47 | } 48 | if(not(defined $readnames{$readname}) && not($readname eq "")){ 49 | print ">$readname\n$sequence\n"; 50 | } 51 | close (FILE2); 52 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/src/fibonacci_coding.hpp: -------------------------------------------------------------------------------- 1 | /* SuperRead pipeline 2 | * Copyright (C) 2012 Genome group at University of Maryland. 3 | * 4 | * This program is free software: you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation, either version 3 of the 7 | * License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | 19 | #ifndef __FIBONACCI_CODING_HPP__ 20 | #define __FIBONACCI_CODING_HPP__ 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | struct fibonacci { 28 | static const uint64_t *fibs; 29 | 30 | template 31 | static int encode(T x, T &res) { 32 | const uint64_t * f = fibs + 8 * sizeof(T) - 1; 33 | x++; 34 | if(x <= (T)0 || x >= *f) { 35 | errno = EINVAL; // Number is negative or too large 36 | return -1; 37 | } 38 | 39 | f = std::upper_bound(fibs, f, x) - 1; 40 | int high_bit = f - fibs; 41 | res = (T)1 << high_bit; 42 | x -= *f; 43 | while(x > 0) { 44 | f = std::upper_bound(fibs, f, x) - 1; 45 | res |= (T)1 << (f - fibs); 46 | x -= *f; 47 | } 48 | 49 | return high_bit + 1; 50 | } 51 | 52 | template 53 | static T decode(T x) { 54 | T res = 0; 55 | for(const uint64_t *f = fibs; x; x >>= 1, ++f) 56 | if(x & 0x1) 57 | res += *f; 58 | return res - 1; 59 | } 60 | }; 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/src/gcc_builtins.cc: -------------------------------------------------------------------------------- 1 | /* SuperRead pipeline 2 | * Copyright (C) 2012 Genome group at University of Maryland. 3 | * 4 | * This program is free software: you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation, either version 3 of the 7 | * License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | 19 | #include 20 | 21 | template<> 22 | int ctz(unsigned int x) { return __builtin_ctz(x); } 23 | template<> 24 | int ctz(unsigned long x) { return __builtin_ctzl(x); } 25 | template<> 26 | int ctz(unsigned long long x) { return __builtin_ctzll(x); } 27 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/src/getNumBasesPerReadInFastaFile.perl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # Pass the name of a fasta file as an arg and this gives the number of 3 | # bases in each read of the fasta file 4 | # SuperRead pipeline 5 | # Copyright (C) 2012 Genome group at University of Maryland. 6 | # 7 | # This program is free software: you can redistribute it and/or 8 | # modify it under the terms of the GNU General Public License as 9 | # published by the Free Software Foundation, either version 3 of the 10 | # License, or (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | # General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program. If not, see . 19 | 20 | if ($#ARGV != 0) { 21 | open (FILE, $0); 22 | while ($line = ) { 23 | last unless ($line =~ /^\#/); 24 | print $line; 25 | } 26 | close (FILE); 27 | exit; 28 | } 29 | $file = $ARGV[0]; 30 | $cmd = "zcat -f $file |"; 31 | open (FILE, $cmd); 32 | $isFirstRead = 1; 33 | while ($line = ) { 34 | if ($line =~ /^>/) { 35 | if (! $isFirstRead) { print "$readLen\n"; } 36 | $readLen = 0; 37 | $isFirstRead = 0; 38 | } 39 | else { 40 | $len = length ($line)-1; 41 | $readLen += $len; 42 | } 43 | } 44 | if (! $isFirstRead) { print "$readLen\n"; } 45 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/src/homo_trim.cc: -------------------------------------------------------------------------------- 1 | /* SuperRead pipeline 2 | * Copyright (C) 2012 Genome group at University of Maryland. 3 | * 4 | * This program is free software: you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation, either version 3 of the 7 | * License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | 19 | #include 20 | #include 21 | #include 22 | int main(int argc, char *argv[]) 23 | { 24 | ssize_t i,sequence_len; 25 | charb my_string(100),sequence(100); 26 | ssize_t *index_array; 27 | ssize_t max_val=0,max_ind=0; 28 | double num_cg=0; 29 | char last_letter; 30 | index_array = (ssize_t*)malloc(sizeof(ssize_t)*1000000); 31 | 32 | if(argc==1) 33 | { 34 | printf("Need one agrument -- minimum peak height to trim!\n"); 35 | return(1); 36 | } 37 | 38 | while(1) 39 | { 40 | if(!fgets(my_string,stdin)){ 41 | break; 42 | } 43 | else 44 | { 45 | if(my_string[0]=='>') 46 | { 47 | max_val=0; 48 | max_ind=0; 49 | num_cg=0; 50 | if(!fgets(sequence, stdin)) 51 | { 52 | return(1); 53 | } 54 | sequence_len=strlen(sequence); 55 | // printf("sequence_len=%d\n",sequence_len); 56 | last_letter=sequence[sequence_len-2]; 57 | // printf("last_letter=%c\n",last_letter); 58 | for(i=sequence_len-3;i>=0;i--) 59 | { 60 | if(sequence[i] != last_letter) 61 | { 62 | num_cg--; 63 | last_letter=sequence[i]; 64 | } 65 | else 66 | { 67 | num_cg++; 68 | } 69 | index_array[sequence_len-3-i]=num_cg; 70 | } 71 | for(i=0;imax_val) 74 | { 75 | max_val=index_array[i]; 76 | max_ind=i+1; 77 | } 78 | } 79 | // printf("max_val=%d max_ind=%d\n",max_val,max_ind); 80 | if(max_val<(ssize_t)atoi(argv[1])) 81 | max_ind=0; 82 | sequence[sequence_len-max_ind-1]='\0'; 83 | printf("%s%s\n",(char*)my_string,(char *)sequence); 84 | } 85 | } 86 | } 87 | return(0); 88 | } 89 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/src/reverse_complement.cc: -------------------------------------------------------------------------------- 1 | /* SuperRead pipeline 2 | * Copyright (C) 2012 Genome group at University of Maryland. 3 | * 4 | * This program is free software: you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation, either version 3 of the 7 | * License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | int main(int argc, char *argv[]) 25 | { 26 | ssize_t bytes_read,i,j; 27 | charb my_string(100000),rev_sequence(100000); 28 | 29 | while(1) 30 | { 31 | if(fgets (my_string, 1, stdin)==NULL) 32 | break; 33 | else 34 | { 35 | if(my_string[0]=='>') 36 | { 37 | printf("%s",(char*)my_string); 38 | } 39 | else 40 | { 41 | bytes_read=strlen(my_string); 42 | j=0; 43 | for(i=bytes_read-2;i>=0;i--) 44 | { 45 | switch (my_string[i]) 46 | { 47 | case 'A': rev_sequence[j]='T';break; 48 | case 'C': rev_sequence[j]='G';break; 49 | case 'G': rev_sequence[j]='C';break; 50 | case 'T': rev_sequence[j]='A';break; 51 | case 'a': rev_sequence[j]='t';break; 52 | case 'c': rev_sequence[j]='g';break; 53 | case 'g': rev_sequence[j]='c';break; 54 | case 't': rev_sequence[j]='a';break; 55 | default: rev_sequence[j]='N'; 56 | } 57 | j++; 58 | } 59 | rev_sequence[j]='\0'; 60 | printf("%s\n",(char*)rev_sequence); 61 | } 62 | } 63 | } 64 | return(0); 65 | } 66 | 67 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/src2/add_missing_mates.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # SuperRead pipeline 3 | # Copyright (C) 2012 Genome group at University of Maryland. 4 | # 5 | # This program is free software: you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License as 7 | # published by the Free Software Foundation, either version 3 of the 8 | # License, or (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | 18 | # 19 | #This program adds missing mates to the read fasta files "on the fly" 20 | 21 | use strict; 22 | use warnings; 23 | 24 | my $readnumberHold = -1; 25 | my ($editlineHold, $prefixHold, $sequenceHold); 26 | while(my $line=){ 27 | chomp($line); 28 | my ($first, $editline) = split(' ', $line, 2); 29 | my $prefix = substr($first, 1, 2); 30 | my $readnumber = int(substr($first, 3)); 31 | 32 | if(($readnumber % 2) == 0){#if the read is even we simply remember it 33 | if($readnumberHold!=-1){ 34 | print(">", $prefixHold, $readnumberHold, " ", $editlineHold, "\n", $sequenceHold, 35 | "\n>", $prefixHold, $readnumberHold+1, "\nN\n"); 36 | } 37 | $prefixHold = $prefix; 38 | $readnumberHold = $readnumber; 39 | $editlineHold = $editline; 40 | $sequenceHold = ; 41 | chomp($sequenceHold); 42 | } 43 | elsif($readnumberHold==-1){#the previous even read is missing 44 | print(">", $prefix, $readnumber-1,"\nN\n", $line, "\n", scalar()); 45 | } 46 | elsif($readnumber-1!=$readnumberHold){#previous mate is missing odd and current is missing even 47 | print(">", $prefixHold, $readnumberHold, " ", $editlineHold, "\n", $sequenceHold, 48 | "\n>", $prefixHold, $readnumberHold+1, "\nN\n>", $prefix, $readnumber-1, "\nN\n", 49 | $line, "\n", scalar()); 50 | $readnumberHold = -1; 51 | } 52 | else { # if($readnumber-1==$readnumberHold) 53 | print(">", $prefixHold, $readnumberHold, " ", $editlineHold, "\n", $sequenceHold, "\n", $line, "\n", scalar()); 54 | $readnumberHold = -1; 55 | } 56 | } 57 | 58 | if($readnumberHold != -1) { 59 | print(">", $prefixHold, $readnumberHold, " ", $editlineHold, "\n", $sequenceHold, 60 | "\n>", $prefixHold, $readnumberHold+1, "\nN\n"); 61 | } 62 | 63 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/src2/getLengthStatisticsForKUnitigsFile.perl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # SuperRead pipeline 3 | # Copyright (C) 2012 Genome group at University of Maryland. 4 | # 5 | # This program is free software: you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License as 7 | # published by the Free Software Foundation, either version 3 of the 8 | # License, or (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | 18 | # Cat the k-unitig fasta file through 19 | $workingDir = "."; 20 | $outputPrefix = ""; 21 | for ($i=0; $i<=$#ARGV; $i++) { 22 | $arg = $ARGV[$i]; 23 | if ($arg eq "-output-prefix") { 24 | ++$i; 25 | $outputPrefix = $ARGV[$i]; 26 | if ($outputPrefix !~ /\.$/) { $outputPrefix .= "."; } 27 | next; } 28 | $workingDir = $arg; 29 | } 30 | 31 | $numKUnitigsFile = $outputPrefix . "numKUnitigs.txt"; 32 | $maxKUnitigNumberFile = $outputPrefix . "maxKUnitigNumber.txt"; 33 | $totBasesInKUnitigsFile = $outputPrefix . "totBasesInKUnitigs.txt"; 34 | $isFirstRead = 1; 35 | while ($line = ) { 36 | if ($line =~ /^>/) { 37 | if (! $isFirstRead) { $kUnitigLengths[$kUnitig] = $kUnitigLength; } 38 | $kUnitigLength = 0; 39 | $isFirstRead = 0; 40 | ($kUnitig) = ($line =~ /^.(\S+)\s/); 41 | } 42 | else { 43 | $len = length ($line)-1; 44 | $kUnitigLength += $len; 45 | } 46 | } 47 | if (! $isFirstRead) { $kUnitigLengths[$kUnitig] = $kUnitigLength; } 48 | 49 | for ($i=0; $i<=$#kUnitigLengths; $i++) { 50 | $length = $kUnitigLengths[$i]; 51 | $totBasesInKUnitigs += $length; 52 | if (! $length) { 53 | $length = 0; } 54 | else { 55 | ++$numKUnitigs; } 56 | print "$i $length\n"; 57 | } 58 | open (OUTFILE, ">", "$workingDir/$numKUnitigsFile"); 59 | print OUTFILE "$numKUnitigs\n"; 60 | close (OUTFILE); 61 | open (OUTFILE, ">", "$workingDir/$maxKUnitigNumberFile"); 62 | $arraySizeForKUnitigData = $#kUnitigLengths+1; 63 | print OUTFILE "$arraySizeForKUnitigData\n"; 64 | close (OUTFILE); 65 | open (OUTFILE, ">", "$workingDir/$totBasesInKUnitigsFile"); 66 | print OUTFILE "$totBasesInKUnitigs\n"; 67 | close (OUTFILE); 68 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/src2/outputAlekseysJellyfishReductionFile.perl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # Take the input from the first arg 3 | # Takes an optional second arg: The max number of times to output a k-mer 4 | # (default is 2) 5 | $maxTimesToRepeat = 2; 6 | $inputFile = $ARGV[0]; 7 | if ($#ARGV >= 1) { 8 | $maxTimesToRepeat = $ARGV[1]; } 9 | 10 | print ">0\n"; 11 | $cmd = "jellyfish dump -c $inputFile |"; 12 | open (FILE, $cmd); 13 | while ($line = ) { 14 | chomp ($line); 15 | ($kmer, $count) = split (" ", $line); 16 | if ($count> $maxTimesToRepeat) { 17 | $countOut = $maxTimesToRepeat; } 18 | else { 19 | $countOut = $count; } 20 | for ($i=0; $i<$countOut; $i++) { 21 | print $kmer,"N"; } 22 | } 23 | close (FILE); 24 | print "\n"; 25 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/src2/translateReduceFile.perl: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env perl 2 | # Pass 2 args: the name of the files containing 3 | # (1) The original super-read names, and 4 | # (2) The name of the input reduce file (e.g. reduce.tmp) 5 | $superReadCount = 0; 6 | open (FILE, $ARGV[0]); 7 | while ($line = ) { 8 | chomp ($line); 9 | $newSuperReadName{$line} = $superReadCount; 10 | ++$superReadCount; } 11 | close (FILE); 12 | 13 | open (FILE, $ARGV[1]); 14 | while ($line = ) { 15 | chomp ($line); 16 | @flds = split (" ", $line); 17 | $flds[0] = $newSuperReadName{$flds[0]}; 18 | $flds[1] = $newSuperReadName{$flds[1]}; 19 | print "@flds\n"; 20 | } 21 | close (FILE); 22 | 23 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/unittests/gtest/include/gtest/gtest_prod.h: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // Google C++ Testing Framework definitions useful in production code. 33 | 34 | #ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 35 | #define GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 36 | 37 | // When you need to test the private or protected members of a class, 38 | // use the FRIEND_TEST macro to declare your tests as friends of the 39 | // class. For example: 40 | // 41 | // class MyClass { 42 | // private: 43 | // void MyMethod(); 44 | // FRIEND_TEST(MyClassTest, MyMethod); 45 | // }; 46 | // 47 | // class MyClassTest : public testing::Test { 48 | // // ... 49 | // }; 50 | // 51 | // TEST_F(MyClassTest, MyMethod) { 52 | // // Can call MyClass::MyMethod() here. 53 | // } 54 | 55 | #define FRIEND_TEST(test_case_name, test_name)\ 56 | friend class test_case_name##_##test_name##_Test 57 | 58 | #endif // GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 59 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/unittests/gtest/src/gtest-all.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: mheule@google.com (Markus Heule) 31 | // 32 | // Google C++ Testing Framework (Google Test) 33 | // 34 | // Sometimes it's desirable to build Google Test by compiling a single file. 35 | // This file serves this purpose. 36 | 37 | // This line ensures that gtest.h can be compiled on its own, even 38 | // when it's fused. 39 | #include "gtest/gtest.h" 40 | 41 | // The following lines pull in the real gtest *.cc files. 42 | #include "src/gtest.cc" 43 | #include "src/gtest-death-test.cc" 44 | #include "src/gtest-filepath.cc" 45 | #include "src/gtest-port.cc" 46 | #include "src/gtest-printers.cc" 47 | #include "src/gtest-test-part.cc" 48 | #include "src/gtest-typed-test.cc" 49 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/unittests/gtest/src/gtest_main.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #include 31 | 32 | #include "gtest/gtest.h" 33 | 34 | GTEST_API_ int main(int argc, char **argv) { 35 | std::cout << "Running main() from gtest_main.cc\n"; 36 | 37 | testing::InitGoogleTest(&argc, argv); 38 | return RUN_ALL_TESTS(); 39 | } 40 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/unittests/misc.cc: -------------------------------------------------------------------------------- 1 | /* SuperRead pipeline 2 | * Copyright (C) 2012 Genome group at University of Maryland. 3 | * 4 | * This program is free software: you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation, either version 3 of the 7 | * License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | 19 | #include 20 | 21 | void pdo(unsigned int n, void* (*f)(void*), void *data) { 22 | pthread_t tids[n]; 23 | for(unsigned int i = 0; i < n; ++i) { 24 | int e = pthread_create(&tids[i], 0, f, data); 25 | if(e) 26 | throw std::runtime_error(strerror(e)); 27 | } 28 | for(unsigned int i = 0; i < n; ++i) { 29 | int e = pthread_join(tids[i], 0); 30 | if(e) 31 | throw std::runtime_error(strerror(e)); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/unittests/misc.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __MISC_HPP__ 2 | #define __MISC_HPP__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | void pdo(unsigned int n, void* (*f)(void*), void *data); 9 | 10 | #endif /* __MISC_HPP__ */ 11 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/unittests/test_charbuf.cc: -------------------------------------------------------------------------------- 1 | /* SuperRead pipeline 2 | * Copyright (C) 2012 Genome group at University of Maryland. 3 | * 4 | * This program is free software: you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation, either version 3 of the 7 | * License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | TEST(Charstream, Output) { 24 | charstream s(10); 25 | const char *l1 = "Hello\n"; 26 | const char *l2 = "Longer text\n"; 27 | const char *l3 = "Sho\n"; 28 | 29 | s << l1; 30 | EXPECT_EQ(strlen(l1), s.size()); 31 | std::ostringstream os1; 32 | os1 << s; 33 | EXPECT_STREQ(l1, os1.str().c_str()); 34 | s.rewind(); 35 | EXPECT_EQ((size_t)0, s.size()); 36 | 37 | s << l2; 38 | EXPECT_EQ(strlen(l2), s.size()); 39 | std::ostringstream os2; 40 | os2 << s; 41 | EXPECT_STREQ(l2, os2.str().c_str()); 42 | s.rewind(); 43 | EXPECT_EQ((size_t)0, s.size()); 44 | 45 | s << l3; 46 | EXPECT_EQ(strlen(l3), s.size()); 47 | std::ostringstream os3; 48 | os3 << s; 49 | EXPECT_STREQ(l3, os3.str().c_str()); 50 | s.rewind(); 51 | EXPECT_EQ((size_t)0, s.size()); 52 | } 53 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/unittests/test_exp_vector.cc: -------------------------------------------------------------------------------- 1 | /* SuperRead pipeline 2 | * Copyright (C) 2012 Genome group at University of Maryland. 3 | * 4 | * This program is free software: you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation, either version 3 of the 7 | * License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | 19 | #include 20 | #include 21 | 22 | TEST(ExpVector, Subscript) { 23 | exp_vector ev; 24 | exp_vector evd(5); 25 | 26 | EXPECT_EQ(int(), ev.default_value()); 27 | EXPECT_EQ(5, evd.default_value()); 28 | 29 | ev[10] = 5; 30 | evd[10] = 10; 31 | for(int i = 0; i < 10; ++i) { 32 | EXPECT_EQ(int(), ev[i]); 33 | EXPECT_EQ(5, evd[i]); 34 | } 35 | EXPECT_EQ(5, ev[10]); 36 | EXPECT_EQ(10, evd[10]); 37 | } 38 | 39 | TEST(ExpVector, Float) { 40 | exp_vector fv; 41 | exp_vector fvd(0, 5.0); 42 | 43 | fv[10] = 10.0; 44 | fvd[10] = 10.0; 45 | 46 | for(int i = 0; i < 10; ++i) { 47 | EXPECT_FLOAT_EQ(float(), fv[i]); 48 | EXPECT_FLOAT_EQ((float)5.0, fvd[i]); 49 | } 50 | 51 | EXPECT_FLOAT_EQ((float)10.0, fv[10]); 52 | EXPECT_FLOAT_EQ((float)10.0, fvd[10]); 53 | } 54 | 55 | TEST(ExpVector, Initialization) { 56 | static const size_t size = 100; 57 | exp_vector iv(size); 58 | 59 | EXPECT_EQ(size, iv.size()); 60 | for(size_t i = 0; i < size; ++i) 61 | EXPECT_EQ(0, iv[i]); 62 | } 63 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/unittests/test_fork_exec.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | 7 | namespace { 8 | TEST(ForkExec,ExecVP) { 9 | pid_t res; 10 | 11 | { 12 | char* cmd[2] = { (char*)"/surely this does not exists in root", (char*)0 }; 13 | res = fork_execvp("bad", cmd); 14 | EXPECT_EQ(-1, res); 15 | } 16 | 17 | { 18 | char* cmd[2] = { (char*)"true", 0 }; 19 | res = fork_execvp("true", cmd); 20 | EXPECT_LT(0, res); 21 | int status; 22 | pid_t wpid = waitpid(res, &status, 0); 23 | EXPECT_EQ(res, wpid); 24 | ASSERT_EQ(true, WIFEXITED(status)); 25 | EXPECT_EQ(EXIT_SUCCESS, WEXITSTATUS(status)); 26 | } 27 | } 28 | TEST(ForkExec,ExecLP) { 29 | pid_t res; 30 | 31 | res = fork_execlp("bad", "/this one does not exists either", (char*)0); 32 | EXPECT_EQ(-1, res); 33 | 34 | res = fork_execlp("false", "false", (char*)0); 35 | EXPECT_LT(0, res); 36 | int status; 37 | pid_t wpid = waitpid(res, &status, 0); 38 | EXPECT_EQ(res, wpid); 39 | ASSERT_EQ(true, WIFEXITED(status)); 40 | EXPECT_EQ(EXIT_FAILURE, WEXITSTATUS(status)); 41 | } 42 | TEST(ForkExec,Exec) { 43 | pid_t res; 44 | 45 | res = fork_exec("/surely_you_are_joking_Mr._Feynam is that right"); 46 | EXPECT_EQ(-1, res); 47 | 48 | res = fork_exec("true ignored argument"); 49 | EXPECT_LT(0, res); 50 | int status; 51 | pid_t wpid = waitpid(res, &status, 0); 52 | EXPECT_EQ(res, wpid); 53 | ASSERT_EQ(true, WIFEXITED(status)); 54 | EXPECT_EQ(EXIT_SUCCESS, WEXITSTATUS(status)); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/unittests/test_hash.cc: -------------------------------------------------------------------------------- 1 | /* SuperRead pipeline 2 | * Copyright (C) 2012 Genome group at University of Maryland. 3 | * 4 | * This program is free software: you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation, either version 3 of the 7 | * License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | 19 | #include 20 | #include 21 | 22 | class rand_block_string { 23 | std::string str_; 24 | 25 | public: 26 | rand_block_string(int length) : str_(length, '\0') { 27 | for(int i = 0; i != length; ++i) 28 | str_[i] = (char)((random() % 255) + 1); 29 | } 30 | 31 | // Subscript by 64 bit word 32 | uint64_t operator[](unsigned int i) const { 33 | uint64_t* ptr = (uint64_t*)str_.c_str() + i; 34 | return *ptr; 35 | } 36 | const char* raw() const { return str_.c_str(); } 37 | size_t len() const { return str_.size(); } 38 | }; 39 | 40 | TEST(MurmurHash3, Generic) { 41 | rand_block_string str(random() % 200); 42 | uint32_t seed = random(); 43 | uint64_t original[2]; 44 | uint64_t generic[2]; 45 | 46 | MurmurHash3_x64_128(str.raw(), str.len(), seed, original); 47 | MurmurHash3_T_128(str, str.len(), seed, generic); 48 | EXPECT_EQ(original[0], generic[0]); 49 | EXPECT_EQ(original[1], generic[1]); 50 | } 51 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/unittests/test_main.cc: -------------------------------------------------------------------------------- 1 | /* SuperRead pipeline 2 | * Copyright (C) 2012 Genome group at University of Maryland. 3 | * 4 | * This program is free software: you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation, either version 3 of the 7 | * License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | int main(int argc, char *argv[]) { 26 | ::testing::InitGoogleTest(&argc, argv); 27 | cmdline_parse args(argc, argv); 28 | 29 | unsigned int seed; 30 | if(args.seed_given) { 31 | seed = args.seed_arg; 32 | } else { 33 | std::ifstream urandom("/dev/urandom"); 34 | urandom.read((char*)&seed, sizeof(seed)); 35 | if(!urandom.good()) { 36 | std::cerr << "Failed to read random seed" << std::endl; 37 | return 1; 38 | } 39 | } 40 | 41 | std::cout << "Using random seed " << seed << std::endl; 42 | srandom(seed); 43 | 44 | return RUN_ALL_TESTS(); 45 | } 46 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/unittests/test_sr_names.cc: -------------------------------------------------------------------------------- 1 | /* SuperRead pipeline 2 | * Copyright (C) 2012 Genome group at University of Maryland. 3 | * 4 | * This program is free software: you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation, either version 3 of the 7 | * License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | TEST(SR_name, encode_decode) { 26 | long sr_name_len = random() % 10; 27 | charb sr_original; 28 | charb one_entry; 29 | sprintf(sr_original, "%ld%c", random(), random() % 2 ? 'R' : 'F'); 30 | for(long i = 1; i < sr_name_len; ++i) { 31 | sprintf(one_entry, "_%ld_%ld%c", random() % 100, random(), random() %2 ? 'R' : 'F'); 32 | strcat(sr_original, one_entry); 33 | } 34 | 35 | sr_name sr(sr_original); 36 | charb res; 37 | sr.to_str(res); 38 | EXPECT_STREQ(sr_original, res); 39 | } 40 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/SuperReadsR/unittests/test_thread_pool.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | namespace { 5 | int square(int x) { return x * x; } 6 | 7 | TEST(ThreadPool, Squares) { 8 | static const int nb_threads = 10; 9 | static const int nb_jobs = 100 * nb_threads; 10 | 11 | int res[nb_jobs]; 12 | 13 | thread_pool tp(nb_threads, square); 14 | for(int i = 0; i < nb_jobs; ++i) 15 | tp.submit_job(&i, &res[i]); 16 | tp.release_workers(); 17 | 18 | for(int i = 0; i < nb_jobs; ++i) 19 | EXPECT_EQ(i * i, res[i]); 20 | 21 | EXPECT_EQ(nb_jobs, tp.jobs_done()); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/doc/jellyfish.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skovaka/stringtie2/647ab5124e18e99164b45a7fa325240ec7a1b56d/SuperReads_RNA/global-1/jellyfish/doc/jellyfish.pdf -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/gtest.mk: -------------------------------------------------------------------------------- 1 | ############################## 2 | # Gtest build. 3 | ############################## 4 | # Build rules for libraries. 5 | check_LTLIBRARIES = libgtest.la libgtest_main.la 6 | 7 | libgtest_la_SOURCES = unit_tests/gtest/src/gtest-all.cc 8 | libgtest_main_la_SOURCES = unit_tests/gtest/src/gtest_main.cc 9 | libgtest_main_la_LIBADD = libgtest.la 10 | libgtest_la_CXXFLAGS = -I$(srcdir)/unit_tests 11 | libgtest_main_la_CXXFLAGS = -I$(srcdir)/unit_tests 12 | 13 | GTEST_SRC = unit_tests/gtest/src/gtest-all.cc \ 14 | unit_tests/gtest/src/gtest_main.cc \ 15 | unit_tests/gtest/gtest.h 16 | 17 | EXTRA_DIST += $(GTEST_SRC) 18 | 19 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/include/jellyfish/allocators_mmap.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of Jellyfish. 2 | 3 | Jellyfish is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | Jellyfish is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with Jellyfish. If not, see . 15 | */ 16 | 17 | #ifndef __JELLYFISH_ALLOCATORS_MMAP_HPP__ 18 | #define __JELLYFISH_ALLOCATORS_MMAP_HPP__ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #include 27 | 28 | namespace allocators { 29 | class mmap { 30 | void *ptr_; 31 | size_t size_; 32 | 33 | public: 34 | mmap() : ptr_(MAP_FAILED), size_(0) {} 35 | explicit mmap(size_t _size) : ptr_(MAP_FAILED), size_(0) { 36 | realloc(_size); 37 | } 38 | mmap(mmap&& rhs) : ptr_(rhs.ptr_), size_(rhs.size_) { 39 | rhs.ptr_ = MAP_FAILED; 40 | rhs.size_ = 0; 41 | } 42 | ~mmap() { free(); } 43 | 44 | mmap& operator=(mmap&& rhs) { 45 | swap(rhs); 46 | return *this; 47 | } 48 | 49 | void swap(mmap& rhs) { 50 | std::swap(ptr_, rhs.ptr_); 51 | std::swap(size_, rhs.size_); 52 | } 53 | 54 | void *get_ptr() const { return ptr_ != MAP_FAILED ? ptr_ : NULL; } 55 | size_t get_size() const { return size_; } 56 | void free(); 57 | void *realloc(size_t new_size); 58 | int lock() { return mlock(ptr_, size_); } 59 | int unlock() { return munlock(ptr_, size_); } 60 | 61 | // Return a a number of bytes which is a number of whole pages at 62 | // least as large as size. 63 | static size_t round_to_page(size_t _size); 64 | 65 | private: 66 | static const int nb_threads = 4; 67 | struct tinfo { 68 | pthread_t thid; 69 | char *start, *end; 70 | size_t pgsize; 71 | }; 72 | void fast_zero(); 73 | static void * _fast_zero(void *_info); 74 | }; 75 | inline void swap(mmap& a, mmap& b) { a.swap(b); } 76 | } 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/include/jellyfish/atomic_gcc.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of Jellyfish. 2 | 3 | Jellyfish is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | Jellyfish is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with Jellyfish. If not, see . 15 | */ 16 | 17 | #ifndef __JELLYFISH_ATOMIC_GCC_HPP__ 18 | #define __JELLYFISH_ATOMIC_GCC_HPP__ 19 | 20 | namespace atomic 21 | { 22 | class gcc 23 | { 24 | public: 25 | template 26 | static inline T cas(volatile T *ptr, T oval, T nval) { 27 | return __sync_val_compare_and_swap(ptr, oval, nval); 28 | } 29 | 30 | template 31 | static inline T set(T *ptr, T nval) { 32 | return __sync_lock_test_and_set(ptr, nval); 33 | } 34 | 35 | template 36 | static inline T add_fetch(volatile T *ptr, T x) { 37 | T ncount = *ptr, count; 38 | do { 39 | count = ncount; 40 | ncount = cas((T *)ptr, count, count + x); 41 | } while(ncount != count); 42 | return count + x; 43 | } 44 | 45 | template 46 | static inline T fetch_add(volatile T *ptr, T x) { 47 | T ncount = *ptr, count; 48 | do { 49 | count = ncount; 50 | ncount = cas((T *)ptr, count, (T)(count + x)); 51 | } while(ncount != count); 52 | return count; 53 | } 54 | 55 | template 56 | static inline T set_to_max(volatile T *ptr, T x) { 57 | T count = *ptr; 58 | while(x > count) { 59 | T ncount = cas(ptr, count, x); 60 | if(ncount == count) 61 | return x; 62 | count = ncount; 63 | } 64 | return count; 65 | } 66 | }; 67 | } 68 | #endif 69 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/include/jellyfish/backtrace.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of Jellyfish. 2 | 3 | Jellyfish is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | Jellyfish is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with Jellyfish. If not, see . 15 | */ 16 | 17 | void print_backtrace(); 18 | void show_backtrace(); 19 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/include/jellyfish/jellyfish.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of Jellyfish. 2 | 3 | Jellyfish is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | Jellyfish is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with Jellyfish. If not, see . 15 | */ 16 | 17 | #ifndef __JELLYFISH_JELLYFISH_HPP__ 18 | #define __JELLYFISH_JELLYFISH_HPP__ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | typedef jellyfish::cooperative::hash_counter mer_hash; 27 | typedef mer_hash::array mer_array; 28 | typedef jellyfish::text_dumper text_dumper; 29 | typedef jellyfish::text_reader text_reader; 30 | typedef jellyfish::binary_dumper binary_dumper; 31 | typedef jellyfish::binary_reader binary_reader; 32 | typedef jellyfish::binary_query_base binary_query; 33 | typedef jellyfish::binary_writer binary_writer; 34 | typedef jellyfish::text_writer text_writer; 35 | 36 | 37 | #endif /* __JELLYFISH_JELLYFISH_HPP__ */ 38 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/include/jellyfish/mer_dna_bloom_counter.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of Jellyfish. 2 | 3 | Jellyfish is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | Jellyfish is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with Jellyfish. If not, see . 15 | */ 16 | 17 | #ifndef __JELLYFISH_MER_DNA_BLOOM_COUNTER_HPP_ 18 | #define __JELLYFISH_MER_DNA_BLOOM_COUNTER_HPP_ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | namespace jellyfish { 27 | template<> 28 | struct hash_pair { 29 | RectangularBinaryMatrix m1, m2; 30 | 31 | hash_pair() : m1(8 * sizeof(uint64_t), mer_dna::k() * 2), m2(8 * sizeof(uint64_t), mer_dna::k() * 2) { 32 | m1.randomize(random_bits); 33 | m2.randomize(random_bits); 34 | } 35 | 36 | hash_pair(RectangularBinaryMatrix&& m1_, RectangularBinaryMatrix&& m2_) : m1(m1_), m2(m2_) { } 37 | 38 | void operator()(const mer_dna& k, uint64_t* hashes) const { 39 | hashes[0] = m1.times(k); 40 | hashes[1] = m2.times(k); 41 | } 42 | }; 43 | 44 | typedef bloom_counter2 mer_dna_bloom_counter; 45 | typedef bloom_counter2_file mer_dna_bloom_counter_file; 46 | typedef bloom_filter mer_dna_bloom_filter; 47 | typedef bloom_filter_file mer_dna_bloom_filter_file; 48 | } 49 | 50 | #endif /* __JELLYFISH_MER_DNA_BLOOM_COUNTER_HPP_ */ 51 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/include/jellyfish/storage.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of Jellyfish. 2 | 3 | Jellyfish is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | Jellyfish is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with Jellyfish. If not, see . 15 | */ 16 | 17 | #ifndef __JELLYFISH_STORAGE_HPP__ 18 | #define __JELLYFISH_STORAGE_HPP__ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | namespace jellyfish { 25 | 26 | class storage_t { 27 | public: 28 | storage_t() {} 29 | virtual ~storage_t() {} 30 | }; 31 | 32 | // Entry 0 is used only when switching to a large field 33 | extern const size_t *quadratic_reprobes; 34 | 35 | } 36 | 37 | #endif // __STORAGE_HPP__ 38 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/include/jellyfish/thread_exec.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of Jellyfish. 2 | 3 | Jellyfish is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | Jellyfish is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with Jellyfish. If not, see . 15 | */ 16 | 17 | #ifndef __JELLYFISH_THREAD_EXEC_HPP__ 18 | #define __JELLYFISH_THREAD_EXEC_HPP__ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | namespace jellyfish { 30 | class thread_exec { 31 | struct thread_info { 32 | int id; 33 | pthread_t thid; 34 | thread_exec *self; 35 | }; 36 | static void *start_routine(void *); 37 | std::vector infos; 38 | 39 | public: 40 | define_error_class(Error); 41 | thread_exec() {} 42 | virtual ~thread_exec() {} 43 | virtual void start(int id) = 0; 44 | void exec(int nb_threads); 45 | void join(); 46 | void exec_join(int nb_threads) { 47 | exec(nb_threads); 48 | join(); 49 | } 50 | }; 51 | } // namespace jellyfish { 52 | 53 | #endif // __THREAD_EXEC_HPP__ 54 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/include/jellyfish/time.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of Jellyfish. 2 | 3 | Jellyfish is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | Jellyfish is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with Jellyfish. If not, see . 15 | */ 16 | 17 | #ifndef __JELLYFISH_TIME_HPP__ 18 | #define __JELLYFISH_TIME_HPP__ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | class Time { 26 | static const suseconds_t max_useconds = 1000000UL; 27 | struct timeval tv; 28 | 29 | public: 30 | static const Time zero; 31 | explicit Time(bool init = true) { 32 | if(init) 33 | now(); 34 | } 35 | Time(time_t sec, suseconds_t usec) { 36 | tv.tv_sec = sec; 37 | tv.tv_usec = usec; 38 | } 39 | Time &operator=(const Time &o) { 40 | if(&o != this) { 41 | tv.tv_sec = o.tv.tv_sec; 42 | tv.tv_usec = o.tv.tv_usec; 43 | } 44 | return *this; 45 | } 46 | 47 | Time & operator-=(const Time &o) { 48 | tv.tv_sec -= o.tv.tv_sec; 49 | if(o.tv.tv_usec > tv.tv_usec) { 50 | tv.tv_usec = (max_useconds + tv.tv_usec) - o.tv.tv_usec; 51 | --tv.tv_sec; 52 | } else { 53 | tv.tv_usec -= o.tv.tv_usec; 54 | } 55 | return *this; 56 | } 57 | const Time operator-(const Time &o) const { 58 | return Time(*this) -= o; 59 | } 60 | 61 | Time & operator+=(const Time &o) { 62 | tv.tv_sec += o.tv.tv_sec; 63 | tv.tv_usec += o.tv.tv_usec; 64 | if(tv.tv_usec >= max_useconds) { 65 | ++tv.tv_sec; 66 | tv.tv_usec -= max_useconds; 67 | } 68 | return *this; 69 | } 70 | const Time operator+(const Time &o) const { 71 | return Time(*this) += o; 72 | } 73 | 74 | bool operator<(const Time& o) const { 75 | return tv.tv_sec < o.tv.tv_sec || (tv.tv_sec == o.tv.tv_sec && tv.tv_usec < o.tv.tv_usec); 76 | } 77 | 78 | void now() { gettimeofday(&tv, NULL); } 79 | Time elapsed() const { 80 | return Time() - *this; 81 | } 82 | 83 | 84 | std::string str() const { 85 | std::ostringstream res; 86 | res << tv.tv_sec << "." 87 | << std::setfill('0') << std::setw(6) << std::right << tv.tv_usec; 88 | return res.str(); 89 | } 90 | }; 91 | 92 | #endif // __TIME_HPP__ 93 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/include/jellyfish/token_ring.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of Jellyfish. 2 | 3 | Jellyfish is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | Jellyfish is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with Jellyfish. If not, see . 15 | */ 16 | 17 | #ifndef __JELLYFISH_TOKEN_RING_HPP__ 18 | #define __JELLYFISH_TOKEN_RING_HPP__ 19 | 20 | #include 21 | #include 22 | 23 | namespace jellyfish { 24 | template 25 | class token_ring { 26 | public: 27 | class token { 28 | bool val; 29 | cond_t cond; 30 | token* next; 31 | friend class token_ring; 32 | 33 | public: 34 | void wait() { 35 | cond.lock(); 36 | while(!val) { cond.wait(); } 37 | cond.unlock(); 38 | } 39 | 40 | void pass() { 41 | next->cond.lock(); 42 | val = false; 43 | next->val = true; 44 | next->cond.signal(); 45 | next->cond.unlock(); 46 | } 47 | }; 48 | 49 | protected: 50 | typedef std::vector token_list; 51 | typedef typename token_list::iterator token_iterator; 52 | token_list tokens; 53 | 54 | void initialize() { 55 | if(tokens.size() == 0) 56 | return; 57 | 58 | tokens.front().val = true; 59 | tokens.back().next = &tokens.front(); 60 | 61 | for(size_t i = 1; i < tokens.size(); ++i) { 62 | tokens[i].val = false; 63 | tokens[i-1].next = &tokens[i]; 64 | } 65 | } 66 | 67 | public: 68 | token_ring(int nb_tokens) : 69 | tokens(nb_tokens) 70 | { initialize(); } 71 | 72 | ~token_ring() { } 73 | 74 | token& operator[](int i) { return tokens[i]; } 75 | 76 | void reset() { 77 | if(tokens.size() == 0) 78 | return; 79 | 80 | token_iterator it = tokens.begin(); 81 | it->val = true; 82 | for(++it; it != tokens.end(); ++it) 83 | it->val = false; 84 | } 85 | }; 86 | } // namespace jellyfish { 87 | #endif 88 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/jellyfish-2.0.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: Jellyfish 7 | Description: A multi-threaded hash based k-mer counter. 8 | Version: @PACKAGE_VERSION@ 9 | Libs: -L${libdir} -ljellyfish-2.0 -lpthread 10 | Cflags: -I${includedir}/jellyfish-@PACKAGE_VERSION@ 11 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/jellyfish/backtrace.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #ifndef HAVE_EXECINFO_H 4 | 5 | void show_backtrace() {} 6 | 7 | #else 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | void print_backtrace() { 17 | void *trace_elems[20]; 18 | int trace_elem_count(backtrace(trace_elems, 20)); 19 | backtrace_symbols_fd(trace_elems, trace_elem_count, 2); 20 | } 21 | 22 | static void handler() { 23 | // Display message of last thrown exception if any 24 | try { throw; } 25 | catch(const std::exception& e) { 26 | int status; 27 | size_t n = 0; 28 | char *name = abi::__cxa_demangle(typeid(e).name(), 0, &n, &status); 29 | std::cerr << "terminate called after throwing an instance of '" 30 | << (status < 0 ? "UNKNOWN" : name) 31 | << "'\n what(): " << e.what() << "\n"; 32 | if(n) 33 | free(name); 34 | } 35 | catch(...) {} 36 | 37 | print_backtrace(); 38 | abort(); 39 | } 40 | 41 | void show_backtrace() { 42 | std::set_terminate(handler); 43 | } 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/jellyfish/dbg.cc: -------------------------------------------------------------------------------- 1 | /* This file is part of Jellyfish. 2 | 3 | Jellyfish is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | Jellyfish is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with Jellyfish. If not, see . 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | namespace dbg { 22 | pthread_mutex_t print_t::_lock = PTHREAD_MUTEX_INITIALIZER; 23 | volatile pid_t print_t::_print_tid = 0; 24 | 25 | #ifdef DEBUG 26 | Time _tic_time; 27 | #endif 28 | 29 | void tic() { 30 | #ifdef DEBUG 31 | _tic_time.now(); 32 | #endif 33 | } 34 | Time toc() { 35 | #ifdef DEBUG 36 | Time t; 37 | return t - _tic_time; 38 | #else 39 | return Time::zero; 40 | #endif 41 | } 42 | 43 | #ifdef SYS_gettid 44 | pid_t gettid() { return (pid_t)syscall(SYS_gettid); } 45 | #else 46 | pid_t gettid() { return getpid(); } 47 | #endif 48 | 49 | int print_t::set_signal(int signum) { 50 | struct sigaction act; 51 | memset(&act, '\0', sizeof(act)); 52 | act.sa_sigaction = signal_handler; 53 | act.sa_flags = SA_SIGINFO; 54 | return sigaction(signum, &act, 0); 55 | } 56 | 57 | void print_t::signal_handler(int signum, siginfo_t *info, void *context) { 58 | #ifdef HAVE_SI_INT 59 | if(info->si_code != SI_QUEUE) 60 | return; 61 | _print_tid = info->si_int; 62 | #endif 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/jellyfish/merge_files.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of Jellyfish. 2 | 3 | Jellyfish is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | Jellyfish is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with Jellyfish. If not, see . 15 | */ 16 | 17 | #ifndef __JELLYFISH_MERGE_FILES_HPP__ 18 | #define __JELLYFISH_MERGE_FILES_HPP__ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | define_error_class(MergeError); 25 | 26 | /// Merge files. Throw a MergeError in case of error. 27 | void merge_files(std::vector input_files, const char* out_file, 28 | jellyfish::file_header& h, uint64_t min, uint64_t max); 29 | 30 | #endif /* __JELLYFISH_MERGE_FILES_HPP__ */ 31 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/lib/mer_dna.cc: -------------------------------------------------------------------------------- 1 | /* This file is part of Jellyfish. 2 | 3 | Jellyfish is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | Jellyfish is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with Jellyfish. If not, see . 15 | */ 16 | 17 | 18 | #include 19 | 20 | namespace jellyfish { namespace mer_dna_ns { 21 | const char* const error_different_k = "Length of k-mers are different"; 22 | const char* const error_short_string = "Input string is to short"; 23 | } } // namespace jellyfish { namespace mer_dna_ns 24 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/lib/thread_exec.cc: -------------------------------------------------------------------------------- 1 | /* This file is part of Jellyfish. 2 | 3 | Jellyfish is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | Jellyfish is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with Jellyfish. If not, see . 15 | */ 16 | 17 | #include 18 | 19 | void jellyfish::thread_exec::exec(int nb_threads) { 20 | struct thread_info empty = {0, 0, 0}; 21 | infos.resize(nb_threads, empty); 22 | 23 | for(int i = 0; i < nb_threads; i++) { 24 | infos[i].id = i; 25 | infos[i].self = this; 26 | int err = pthread_create(&infos[i].thid, NULL, start_routine, &infos[i]); 27 | if(err) 28 | throw Error(err::msg() << "Can't create thread: " << err::no); 29 | } 30 | } 31 | 32 | void jellyfish::thread_exec::join() { 33 | for(unsigned int i = 0; i < infos.size(); i++) { 34 | int err = pthread_join(infos[i].thid, NULL); 35 | if(err) 36 | throw Error(err::msg() << "Can't join thread '" << infos[i].thid << "': " << err::no); 37 | } 38 | } 39 | 40 | void *jellyfish::thread_exec::start_routine(void *_info) { 41 | struct thread_info *info = (struct thread_info *)_info; 42 | info->self->start(info->id); 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/lib/time.cc: -------------------------------------------------------------------------------- 1 | /* This file is part of Jellyfish. 2 | 3 | Jellyfish is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | Jellyfish is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with Jellyfish. If not, see . 15 | */ 16 | 17 | #include 18 | 19 | const Time Time::zero = Time(0, 0); 20 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/sub_commands/info_main.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | namespace err = jellyfish::err; 11 | 12 | static info_main_cmdline args; 13 | 14 | std::string get_command(const jellyfish::generic_file_header& h) { 15 | std::string cmd(h["exe_path"]); 16 | std::vector cmdline = h.cmdline(); 17 | for(auto it = cmdline.cbegin(); it != cmdline.cend(); ++it) 18 | (cmd += " ") += jellyfish::quote_arg(*it); 19 | 20 | return cmd; 21 | } 22 | 23 | std::string get_where(const jellyfish::generic_file_header& h) { 24 | std::string res(jellyfish::quote_arg(h["hostname"])); 25 | if(!res.empty()) 26 | res += ":"; 27 | res += jellyfish::quote_arg(h["pwd"]); 28 | return res; 29 | } 30 | 31 | int info_main(int argc, char *argv[]) { 32 | args.parse(argc, argv); 33 | 34 | std::ifstream file(args.file_arg); 35 | if(!file.good()) 36 | err::die(err::msg() << "Can't open '" << args.file_arg << "'"); 37 | 38 | jellyfish::file_header header; 39 | header.read(file); 40 | 41 | if(args.skip_flag) 42 | std::cout << file.rdbuf(); 43 | else if(args.json_flag) 44 | std::cout << header; 45 | else if(args.cmd_flag) 46 | std::cout << get_command(header) << "\n"; 47 | else 48 | std::cout << "command: " << get_command(header) << "\n" 49 | << "where: " << get_where(header) << "\n" 50 | << "when: " << header["time"] << "\n" 51 | << "canonical: " << (header.canonical() ? "yes" : "no") << "\n"; 52 | 53 | return 0; 54 | } 55 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/sub_commands/mem_main.cc: -------------------------------------------------------------------------------- 1 | /* This file is part of Jellyfish. 2 | 3 | Jellyfish is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | Jellyfish is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with Jellyfish. If not, see . 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | static const char* suffixes = "kMGTPE"; 25 | 26 | template 27 | std::string add_suffix(uint64_t x) { 28 | const int max_i = strlen(suffixes); 29 | int i = 0; 30 | while(x >= U && i <= max_i) { 31 | x /= U; 32 | ++i; 33 | } 34 | std::ostringstream res; 35 | res << x; 36 | if(i > 0) 37 | res << suffixes[i - 1]; 38 | return res.str(); 39 | } 40 | 41 | int mem_main(int argc, char *argv[]) { 42 | mem_main_cmdline args(argc, argv); 43 | jellyfish::large_hash::array::usage_info usage(args.mer_len_arg * 2, args.counter_len_arg, args.reprobes_arg); 44 | 45 | if(args.size_given) { 46 | uint64_t val = usage.mem(args.size_arg); 47 | std::cout << val << " (" << add_suffix<1024>(val) << ")\n"; 48 | } else { 49 | uint64_t val = usage.size(args.mem_arg); 50 | std::cout << val << " (" << add_suffix<1000>(val) << ")\n"; 51 | } 52 | 53 | return 0; 54 | } 55 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/sub_commands/merge_main.cc: -------------------------------------------------------------------------------- 1 | /* This file is part of Jellyfish. 2 | 3 | Jellyfish is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | Jellyfish is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with Jellyfish. If not, see . 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | #include 21 | 22 | namespace err = jellyfish::err; 23 | 24 | int merge_main(int argc, char *argv[]) 25 | { 26 | jellyfish::file_header out_header; 27 | out_header.fill_standard(); 28 | out_header.set_cmdline(argc, argv); 29 | 30 | merge_main_cmdline args(argc, argv); 31 | uint64_t min = args.lower_count_given ? args.lower_count_arg : 0; 32 | uint64_t max = args.upper_count_given ? args.upper_count_arg : std::numeric_limits::max(); 33 | 34 | try { 35 | merge_files(args.input_arg, args.output_arg, out_header, min, max); 36 | } catch(MergeError e) { 37 | err::die(err::msg() << e.what()); 38 | } 39 | 40 | return 0; 41 | } 42 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/swig/Makefile.am: -------------------------------------------------------------------------------- 1 | # SWIG 2 | SWIG_SRC = swig/jellyfish.i swig/hash_counter.i swig/hash_set.i \ 3 | swig/mer_dna.i swig/mer_file.i swig/string_mers.i 4 | 5 | if HAVE_SWIG 6 | SWIG_V_GEN = $(swig_v_GEN_$(V)) 7 | swig_v_GEN_ = $(swig_v_GEN_$(AM_DEFAULT_VERBOSITY)) 8 | swig_v_GEN_0 = @echo " SWIG " $@; 9 | %/swig_wrap.cpp: $(SWIG_SRC) 10 | $(SWIG_V_GEN)$(SWIG) -$(notdir $*) -I$(srcdir)/../include -o $@ $< 11 | else 12 | %/swig_wrap.cpp: 13 | @echo >&2 SWIG >= 3.x.x not found. Make sure it is install and rerun configure 14 | @false 15 | endif 16 | 17 | # Python support 18 | if PYTHON_BINDING 19 | PYTHON_BUILT = swig/python/swig_wrap.cpp swig/python/jellyfish.py 20 | BUILT_SOURCES += $(PYTHON_BUILT) 21 | 22 | pythonextdir = $(PYTHON_SITE_PKG)/jellyfish 23 | pythonext_SCRIPTS = swig/python/__init__.pyc 24 | pythonext_LTLIBRARIES = swig/python/_jellyfish.la 25 | swig_python__jellyfish_la_SOURCES = swig/python/swig_wrap.cpp $(SWIG_SRC) 26 | swig_python__jellyfish_la_CPPFLAGS = $(PYTHON_CPPFLAGS) -I$(srcdir)/include 27 | swig_python__jellyfish_la_LDFLAGS = -module 28 | swig_python__jellyfish_la_LIBADD = libjellyfish-2.0.la 29 | CLEANFILES += $(PYTHON_BUILT) $(pythonext_SCRIPTS) 30 | PYTHONC_V_GEN = $(pythonc_v_GEN_$(V)) 31 | pythonc_v_GEN_ = $(pythonc_v_GEN_$(AM_DEFAULT_VERBOSITY)) 32 | pythonc_v_GEN_0 = @echo " PYTHONC " $@; 33 | %/__init__.pyc: %/jellyfish.py 34 | $(PYTHONC_V_GEN)$(PYTHON) -c 'import py_compile, sys; py_compile.compile(sys.argv[1], sys.argv[2])' $< $@ 35 | swig/python/jellyfish.py: swig/python/swig_wrap.cpp 36 | EXTRA_DIST += $(PYTHON_BUILT) 37 | endif 38 | 39 | # Ruby support 40 | if RUBY_BINDING 41 | RUBY_BUILT = swig/ruby/swig_wrap.cpp 42 | BUILT_SOURCES += $(RUBY_BUILT) 43 | rubyextdir = $(RUBY_EXT_LIB) 44 | rubyext_LTLIBRARIES = swig/ruby/jellyfish.la 45 | swig_ruby_jellyfish_la_SOURCES = swig/ruby/swig_wrap.cpp $(SWIG_SRC) 46 | swig_ruby_jellyfish_la_CPPFLAGS = $(RUBY_EXT_CFLAGS) -I$(srcdir)/include 47 | swig_ruby_jellyfish_la_LDFLAGS = -module 48 | swig_ruby_jellyfish_la_LIBADD = libjellyfish-2.0.la 49 | CLEANFILES += $(RUBY_BUILT) 50 | endif 51 | 52 | # Perl5 support 53 | if PERL_BINDING 54 | PERL_BUILT = swig/perl5/swig_wrap.cpp swig/perl5/jellyfish.pm 55 | BUILT_SOURCES += $(PERL_BUILT) 56 | perlextdir = $(PERL_EXT_LIB) 57 | perlext_SCRIPTS = swig/perl5/jellyfish.pm 58 | perlext_LTLIBRARIES = swig/perl5/jellyfish.la 59 | swig_perl5_jellyfish_la_SOURCES = swig/perl5/swig_wrap.cpp $(SWIG_SRC) 60 | swig_perl5_jellyfish_la_CPPFLAGS = $(PERL_EXT_CPPFLAGS) -I$(PERL_EXT_INC) -I$(srcdir)/include 61 | swig_perl5_jellyfish_la_LDFLAGS = -module 62 | swig_perl5_jellyfish_la_LIBADD = libjellyfish-2.0.la 63 | CLEANFILES += $(PERL_BUILT) 64 | swig/perl5/jellyfish.pm: swig/perl5/swig_wrap.cpp 65 | EXTRA_DIST += $(PERL_BUILT) 66 | endif 67 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/swig/hash_counter.i: -------------------------------------------------------------------------------- 1 | /*********************************************************************/ 2 | /* Proxy class for hash counter: auto size doubling hash on mer_dna. */ 3 | /*********************************************************************/ 4 | %{ 5 | class HashCounter : public jellyfish::cooperative::hash_counter { 6 | typedef jellyfish::cooperative::hash_counter super; 7 | public: 8 | HashCounter(size_t size, unsigned int val_len, unsigned int nb_threads = 1) : \ 9 | super(size, jellyfish::mer_dna::k() * 2, val_len, nb_threads) 10 | { } 11 | 12 | bool add(const MerDNA& m, const int& x) { 13 | bool res; 14 | size_t id; 15 | super::add(m, x, &res, &id); 16 | return res; 17 | } 18 | 19 | }; 20 | %} 21 | 22 | // Typemaps to return nil/undef/None if the mer asked for is not in 23 | // the hash 24 | %typemap(in, numinputs=0) std::pair* COUNT (std::pair tmp) { 25 | $1 = &tmp; 26 | } 27 | %typemap(argout) std::pair* COUNT { 28 | if(($1)->first) { 29 | SWIG_Object o = SWIG_From(unsigned long)(($1)->second); 30 | %append_output(o); 31 | } else { 32 | %append_output(VOID_Object); 33 | } 34 | } 35 | 36 | class HashCounter { 37 | public: 38 | HashCounter(size_t size, unsigned int val_len, unsigned int nb_threads = 1); 39 | size_t size() const; 40 | unsigned int val_len() const; 41 | // unsigned int nb_threads() const; 42 | 43 | bool add(const MerDNA& m, const int& x); 44 | bool update_add(const MerDNA&, const int&); 45 | 46 | %extend { 47 | void get(const MerDNA& m, std::pair* COUNT) const { 48 | COUNT->first = $self->ary()->get_val_for_key(m, &COUNT->second); 49 | } 50 | #ifndef SWIGPERL 51 | void __getitem__(const MerDNA& m, std::pair* COUNT) const { 52 | COUNT->first = $self->ary()->get_val_for_key(m, &COUNT->second); 53 | } 54 | #endif 55 | } 56 | }; 57 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/swig/hash_set.i: -------------------------------------------------------------------------------- 1 | /*********************************************************************/ 2 | /* Proxy class for hash counter: auto size doubling hash on mer_dna. */ 3 | /*********************************************************************/ 4 | %{ 5 | class HashSet : public jellyfish::cooperative::hash_counter { 6 | typedef jellyfish::cooperative::hash_counter super; 7 | public: 8 | HashSet(size_t size, unsigned int nb_threads = 1) : \ 9 | super(size, jellyfish::mer_dna::k() * 2, 0, nb_threads) 10 | { } 11 | 12 | bool add(const MerDNA& m) { 13 | bool res; 14 | size_t id; 15 | super::set(m, &res, &id); 16 | return res; 17 | } 18 | }; 19 | %} 20 | 21 | class HashSet { 22 | public: 23 | HashSet(size_t size, unsigned int nb_threads = 1); 24 | size_t size() const; 25 | // unsigned int nb_threads() const; 26 | 27 | bool add(const MerDNA& m); 28 | 29 | %extend { 30 | bool get(const MerDNA& m) const { return $self->ary()->has_key(m); } 31 | #ifndef SWIGPERL 32 | bool __getitem__(const MerDNA& m) const { return $self->ary()->has_key(m); } 33 | #endif 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/swig/jellyfish.i: -------------------------------------------------------------------------------- 1 | %module(docstring="Jellyfish binding") jellyfish 2 | %naturalvar; // Use const reference instead of pointers 3 | %include "std_string.i" 4 | %include "exception.i" 5 | %include "std_except.i" 6 | %include "typemaps.i" 7 | %feature("autodoc", "2"); 8 | 9 | %{ 10 | #ifdef SWIGPYTHON 11 | #define SWIG_FILE_WITH_INIT 12 | #endif 13 | 14 | #ifdef SWIGPERL 15 | #undef seed 16 | #undef random 17 | #endif 18 | 19 | #include 20 | #include 21 | #undef die 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #undef die 28 | %} 29 | 30 | %include "mer_dna.i" 31 | %include "mer_file.i" 32 | %include "hash_counter.i" 33 | %include "hash_set.i" 34 | %include "string_mers.i" 35 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/swig/perl5/t/test_hash_counter.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More; 4 | use jellyfish; 5 | 6 | require_ok('jellyfish'); 7 | my $data = shift(@ARGV); 8 | 9 | jellyfish::MerDNA::k(100); 10 | my $hash = jellyfish::HashCounter->new(1024, 5); 11 | 12 | # Check info 13 | ok(100 == jellyfish::MerDNA::k, "mer_dna k"); 14 | ok(1024 == $hash->size, "Hash size"); 15 | ok(5 == $hash->val_len, "Hash value length"); 16 | 17 | # Test adding mers 18 | { 19 | my $mer = jellyfish::MerDNA->new; 20 | my $good = 1; 21 | for(my $i = 0; $i < 1000; $i++) { 22 | $mer->randomize(); 23 | my $val = int(rand(1000)); 24 | $good &&= $hash->add($mer, $val) or 25 | (ok($good, "Adding to new mer") || last); 26 | if($i % 3 > 0) { 27 | my $nval = int(rand(1000)); 28 | $val += $nval; 29 | if($i % 3 == 1) { 30 | $good &&= !$hash->add($mer, $nval) or 31 | (ok($good, "Adding to existing mer") || last); 32 | } else { 33 | $good &&= $hash->update_add($mer, $nval) or 34 | (ok($good, "Updating existing mer") || last); 35 | } 36 | } 37 | $good &&= $val == $hash->get($mer) or 38 | (ok($good, "Value in hash") || last); 39 | 40 | } 41 | ok($good, "Adding mer to hash"); 42 | } 43 | 44 | done_testing; 45 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/swig/perl5/t/test_mer_file.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More; 4 | 5 | require_ok('jellyfish'); 6 | my $data = shift(@ARGV); 7 | 8 | # Compare histo 9 | { 10 | my $rf = jellyfish::ReadMerFile->new($data . "/swig_perl.jf"); 11 | my @histo; 12 | $histo[$rf->count]++ while($rf->next_mer); 13 | 14 | open(my $io, "<", $data . "/swig_perl.histo"); 15 | my @jf_histo; 16 | while(<$io>) { 17 | my ($freq, $count) = split; 18 | $jf_histo[$freq] = $count; 19 | } 20 | 21 | is_deeply(\@histo, \@jf_histo, "Histogram"); 22 | } 23 | 24 | # Compare dump 25 | { 26 | my $rf = jellyfish::ReadMerFile->new($data . "/swig_perl.jf"); 27 | my $equal = open(my $io, "<", $data . "/swig_perl.dump"); 28 | while(<$io>) { 29 | my ($mer, $count) = split; 30 | $equal &&= $rf->next_mer; 31 | $equal &&= ($mer eq $rf->mer); 32 | $equal &&= ($count == $rf->count); 33 | last unless $equal; 34 | } 35 | $equal &&= !$rf->next_mer; 36 | ok($equal, "Dump"); 37 | } 38 | 39 | # Query 40 | { 41 | my $rf = jellyfish::ReadMerFile->new($data . "/swig_perl.jf"); 42 | my $qf = jellyfish::QueryMerFile->new($data . "/swig_perl.jf"); 43 | my $good = 1; 44 | while(my ($mer, $count) = $rf->each) { 45 | $good &&= $count == $qf->get($mer) or 46 | (ok($good, "Query mer") || last); 47 | } 48 | ok($good, "Query identical to read"); 49 | } 50 | 51 | done_testing; 52 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/swig/perl5/t/test_string_mers.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More; 4 | 5 | require_ok('jellyfish'); 6 | jellyfish::MerDNA::k(int(rand(100)) + 10); 7 | 8 | my @bases = ("A", "C", "G", "T", "a", "c", "g", "t"); 9 | my $str; 10 | for(my $i = 0; $i < 1000; $i++) { 11 | $str .= $bases[int(rand(8))]; 12 | } 13 | 14 | my $count = 0; 15 | my $m2 = jellyfish::MerDNA->new; 16 | my $mers = jellyfish::string_mers($str); 17 | my $good_mers = 1; 18 | my $good_strs = 1; 19 | while($mers->next_mer) { 20 | my $mstr = uc(substr($str, $count, jellyfish::MerDNA::k())); 21 | $m2->set($mstr); 22 | $good_strs &&= $mers->mer == $m2; 23 | $good_mers &&= $mers->mer eq $mstr; 24 | $count++; 25 | } 26 | ok($good_mers, "Mers equal"); 27 | ok($good_strs, "Strs equal"); 28 | ok($count == length($str) - jellyfish::MerDNA::k() + 1, "Number of mers"); 29 | 30 | done_testing; 31 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/swig/python/test_hash_counter.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import sys 3 | import random 4 | import jellyfish 5 | 6 | class TestHashCounter(unittest.TestCase): 7 | def setUp(self): 8 | jellyfish.MerDNA.k(100) 9 | self.hash = jellyfish.HashCounter(1024, 5) 10 | 11 | def test_info(self): 12 | self.assertEqual(100, jellyfish.MerDNA.k()) 13 | self.assertEqual(1024, self.hash.size()) 14 | self.assertEqual(5, self.hash.val_len()) 15 | 16 | def test_add(self): 17 | mer = jellyfish.MerDNA() 18 | good = True 19 | for i in range(1000): 20 | mer.randomize() 21 | val = random.randrange(1000) 22 | good = good and self.hash.add(mer, val) 23 | if not good: break 24 | if i % 3 > 0: 25 | nval = random.randrange(1000) 26 | val = val + nval 27 | if i % 3 == 1: 28 | good = good and (not self.hash.add(mer, nval)) 29 | else: 30 | good = good and self.hash.update_add(mer, nval) 31 | if not good: break 32 | good = good and (val == self.hash.get(mer)) and (val == self.hash[mer]) 33 | if not good: break 34 | self.assertTrue(good) 35 | 36 | 37 | if __name__ == '__main__': 38 | data = sys.argv.pop(1) 39 | unittest.main() 40 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/swig/python/test_mer_file.py: -------------------------------------------------------------------------------- 1 | import jellyfish 2 | import unittest 3 | import sys 4 | import os 5 | from collections import Counter 6 | 7 | class TestMerFile(unittest.TestCase): 8 | def setUp(self): 9 | self.mf = jellyfish.ReadMerFile(os.path.join(data, "swig_python.jf")) 10 | 11 | def test_histo(self): 12 | histo = Counter() 13 | while self.mf.next_mer(): 14 | histo[self.mf.count()] += 1 15 | 16 | jf_histo = Counter() 17 | with open(os.path.join(data, "swig_python.histo")) as f: 18 | for line in f: 19 | num, count = [int(n) for n in line.split()] 20 | self.assertEqual(count, histo[num]) 21 | 22 | def test_dump(self): 23 | good = True 24 | with open(os.path.join(data, "swig_python.dump")) as f: 25 | for line in f: 26 | good = good and self.mf.next_mer() 27 | if not good: break 28 | a = line.split() 29 | good = good and a[0] == str(self.mf.mer()) and int(a[1]) == self.mf.count() 30 | if not good: break 31 | self.assertTrue(good) 32 | 33 | def test_iter(self): 34 | good = True 35 | with open(os.path.join(data, "swig_python.dump")) as f: 36 | for mer, count in self.mf: 37 | line = f.readline() 38 | good = good and line 39 | if not good: break 40 | fmer, fcount = line.split() 41 | good = good and fmer == str(mer) and int(fcount) == count 42 | if not good: break 43 | self.assertTrue(good) 44 | line = f.readline() 45 | self.assertTrue(not line) 46 | 47 | def test_query(self): 48 | good = True 49 | qf = jellyfish.QueryMerFile(os.path.join(data, "swig_python.jf")) 50 | for mer, count in self.mf: 51 | good = good and count == qf[mer] 52 | if not good: break 53 | self.assertTrue(good) 54 | 55 | if __name__ == '__main__': 56 | data = sys.argv.pop(1) 57 | unittest.main() 58 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/swig/python/test_string_mers.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import sys 3 | import random 4 | import jellyfish 5 | 6 | class TestStringMers(unittest.TestCase): 7 | def setUp(self): 8 | bases = "ACGTacgt" 9 | self.str = ''.join(random.choice(bases) for _ in range(1000)) 10 | self.k = random.randint(10, 110) 11 | jellyfish.MerDNA.k(self.k) 12 | 13 | def test_all_mers(self): 14 | count = 0 15 | good = True 16 | mers = jellyfish.string_mers(self.str) 17 | for m in mers: 18 | m2 = jellyfish.MerDNA(self.str[count:count+self.k]) 19 | good = good and m == m2 20 | count += 1 21 | self.assertTrue(good) 22 | self.assertEqual(len(self.str) - self.k + 1, count) 23 | 24 | def test_canonical_mers(self): 25 | good = True 26 | mers = jellyfish.string_canonicals(self.str) 27 | for count, m in enumerate(mers): 28 | m2 = jellyfish.MerDNA(self.str[count:count+self.k]) 29 | rm2 = m2.get_reverse_complement() 30 | good = good and (m == m2 or m == rm2) 31 | good = good and (not (m > m2)) and (not (m > rm2)) 32 | # count += 1 33 | self.assertTrue(good) 34 | self.assertEqual(len(self.str) - self.k + 0, count) 35 | 36 | 37 | if __name__ == '__main__': 38 | data = sys.argv.pop(1) 39 | unittest.main() 40 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/swig/ruby/test_hash_counter.rb: -------------------------------------------------------------------------------- 1 | require 'minitest/autorun' 2 | require 'jellyfish' 3 | 4 | class TestHashCounter < MiniTest::Unit::TestCase 5 | def setup 6 | Jellyfish::MerDNA::k(100) 7 | @hash = Jellyfish::HashCounter.new(1024, 5) 8 | end 9 | 10 | def test_info 11 | assert_equal(100, Jellyfish::MerDNA::k) 12 | assert_equal(1024, @hash.size) 13 | assert_equal(5, @hash.val_len) 14 | # assert_equal(1, @hash.nb_threads) 15 | end 16 | 17 | def test_add 18 | mer = Jellyfish::MerDNA.new 19 | 20 | 1000.times { |i| 21 | mer.randomize! 22 | val = rand(1000) 23 | assert(@hash.add(mer, val)) 24 | if i % 3 > 0 25 | nval = rand(1000) 26 | val += nval 27 | if i % 3 == 1 28 | assert(!@hash.add(mer, nval)) 29 | else 30 | assert(@hash.update_add(mer, nval)) 31 | end 32 | end 33 | assert_equal(val, @hash.get(mer)) 34 | assert_equal(val, @hash[mer]) 35 | } 36 | 37 | mer.randomize! 38 | assert_nil(@hash.get(mer)) 39 | assert_nil(@hash[mer]) 40 | assert(!@hash.update_add(mer, 1)) 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/swig/ruby/test_mer_file.rb: -------------------------------------------------------------------------------- 1 | require 'minitest/autorun' 2 | require 'jellyfish' 3 | 4 | $data = ARGV.shift 5 | 6 | class TestMerFile < MiniTest::Unit::TestCase 7 | def setup 8 | @mf = Jellyfish::ReadMerFile.new(File.join($data, "swig_ruby.jf")) 9 | end 10 | 11 | def test_histo 12 | histo = [] 13 | histo[@mf.count] = (histo[@mf.count] || 0) + 1 while @mf.next_mer 14 | 15 | jf_histo = [] 16 | open(File.join($data, "swig_ruby.histo")) { |f| 17 | f.each_line.each { |l| 18 | freq, count = l.split.map {|x| x.to_i } 19 | jf_histo[freq] = count 20 | } 21 | } 22 | 23 | assert_equal jf_histo, histo 24 | end 25 | 26 | def test_each 27 | open(File.join($data, "swig_ruby.dump")) { |f| 28 | @mf.each { |m, c| 29 | l = f.readline 30 | assert l 31 | fm, fc = l.split 32 | assert_equal fm, m.to_s 33 | assert_equal fc.to_i, c 34 | } 35 | assert_raises(EOFError) { f.readline } 36 | } 37 | end 38 | 39 | def test_dump 40 | open(File.join($data, "swig_ruby.dump")) { |f| 41 | f.each_line.each { |l| 42 | mer, count = l.split 43 | assert @mf.next_mer 44 | assert_equal(mer, @mf.mer.to_s) 45 | assert_equal(count.to_i, @mf.count) 46 | } 47 | } 48 | assert !@mf.next_mer 49 | end 50 | 51 | def test_query 52 | query = Jellyfish::QueryMerFile.new(File.join($data, "swig_ruby.jf")) 53 | @mf.each { |m, c| 54 | assert_equal c, query[m] 55 | } 56 | end 57 | end 58 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/swig/ruby/test_string_mers.rb: -------------------------------------------------------------------------------- 1 | require 'minitest/autorun' 2 | require 'jellyfish' 3 | 4 | class TestStringMers < MiniTest::Unit::TestCase 5 | def setup 6 | bases = "ACGTacgt" 7 | @str = (0..1000).map { bases[rand(bases.size())] }.join("") 8 | Jellyfish::MerDNA::k(rand(100) + 10) 9 | end 10 | 11 | def test_all_mers 12 | count = 0 13 | m2 = Jellyfish::MerDNA.new 14 | 15 | @str.mers.each_with_index { |m, i| 16 | assert_equal m.to_s, @str[i, Jellyfish::MerDNA::k()].upcase 17 | m2.set @str[i, Jellyfish::MerDNA::k()] 18 | assert_equal m2, m 19 | count += 1 20 | } 21 | assert_equal @str.size - Jellyfish::MerDNA::k() + 1, count 22 | end 23 | 24 | def test_canonical_mers 25 | count = 0 26 | m2 = Jellyfish::MerDNA.new 27 | @str.canonicals { |m| 28 | m2.set @str[count, Jellyfish::MerDNA::k()] 29 | cm2 = m2.get_reverse_complement 30 | assert(m2 == m || m == cm2) 31 | assert(!(m > m2) && !(m > cm2)); 32 | count += 1 33 | } 34 | assert_equal @str.size - Jellyfish::MerDNA::k() + 1, count 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/tests/big.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | cd tests 4 | . ./compat.sh 5 | 6 | if [ -z "$BIG" ]; then 7 | echo "Skip big test" 8 | exit 77 9 | fi 10 | 11 | sort -k2,2 > ${pref}.md5sum < ${pref}_31.histo && \ 18 | 19 | echo "Count k-mers on big data set" && \ 20 | ([ -f seq30g.fa ] || ${DIR}/generate_sequence -v -o seq30g -r 1000 -s 1602176487 30000000000) && 21 | $JF count -m 16 -s 4000000000 -o ${pref}_16.jf -c 4 -p 253 -C --out-counter-len 2 \ 22 | -t $nCPUs $JFPARAM seq30g.fa && \ 23 | $JF histo ${pref}_16.jf > ${pref}_16.histo && \ 24 | check ${pref}.md5sum 25 | RET=$? 26 | 27 | # echo "16-mer timing"; cat ${pref}_16.timing 28 | 29 | exit $RET 30 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/tests/bloom_counter.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | cd tests 4 | . ./compat.sh 5 | 6 | sort -k2,2 > ${pref}.md5sum < ${pref}_commands < ${pref}_none.histo 24 | 25 | $JF histo ${pref}.jf > ${pref}.histo 26 | $JF histo ${pref}_filtered.jf > ${pref}_filtered.histo 27 | 28 | TOTAL=$(cut -d\ -f2 ${pref}.histo) 29 | COLLISION=$(cut -d\ -f2 ${pref}_none.histo) 30 | # FPR is 1 in 1000. Should not get more than 1/500 collisions. 31 | [ $((TOTAL / 500 > COLLISION)) = 1 ] || { 32 | echo >&2 "Too many collisions" 33 | false 34 | } 35 | 36 | QUERY_TOT=$($JF query -s seq1m_0.fa ${pref}.bc | grep -c ' 2$') 37 | [ $QUERY_TOT = $TOTAL ] || { 38 | echo >&2 "Queried count 2 mers should be all mers" 39 | false 40 | } 41 | QUERY_COL=$($JF query -s seq1m_0.fa ${pref}_none.bc | grep -c ' 2$') 42 | [ $QUERY_COL = $COLLISION ] || { 43 | echo >&2 "Queried count 2 mers should equal collisions" 44 | false 45 | } 46 | 47 | check ${pref}.md5sum 48 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/tests/bloom_filter.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | cd tests 4 | . ./compat.sh 5 | 6 | # sort -k2,2 > ${pref}.md5sum < ${pref}_10m.histo 11 | COLLISIONS=$(cut -d\ -f2 ${pref}_10m.histo | paste -sd+ - | bc) 12 | [ $((COLLISIONS > 10000)) = 0 ] || { 13 | echo >& "Too many collisions" 14 | false 15 | } 16 | 17 | $JF count --bf-size 3M --bf-fp 0.001 -t $nCPUs -o ${pref}_3m.jf -s 1M -m 40 seq1m_0.fa seq1m_1.fa seq1m_0.fa seq1m_2.fa 18 | $JF histo ${pref}_3m.jf > ${pref}_3m.histo 19 | COLLISIONS=$(cut -d\ -f2 ${pref}_3m.histo | paste -sd+ - | bc) 20 | [ $((COLLISIONS - 1000000 > 20000)) = 0 ] || { 21 | echo >& "Too many collisions" 22 | false 23 | } 24 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/tests/generate_sequence.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | cd tests 4 | . ./compat.sh 5 | 6 | ${DIR}/generate_sequence -v -o seq10m -m 10 -m 22 -s 3141592653 10000000 7 | ${DIR}/generate_sequence -v -o seq1m -s 1040104553 1000000 1000000 1000000 1000000 1000000 8 | 9 | for i in 0 1 2 3 4; do 10 | gzip -c seq1m_$i.fa > seq1m_$i.fa.gz 11 | done 12 | 13 | ${DIR}/generate_sequence -v -q -o seq10m -s 1473540700 10000000 14 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/tests/large_key.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | cd tests 4 | . ./compat.sh 5 | 6 | sort -k2,2 > ${pref}.md5sum < ${pref}_m100_2M_ordered 14 | head -n 10001 seq1m_0.fa | time $JF count -t $nCPUs -o ${pref}_m100_2k.jf -s 2k -m 100 /dev/fd/0 15 | $JF dump -c ${pref}_m100_2k.jf | cut -d\ -f 1 | sort > ${pref}_m100_2k_ordered 16 | head -n 10001 seq1m_0.fa | time $JF count -t $nCPUs -o ${pref}_m100_2k_disk.jf -s 2k --disk -m 100 /dev/fd/0 17 | $JF dump -c ${pref}_m100_2k_disk.jf | cut -d\ -f 1 | sort > ${pref}_m100_2k_disk_ordered 18 | check ${pref}.md5sum 19 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/tests/merge.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | cd tests 4 | . ./compat.sh 5 | 6 | sort -k2,2 > ${pref}.md5sum < ${pref}_m40_s16m.histo 16 | 17 | ls | grep "^${pref}_m40_s1m[0-9].*" | xargs rm -f 18 | echo $FILES | xargs $JF count -t $nCPUs -o ${pref}_m40_s1m -s 1M --disk --no-merge -C -m 40 19 | $JF merge -o ${pref}_m40_s1m_merged.jf ${pref}_m40_s1m[0-9]* 20 | ls | grep "^${pref}_m40_s1m[0-9].*" | xargs rm -f 21 | 22 | echo $FILES | xargs $JF count -t $nCPUs -o ${pref}_automerge_m40_s1m.jf -s 1M --disk -C -m 40 23 | 24 | echo $FILES | xargs $JF count -t $nCPUs -o ${pref}_m40_s1m_text.jf -s 1M --text --disk -C -m 40 25 | 26 | $JF histo ${pref}_automerge_m40_s1m.jf > ${pref}_automerge_m40_s1m.histo 27 | $JF histo ${pref}_m40_s1m_merged.jf > ${pref}_m40_s1m_merged.histo 28 | $JF histo ${pref}_m40_s1m_text.jf > ${pref}_m40_s1m_text.histo 29 | 30 | check ${pref}.md5sum 31 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/tests/multi_file.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | cd tests 4 | . ./compat.sh 5 | 6 | sort -k2,2 > ${pref}.md5sum < ${pref}_m15_s2M.histo 14 | 15 | cat > ${pref}_gunzip_cmds <> ${pref}_gunzip_cmds 22 | $JF count -t $nCPUs -g ${pref}_gunzip_cmds -G 2 -C -m 15 -s 2M -o ${pref}_m15_s2M_zip.jf seq10m.fa 23 | $JF histo ${pref}_m15_s2M_zip.jf > ${pref}_m15_s2M_zip.histo 24 | 25 | # Test failure of generator 26 | echo false > ${pref}_fail_cmds 27 | STATUS= 28 | $JF count -t $nCPUs -g ${pref}_fail_cmds -G 2 -C -m 15 -s 2M -o ${pref}_fail.jf || STATUS=$? 29 | if [ -z "$STATUS" ]; then 30 | echo >&2 "Jellyfish did not report failure in generator command" 31 | false 32 | fi 33 | 34 | # Test failure to open file 35 | STATUS= 36 | $JF count -t $nCPUs -C -m 15 -s 2M -o ${pref}_fail.jf non_existent_sequence.fa || STATUS=$? 37 | if [ -z "$STATUS" ]; then 38 | echo >&2 "Jellyfish did not report failure in opening a file" 39 | false 40 | fi 41 | 42 | check ${pref}.md5sum 43 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/tests/subset_hashing.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | cd tests/ 4 | . ./compat.sh 5 | 6 | sort -k2,2 > ${pref}.md5sum < ${pref}_m35_s2M_if.histo 14 | 15 | # Idem with 10-mers 16 | $JF count -t $nCPUs -o ${pref}_m10_s2M_if.jf -s 6M -C -m 10 --if seq1m_0.fa --if seq1m_2.fa seq1m_1.fa seq1m_0.fa seq1m_3.fa seq1m_2.fa 17 | $JF histo ${pref}_m10_s2M_if.jf > ${pref}_m10_s2M_if.histo 18 | 19 | check ${pref}.md5sum 20 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/tests/swig_perl.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | cd tests 4 | . ./compat.sh 5 | [ -z "$ENABLE_PERL_BINDING" ] && exit 77 6 | 7 | LOADPATH="$BUILDDIR/swig/perl5" 8 | K=$($PERL -e 'print(int(rand(16)) + 6)') 9 | I=$($PERL -e 'print(int(rand(5)))') 10 | $JF count -m $K -s 10M -t $nCPUs -C -o ${pref}.jf seq1m_$I.fa 11 | $JF dump -c ${pref}.jf > ${pref}.dump 12 | $JF histo ${pref}.jf > ${pref}.histo 13 | 14 | for i in test_mer_file.t test_hash_counter.t test_string_mers.t; do 15 | echo Test $i 16 | $PERL "-I$LOADPATH/.libs" "-I$LOADPATH" "-I$SRCDIR/swig/perl5" "$SRCDIR/swig/perl5/t/$i" . 17 | done 18 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/tests/swig_python.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | cd tests 4 | . ./compat.sh 5 | [ -z "$ENABLE_PYTHON_BINDING" ] && exit 77 6 | 7 | export PYTHONPATH="$BUILDDIR/swig/python/.libs:$BUILDDIR/swig/python${PYTHONPATH+:$PYTHONPATH}" 8 | K=$($PYTHON -c 'import random; print(random.randint(6, 20))') 9 | I=$($PYTHON -c 'import random; print(random.randint(0, 4))') 10 | $JF count -m $K -s 10M -t $nCPUs -C -o ${pref}.jf seq1m_$I.fa 11 | $JF dump -c ${pref}.jf > ${pref}.dump 12 | $JF histo ${pref}.jf > ${pref}.histo 13 | 14 | for i in test_mer_file.py test_hash_counter.py test_string_mers.py; do 15 | echo Test $i 16 | $PYTHON "$SRCDIR/swig/python/$i" . 17 | done 18 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/tests/swig_ruby.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | cd tests 4 | . ./compat.sh 5 | [ -z "$ENABLE_RUBY_BINDING" ] && exit 77 6 | 7 | LOADPATH="$BUILDDIR/swig/ruby/.libs" 8 | K=$($RUBY -e 'print(rand(15) + 6)') 9 | I=$($RUBY -e 'print(rand(5))') 10 | $JF count -m $K -s 10M -t $nCPUs -C -o ${pref}.jf seq1m_$I.fa 11 | $JF dump -c ${pref}.jf > ${pref}.dump 12 | $JF histo ${pref}.jf > ${pref}.histo 13 | 14 | 15 | 16 | for i in test_mer_file.rb test_hash_counter.rb test_string_mers.rb; do 17 | echo Test $i 18 | $RUBY "-I$LOADPATH" "$SRCDIR/swig/ruby/$i" . 19 | done 20 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/unit_tests/gtest/src/gtest_main.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #include 31 | 32 | #include "gtest/gtest.h" 33 | 34 | GTEST_API_ int main(int argc, char **argv) { 35 | printf("Running main() from gtest_main.cc\n"); 36 | testing::InitGoogleTest(&argc, argv); 37 | return RUN_ALL_TESTS(); 38 | } 39 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/unit_tests/test_allocators_mmap.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | namespace { 5 | TEST(AllocMmap, Simple) { 6 | static const size_t size = 4096; 7 | allocators::mmap mem(size); 8 | 9 | EXPECT_EQ(size, mem.get_size()); 10 | EXPECT_NE((void*)0, mem.get_ptr()); 11 | char* ptr = (char*)mem.get_ptr(); 12 | // char c = ptr[size]; 13 | // EXPECT_EQ((char)0, c); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/unit_tests/test_atomic_bits_array.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace { 8 | TEST(AtomicBitsArray, Fill) { 9 | static const size_t size = 2066; 10 | static const int bits = 3; 11 | jellyfish::atomic_bits_array ary(bits, size); 12 | std::unique_ptr data(new unsigned char[size]); 13 | 14 | for(size_t i = 0; i < size; ++i) { 15 | data[i] = random_bits(bits); 16 | auto e = ary[i]; 17 | e.get(); 18 | EXPECT_TRUE(e.set(data[i])); 19 | } 20 | 21 | auto it = ary.begin(); 22 | auto it_end = ary.end(); 23 | for(size_t i = 0; i < size; ++i, ++it) { 24 | auto e = ary[i]; 25 | EXPECT_EQ(data[i], e.get()); 26 | EXPECT_EQ(data[i], (unsigned char)e); 27 | ASSERT_NE(it_end, it); 28 | EXPECT_EQ(data[i], *it); 29 | } 30 | EXPECT_EQ(it_end, it); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/unit_tests/test_cooperative_pool2.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | namespace { 6 | // Generate all numbers in [0, producers * max) 7 | class sequence : public jellyfish::cooperative_pool2 { 8 | typedef jellyfish::cooperative_pool2 super; 9 | 10 | const uint32_t max_; 11 | std::vector cur_; 12 | const uint32_t producers_; 13 | 14 | public: 15 | std::vector check_; 16 | sequence(uint32_t producers, uint32_t threads, uint32_t max) : 17 | super(producers, 3 * threads), 18 | max_(max), 19 | cur_(producers, 0), 20 | producers_(producers), 21 | check_(max * producers, 0) 22 | { } 23 | 24 | bool produce(uint32_t i, int& e) { 25 | assert(i < producers_); 26 | int& cur = cur_[i]; 27 | if(cur < max_) { 28 | e = i * max_ + cur++; 29 | __sync_add_and_fetch(&check_[e], 1); 30 | return false; 31 | } 32 | return true; 33 | } 34 | }; 35 | 36 | class list_ints : public jellyfish::thread_exec { 37 | sequence seq_; 38 | std::vector check_; 39 | public: 40 | list_ints(uint32_t producers, uint32_t threads, uint32_t max) : seq_(producers, threads, max), check_(producers * max, 0) { } 41 | virtual void start(int i) { 42 | while(true) { 43 | sequence::job j(seq_); 44 | if(j.is_empty()) 45 | break; 46 | ++check_[*j]; 47 | } 48 | } 49 | 50 | bool check() const { 51 | for(auto it = check_.cbegin(); it != check_.cend(); ++it) 52 | if(*it != 1) 53 | return false; 54 | return true; 55 | } 56 | 57 | bool check_print() const { 58 | if(check()) 59 | return true; 60 | 61 | for(auto it = check_.cbegin(); it != check_.cend(); ++it) 62 | printf("%d", *it); 63 | printf("\n----------\n"); 64 | for(auto it = seq_.check_.cbegin(); it != seq_.check_.cend(); ++it) 65 | printf("%d", *it); 66 | printf("\n"); 67 | return false; 68 | } 69 | }; 70 | 71 | class CooperativePoolTest : public ::testing::TestWithParam { 72 | public: 73 | static const uint32_t nb_threads = 10; 74 | CooperativePoolTest() : workers(GetParam(), nb_threads, 1000) { } 75 | 76 | protected: 77 | list_ints workers; 78 | }; 79 | 80 | TEST_P(CooperativePoolTest, Ints) { 81 | workers.exec_join(nb_threads); 82 | EXPECT_TRUE(workers.check_print()); 83 | } 84 | 85 | INSTANTIATE_TEST_CASE_P(CooperativePool, 86 | CooperativePoolTest, 87 | ::testing::Range((uint32_t)1, CooperativePoolTest::nb_threads + 1)); 88 | 89 | } // namespace { 90 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/unit_tests/test_file_header.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | namespace { 10 | using jellyfish::file_header; 11 | using jellyfish::RectangularBinaryMatrix; 12 | using std::ostringstream; 13 | using std::istringstream; 14 | using std::string; 15 | 16 | TEST(FileHeader, Standard) { 17 | file_header h; 18 | 19 | EXPECT_EQ("", h["hostname"]); 20 | EXPECT_EQ("", h["pwd"]); 21 | EXPECT_EQ("", h["time"]); 22 | EXPECT_EQ("", h["exe_path"]); 23 | 24 | h.fill_standard(); 25 | 26 | EXPECT_NE("", h["hostname"]); 27 | EXPECT_NE("", h["pwd"]); 28 | EXPECT_NE("", h["time"]); 29 | EXPECT_NE("", h["exe_path"]); 30 | } 31 | 32 | TEST(FileHeader, WriteRead) { 33 | file_header hw; 34 | ostringstream os; 35 | os.fill('A'); 36 | os.width(20); 37 | os << std::hex; 38 | std::ios::fmtflags flags = os.flags(); 39 | const size_t random_size = random_bits(35); 40 | const unsigned int val_len = random_bits(4); 41 | const unsigned int max_reprobe = random_bits(7); 42 | const double fpr = (double)random_bits(10) / 1024.0; 43 | RectangularBinaryMatrix m(random_bits(6) + 1, random_bits(8) + 1); 44 | m.randomize(random_bits); 45 | 46 | EXPECT_EQ(8, hw.alignment()); 47 | hw.fill_standard(); 48 | hw.size(random_size); 49 | hw.matrix(m); 50 | hw.key_len(m.r()); 51 | hw.val_len(val_len); 52 | hw.max_reprobe(max_reprobe); 53 | hw.set_reprobes(jellyfish::quadratic_reprobes); 54 | hw.fpr(fpr); 55 | hw.write(os); 56 | EXPECT_EQ(0, os.tellp() % 8); 57 | EXPECT_EQ('A', os.fill()); 58 | EXPECT_EQ(20, os.width()); 59 | EXPECT_EQ(flags, os.flags()); 60 | os.width(0); 61 | const string ah("After header"); 62 | os << ah; 63 | 64 | // std::cerr << os.str() << "\n"; 65 | istringstream is(os.str()); 66 | 67 | file_header hr; 68 | EXPECT_TRUE(hr.read(is)); 69 | EXPECT_EQ(is.tellg(), hr.offset()); 70 | EXPECT_EQ(0, is.tellg() % 8); 71 | EXPECT_EQ(8, hr.alignment()); 72 | EXPECT_EQ(random_size, hr.size()); 73 | EXPECT_EQ(m, hr.matrix()); 74 | EXPECT_EQ(m.r(), hr.key_len()); 75 | EXPECT_EQ(val_len, hr.val_len()); 76 | EXPECT_EQ(fpr, hr.fpr()); 77 | 78 | size_t reprobes[max_reprobe + 1]; 79 | hr.get_reprobes(reprobes); 80 | for(unsigned int i = 0; i <= max_reprobe; ++i) 81 | EXPECT_EQ(jellyfish::quadratic_reprobes[i], reprobes[i]); 82 | 83 | // Not sure why the following fails. But all the fields come out 84 | // equal so ignore for now 85 | // EXPECT_EQ(hw, hr); 86 | string line; 87 | getline(is, line); 88 | EXPECT_EQ(ah, line); 89 | } 90 | } // namespace { 91 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/unit_tests/test_int128.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #ifdef HAVE_INT128 5 | #include 6 | #include 7 | 8 | namespace { 9 | TEST(Int128, Specialized) { 10 | // This is supposed to be true, whether it is specialized by gcc or 11 | // in int128.hpp above. 12 | EXPECT_TRUE(std::numeric_limits<__int128>::is_specialized); 13 | EXPECT_TRUE(std::numeric_limits::is_specialized); 14 | } 15 | 16 | TEST(Int128, Max) { 17 | static const __int128 sone = 1; 18 | static const unsigned __int128 uone = 1; 19 | __int128 sm = std::numeric_limits<__int128>::max(); 20 | unsigned __int128 um = std::numeric_limits::max(); 21 | 22 | for(int i = 0; i < 127; ++i, sm >>= 1, um >>= 1) { 23 | EXPECT_EQ(1, (int)(sm & sone)); 24 | EXPECT_EQ(1, (int)(um & uone)); 25 | EXPECT_EQ(1, (int)((std::numeric_limits<__int128>::max() >> i) & sone)); 26 | EXPECT_EQ(1, (int)((std::numeric_limits::max() >> i) & uone)); 27 | } 28 | 29 | EXPECT_EQ(0, (int)sm); 30 | EXPECT_EQ(1, (int)um); 31 | } 32 | } // namespace 33 | 34 | #endif // HAVE_INT128 35 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/unit_tests/test_main.cc: -------------------------------------------------------------------------------- 1 | /* This file is part of Jellyfish. 2 | 3 | Jellyfish is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | Jellyfish is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with Jellyfish. If not, see . 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | template 26 | struct floorLog2 { 27 | static const int val = floorLog2::val + 1; 28 | }; 29 | template<> 30 | struct floorLog2<1> { 31 | static const int val = 0; 32 | }; 33 | 34 | // Return length random bits. 1 <= length <= 64 35 | uint64_t random_bits(int length) { 36 | uint64_t res = 0; 37 | for(int i = 0; i < length; i += floorLog2::val) 38 | res ^= (uint64_t)random() << i; 39 | return res & ((uint64_t)-1 >> (64 - length)); 40 | } 41 | 42 | 43 | int main(int argc, char *argv[]) { 44 | ::testing::InitGoogleTest(&argc, argv); 45 | cmdline_parse args(argc, argv); 46 | 47 | unsigned int seed; 48 | if(args.seed_given) { 49 | seed = args.seed_arg; 50 | } else { 51 | std::ifstream urandom("/dev/urandom"); 52 | urandom.read((char*)&seed, sizeof(seed)); 53 | if(!urandom.good()) { 54 | std::cerr << "Failed to read random seed" << std::endl; 55 | return 1; 56 | } 57 | } 58 | if(args.backtrace_flag) { 59 | show_backtrace(); 60 | setenv("GTEST_CATCH_EXCEPTIONS", "0", 1); 61 | } 62 | 63 | std::cout << "Using random seed " << seed << std::endl; 64 | srandom(seed); 65 | 66 | return RUN_ALL_TESTS(); 67 | } 68 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/unit_tests/test_main.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __TEST_MAIN_HPP__ 2 | #define __TEST_MAIN_HPP__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | uint64_t random_bits(int length); 11 | inline uint64_t random_bits() { return random_bits(64); } 12 | 13 | struct file_unlink { 14 | std::string path; 15 | bool do_unlink; 16 | explicit file_unlink(const char* s, bool d = true) : path(s), do_unlink(d) { } 17 | explicit file_unlink(const std::string& s, bool d = true) : path(s), do_unlink(d) { } 18 | 19 | ~file_unlink() { 20 | if(do_unlink) 21 | unlink(path.c_str()); 22 | } 23 | }; 24 | 25 | #endif /* __TEST_MAIN_HPP__ */ 26 | 27 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/unit_tests/test_mapped_file.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | namespace { 8 | using jellyfish::mapped_file; 9 | TEST(MappedFile, CreateMove) { 10 | const char* mpt = "mapped_file_test"; 11 | file_unlink file(mpt); 12 | std::string text = "Hello\nThis is a test\n"; 13 | 14 | { 15 | std::ofstream fd(mpt); 16 | fd << text; 17 | } 18 | 19 | mapped_file mf(mpt); 20 | EXPECT_STREQ(mpt, mf.path().c_str()); 21 | ASSERT_NE((char*)0, mf.base()); 22 | ASSERT_EQ(text.size(), mf.length()); 23 | EXPECT_EQ(text, std::string(mf.base(), mf.length())); 24 | 25 | mapped_file mf2 = std::move(mf); 26 | EXPECT_STREQ(mpt, mf2.path().c_str()); 27 | ASSERT_NE((char*)0, mf2.base()); 28 | ASSERT_EQ(text.size(), mf2.length()); 29 | EXPECT_EQ(text, std::string(mf2.base(), mf2.length())); 30 | ASSERT_EQ((char*)0, mf.base()); 31 | 32 | mapped_file mf3(mpt); 33 | mf2 = std::move(mf3); 34 | EXPECT_STREQ(mpt, mf2.path().c_str()); 35 | ASSERT_NE((char*)0, mf2.base()); 36 | ASSERT_EQ(text.size(), mf2.length()); 37 | EXPECT_EQ(text, std::string(mf2.base(), mf2.length())); 38 | ASSERT_EQ((char*)0, mf.base()); 39 | } 40 | 41 | // Gtest and newer compilers seem to have a problem with EXPECT_THROW 42 | #if !defined(__clang__) && (!defined(GTEST_GCC_VER_) || GTEST_GCC_VER_ < 40800) 43 | TEST(MappedFile, Fail) { 44 | const char* bad_file = "/doesntexistsforsure/thatwouldbecrazy!"; 45 | EXPECT_THROW(mapped_file mf(bad_file), jellyfish::mapped_file::ErrorMMap); 46 | 47 | mapped_file mf; 48 | EXPECT_THROW(mf.map(bad_file), jellyfish::mapped_file::ErrorMMap); 49 | EXPECT_EQ((char*)0, mf.base()); 50 | EXPECT_THROW(mf.map(-1), jellyfish::mapped_file::ErrorMMap); 51 | EXPECT_EQ((char*)0, mf.base()); 52 | } 53 | #endif 54 | } 55 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/unit_tests/test_mer_heap.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace { 8 | using jellyfish::mer_dna; 9 | 10 | typedef jellyfish::large_hash::array large_array; 11 | typedef large_array::region_iterator region_iterator; 12 | typedef jellyfish::mer_heap::heap mer_heap; 13 | 14 | static const size_t ary_size = 10000; 15 | static const uint16_t mer_len = 50; 16 | static const size_t nb_mers = ary_size / 2; 17 | 18 | class MerHeapTest : public ::testing::TestWithParam { 19 | public: 20 | static void SetUpTestCase() { 21 | mer_dna::k(mer_len); 22 | shared_ary = new large_array(ary_size, mer_len * 2, 0, 63); 23 | mer_dna m; 24 | 25 | for(size_t i = 0; i < nb_mers; ++i) { 26 | m.randomize(); 27 | bool is_new; 28 | size_t id; 29 | shared_ary->set(m, &is_new, &id); 30 | EXPECT_TRUE(is_new); // Very small probability to fail 31 | } 32 | } 33 | 34 | static void TearDownTestCase() { 35 | delete shared_ary; 36 | } 37 | 38 | static large_array* shared_ary; 39 | }; 40 | large_array* MerHeapTest::shared_ary = 0; 41 | 42 | TEST_P(MerHeapTest, Order) { 43 | uint64_t hash = 0; 44 | int count = 0; 45 | const large_array& ary = *shared_ary; 46 | mer_dna m; 47 | m.polyA(); 48 | 49 | for(size_t slice = 0; slice < GetParam(); ++slice) { 50 | region_iterator rit = ary.iterator_slice(slice, GetParam()); 51 | mer_heap heap(ary.max_reprobe_offset()); 52 | 53 | heap.fill(rit); 54 | 55 | while(!heap.is_empty()) { 56 | uint64_t nhash = ary.matrix().times(heap.head()->key_); 57 | EXPECT_LE(hash, nhash); 58 | if(nhash == hash) 59 | EXPECT_LT(m, heap.head()->key_); 60 | hash = nhash; 61 | m = heap.head()->key_; 62 | 63 | heap.pop(); 64 | ++count; 65 | 66 | if(rit.next()) 67 | heap.push(rit); 68 | } 69 | } 70 | 71 | EXPECT_EQ(nb_mers, count); 72 | } 73 | 74 | INSTANTIATE_TEST_CASE_P(MerHeap, MerHeapTest, ::testing::Range((size_t)1, (size_t)11)); 75 | 76 | } // namespace { 77 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/unit_tests/test_simple_circular_buffer.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | namespace { 5 | 6 | static const int capa = 16; 7 | typedef jellyfish::simple_circular_buffer::pre_alloc test_simple_circular_buffer; 8 | 9 | TEST(SimpleCircularBufferTest, FillEmpty) { 10 | int ary[capa]; 11 | test_simple_circular_buffer buffer(ary); 12 | EXPECT_EQ(capa, buffer.capacity()); 13 | 14 | EXPECT_TRUE(buffer.empty()); 15 | for(int i = 0; i < buffer.capacity(); ++i) { 16 | SCOPED_TRACE(::testing::Message() << "i=" << i); 17 | EXPECT_FALSE(buffer.full()); 18 | EXPECT_EQ(i, buffer.size()); 19 | buffer.push_back(i); 20 | EXPECT_EQ(i, buffer.back()); 21 | EXPECT_FALSE(buffer.empty()); 22 | } 23 | EXPECT_TRUE(buffer.full()); 24 | 25 | for(int i = 0; i < buffer.capacity(); ++i) { 26 | SCOPED_TRACE(::testing::Message() << "i=" << i); 27 | EXPECT_FALSE(buffer.empty()); 28 | EXPECT_EQ(i, buffer.front()); 29 | EXPECT_EQ(buffer.capacity() - i, buffer.size()); 30 | buffer.pop_front(); 31 | EXPECT_FALSE(buffer.full()); 32 | } 33 | EXPECT_TRUE(buffer.empty()); 34 | EXPECT_EQ(0, buffer.size()); 35 | } 36 | 37 | TEST(SimpleCircularBufferTest, Usefull) { 38 | int ary[capa]; 39 | test_simple_circular_buffer buffer(ary); 40 | EXPECT_EQ(capa, buffer.capacity()); 41 | 42 | int i = 0; 43 | for( ; i < buffer.capacity(); ++i) { 44 | EXPECT_TRUE(buffer.push_back()); 45 | buffer.back() = i; 46 | } 47 | 48 | for( ; i < 10 * buffer.capacity(); ++i) { 49 | EXPECT_EQ(i - capa, buffer.front()); 50 | buffer.pop_front(); 51 | EXPECT_TRUE(buffer.push_back()); 52 | buffer.back() = i; 53 | } 54 | } 55 | 56 | } // namespace { 57 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/unit_tests/test_stdio_filebuf.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | namespace { 15 | typedef jellyfish::stdio_filebuf stdio_filebuf; 16 | TEST(StdioFileBuf, Read) { 17 | const char* file_name = "test_stdio_file_buf_read"; 18 | file_unlink fu(file_name); 19 | std::vector buffer(8192); 20 | for(size_t i = 0; i < buffer.size(); ++i) 21 | buffer[i] = '@' + (i % 64); 22 | { 23 | std::ofstream out(file_name); 24 | out.write(buffer.data(), buffer.size()); 25 | } 26 | 27 | int fd = open(file_name, O_RDONLY); 28 | EXPECT_GT(fd, -1); 29 | FILE* file = fopen(file_name, "r"); 30 | EXPECT_NE((FILE*)0, file); 31 | 32 | std::unique_ptr fd_buf(new stdio_filebuf(fd, std::ios::in)); 33 | std::istream fd_stream(fd_buf.get()); 34 | std::unique_ptr file_buf(new stdio_filebuf(file, std::ios::in)); 35 | std::istream file_stream(file_buf.get()); 36 | 37 | size_t have_read = 0; 38 | char read_buffer[256]; 39 | while(have_read < buffer.size()) { 40 | const size_t to_read = random_bits(8); 41 | const size_t expect_read = std::min(buffer.size() - have_read, to_read); 42 | 43 | fd_stream.read(read_buffer, to_read); 44 | EXPECT_EQ(expect_read, fd_stream.gcount()); 45 | EXPECT_EQ(0, std::strncmp(&buffer[have_read], read_buffer, expect_read)); 46 | 47 | file_stream.read(read_buffer, to_read); 48 | EXPECT_EQ(expect_read, fd_stream.gcount()); 49 | EXPECT_EQ(0, std::strncmp(&buffer[have_read], read_buffer, expect_read)); 50 | 51 | have_read += expect_read; 52 | } 53 | EXPECT_TRUE(fd_stream.eof() || fd_stream.peek() == EOF); 54 | EXPECT_TRUE(file_stream.eof() || file_stream.peek() == EOF); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/unit_tests/test_token_ring.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | namespace { 8 | using jellyfish::thread_exec; 9 | struct write_number : public thread_exec { 10 | typedef jellyfish::token_ring token_ring; 11 | 12 | std::ostream *os_; 13 | int nb_threads_; 14 | token_ring ring; 15 | 16 | public: 17 | write_number(std::ostream* os, int nb_threads) : 18 | os_(os), nb_threads_(nb_threads), ring(nb_threads) 19 | { } 20 | 21 | virtual void start(int i) { 22 | token_ring::token& token = ring[i]; 23 | for(int j = 0; j < 10; ++j) { 24 | token.wait(); 25 | *os_ << (nb_threads_ * j + i) << "\n"; 26 | token.pass(); 27 | } 28 | } 29 | }; 30 | 31 | TEST(TokenRing, Count) { 32 | static const int nb_threads = 5; 33 | std::ostringstream out; 34 | 35 | write_number write(&out, nb_threads); 36 | write.exec_join(nb_threads); 37 | 38 | std::ostringstream res; 39 | for(int i = 0; i < nb_threads * 10; ++i) 40 | res << i << "\n"; 41 | 42 | EXPECT_EQ(res.str(), out.str()); 43 | } 44 | } // namespace { 45 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/jellyfish/unit_tests/unit_tests.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | cd tests 4 | . ./compat.sh 5 | 6 | if [ -n "$VALGRIND" ]; then 7 | exec valgrind ${DIR}/test_all 8 | else 9 | exec ${DIR}/test_all 10 | fi 11 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # @configure_input@ 11 | 12 | # serial 3337 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.4.2]) 16 | m4_define([LT_PACKAGE_REVISION], [1.3337]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.4.2' 20 | macro_revision='1.3337' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/m4/m4-ax_swig_enable_cxx.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # http://www.gnu.org/software/autoconf-archive/ax_swig_enable_cxx.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_SWIG_ENABLE_CXX 8 | # 9 | # DESCRIPTION 10 | # 11 | # Enable SWIG C++ support. This affects all invocations of $(SWIG). 12 | # 13 | # LICENSE 14 | # 15 | # Copyright (c) 2008 Sebastian Huber 16 | # Copyright (c) 2008 Alan W. Irwin 17 | # Copyright (c) 2008 Rafael Laboissiere 18 | # Copyright (c) 2008 Andrew Collier 19 | # 20 | # This program is free software; you can redistribute it and/or modify it 21 | # under the terms of the GNU General Public License as published by the 22 | # Free Software Foundation; either version 2 of the License, or (at your 23 | # option) any later version. 24 | # 25 | # This program is distributed in the hope that it will be useful, but 26 | # WITHOUT ANY WARRANTY; without even the implied warranty of 27 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 28 | # Public License for more details. 29 | # 30 | # You should have received a copy of the GNU General Public License along 31 | # with this program. If not, see . 32 | # 33 | # As a special exception, the respective Autoconf Macro's copyright owner 34 | # gives unlimited permission to copy, distribute and modify the configure 35 | # scripts that are the output of Autoconf when processing the Macro. You 36 | # need not follow the terms of the GNU General Public License when using 37 | # or distributing such scripts, even though portions of the text of the 38 | # Macro appear in them. The GNU General Public License (GPL) does govern 39 | # all other use of the material that constitutes the Autoconf Macro. 40 | # 41 | # This special exception to the GPL applies to versions of the Autoconf 42 | # Macro released by the Autoconf Archive. When you make and distribute a 43 | # modified version of the Autoconf Macro, you may extend this special 44 | # exception to the GPL to apply to your modified version as well. 45 | 46 | #serial 9 47 | 48 | AU_ALIAS([SWIG_ENABLE_CXX], [AX_SWIG_ENABLE_CXX]) 49 | AC_DEFUN([AX_SWIG_ENABLE_CXX],[ 50 | AC_REQUIRE([AX_PKG_SWIG]) 51 | AC_REQUIRE([AC_PROG_CXX]) 52 | SWIG="$SWIG -c++" 53 | ]) 54 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/quorum/AUTHORS: -------------------------------------------------------------------------------- 1 | Guillaume Marcais 2 | Aleksey Zimin 3 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/quorum/ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skovaka/stringtie2/647ab5124e18e99164b45a7fa325240ec7a1b56d/SuperReads_RNA/global-1/quorum/ChangeLog -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/quorum/NEWS: -------------------------------------------------------------------------------- 1 | * Initial release 0.1.0. 2 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/quorum/data/adapter.jf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skovaka/stringtie2/647ab5124e18e99164b45a7fa325240ec7a1b56d/SuperReads_RNA/global-1/quorum/data/adapter.jf -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/quorum/gtest.mk: -------------------------------------------------------------------------------- 1 | ############################## 2 | # Gtest build. 3 | ############################## 4 | # Build rules for libraries. 5 | check_LTLIBRARIES = libgtest.la libgtest_main.la 6 | 7 | libgtest_la_SOURCES = unit_tests/gtest/src/gtest-all.cc 8 | libgtest_main_la_SOURCES = unit_tests/gtest/src/gtest_main.cc 9 | libgtest_main_la_LIBADD = libgtest.la 10 | libgtest_la_CXXFLAGS = -I$(srcdir)/unit_tests 11 | libgtest_main_la_CXXFLAGS = -I$(srcdir)/unit_tests 12 | 13 | GTEST_SRC = unit_tests/gtest/src/gtest-all.cc \ 14 | unit_tests/gtest/src/gtest_main.cc \ 15 | unit_tests/gtest/gtest.h 16 | 17 | EXTRA_DIST += $(GTEST_SRC) 18 | 19 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/quorum/include/gzip_stream.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __GZIP_STREAM__ 2 | #define __GZIP_STREAM__ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | template > 10 | class basic_gzipstream : public std::ostream { 11 | typedef __gnu_cxx::stdio_filebuf<_CharT> stdbuf; 12 | public: 13 | basic_gzipstream(const char *filename) : std::ostream(open_gzip(filename)), closed(false) { } 14 | virtual ~basic_gzipstream() { 15 | close(); 16 | delete rdbuf(); 17 | } 18 | void close() { 19 | if(!closed) { 20 | flush(); 21 | pclose(((stdbuf*)rdbuf())->file()); 22 | closed = true; 23 | } 24 | } 25 | 26 | private: 27 | static stdbuf *open_gzip(const char *filename) { 28 | std::string command("gzip -1 > '"); 29 | command += filename; 30 | command += "'"; 31 | FILE *f = popen(command.c_str(), "w"); 32 | if(!f) 33 | throw std::runtime_error("popen failed"); 34 | return new stdbuf(f, std::ios::out); 35 | } 36 | bool closed; 37 | }; 38 | 39 | typedef basic_gzipstream gzipstream; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/quorum/include/misc.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __MISC_HPP__ 2 | #define __MISC_HPP__ 3 | 4 | //#define _GNU_SOURCE 5 | #include 6 | #include 7 | #include 8 | 9 | // IO manipulator for substrings 10 | class substr { 11 | 12 | public: 13 | const char * const _str; 14 | size_t const _len; 15 | substr(const char *str, size_t len) : 16 | _str(str), _len(len) {} 17 | substr(const char *str, const char *end) : 18 | _str(str), _len(end > str ? end - str : 0) {} 19 | }; 20 | inline bool is_base(const char c) { 21 | switch(c) { 22 | case 'A': case 'C': case 'G': case 'T': 23 | case 'a': case 'c': case 'g': case 't': 24 | return true; 25 | 26 | default: 27 | return false; 28 | } 29 | } 30 | inline bool not_base(const char c) { return !is_base(c); } 31 | inline std::ostream & operator<<(std::ostream &os, const substr &ss) { 32 | assert(std::count_if(ss._str, ss._str+ss._len, not_base) == 0); 33 | return os.write(ss._str, ss._len); 34 | } 35 | 36 | template 37 | int getFldsFromLine(char *line, T &res) { 38 | char *saveptr; 39 | res.clear(); 40 | 41 | char *tok = strtok_r(line, " \t\n", &saveptr); 42 | while(tok) { 43 | res.push_back(tok); 44 | tok = strtok_r(0, " \t\n", &saveptr); 45 | } 46 | return res.size(); 47 | } 48 | 49 | template 50 | int appendFldsFromLine(char *line, T &res) { 51 | char *saveptr; 52 | int numFlds = 0; 53 | 54 | char *tok = strtok_r(line, " \t\n", &saveptr); 55 | while(tok) { 56 | res.push_back(tok); 57 | ++numFlds; 58 | tok = strtok_r(0, " \t\n", &saveptr); 59 | } 60 | return numFlds; 61 | } 62 | 63 | #include 64 | 65 | #define BREAKPOINT raise(SIGINT); 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/quorum/src/err_log.cc: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/quorum/src/histo_mer_database.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | 6 | namespace err = jellyfish::err; 7 | 8 | int main(int argc, char* argv[]) 9 | { 10 | if(argc != 2) 11 | err::die(err::msg() << "Usage: " << argv[0] << " db"); 12 | 13 | static const size_t hlen = 1001; 14 | uint64_t histos[hlen][2]; 15 | memset(histos, '\0', sizeof(histos)); 16 | const database_query mer_database(argv[1]); 17 | for(auto it = mer_database.begin(); it != mer_database.end(); ++it) { 18 | auto& vals = it->second; 19 | const uint64_t val = std::min(vals.first, hlen - 1); 20 | ++histos[val][vals.second]; 21 | } 22 | 23 | for(size_t i = 0; i < hlen; ++i) { 24 | if(histos[i][0] || histos[i][1]) 25 | std::cout << i << " " << histos[i][0] << " " << histos[i][1] << "\n"; 26 | } 27 | 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/quorum/src/query_mer_database.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | namespace err = jellyfish::err; 6 | 7 | int main(int argc, char *argv[]) 8 | { 9 | if(argc < 3) 10 | err::die(err::msg() << "Usage: " << argv[0] << " db mer ..."); 11 | 12 | database_query mer_database(argv[1]); 13 | mer_dna::k(mer_database.header().key_len() / 2); 14 | std::cout << mer_dna::k() << "\n"; 15 | mer_dna m; 16 | 17 | for(int i = 2; i < argc; ++i) { 18 | m = argv[i]; 19 | m.canonicalize(); 20 | auto v = mer_database[m]; 21 | std::cout << argv[i] << ":" << m << " val:" << v.first << " qual:" << v.second << "\n"; 22 | } 23 | 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/quorum/src/split_mate_pairs.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | 7 | void print_sequence(std::string& line, std::ostream& os, const std::string& file) { 8 | os << line << '\n'; 9 | std::getline(std::cin, line); 10 | os << line << '\n'; 11 | if(!os.good()) 12 | cmdline::error() << "Error while writing to file '" << file << "'"; 13 | } 14 | 15 | int main(int argc, char *argv[]) { 16 | cmdline args(argc, argv); 17 | 18 | std::string file1(args.prefix_arg), file2(args.prefix_arg); 19 | file1 += "_1.fa"; 20 | file2 += "_2.fa"; 21 | std::ofstream out1(file1), out2(file2); 22 | if(!out1.good()) 23 | cmdline::error() << "Failed to open output file '" << file1 << "'"; 24 | if(!out2.good()) 25 | cmdline::error() << "Failed to open output file '" << file2 << "'"; 26 | 27 | std::string line; 28 | bool first = true; 29 | for( ; std::getline(std::cin, line); first = !first) 30 | print_sequence(line, first ? out1 : out2, first ? file1 : file2); 31 | 32 | return 0; 33 | } 34 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/quorum/src/verbose_log.hpp: -------------------------------------------------------------------------------- 1 | /* Quorum 2 | * Copyright (C) 2012 Genome group at University of Maryland. 3 | * 4 | * This program is free software: you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation, either version 3 of the 7 | * License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef _VERBOSE_LOG_HPP_ 19 | #define _VERBOSE_LOG_HPP_ 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | template 26 | class basic_verbose_log : public std::basic_ostringstream { 27 | typedef std::ostringstream super; 28 | 29 | public: 30 | static bool verbose; 31 | 32 | basic_verbose_log() : super() { 33 | time_t t = time(0); 34 | struct tm d; 35 | localtime_r(&t, &d); 36 | // auto save = this->flags(); 37 | const T f = this->fill('0'); 38 | *this << "[" 39 | << std::setw(4) << (1900 + d.tm_year) << "/" 40 | << std::setw(2) << (d.tm_mon + 1) << "/" 41 | << std::setw(2) << d.tm_mday << " " 42 | << std::setw(2) << d.tm_hour << ":" 43 | << std::setw(2) << d.tm_min << ":" 44 | << std::setw(2) << d.tm_sec 45 | << "] "; 46 | this->fill(f); 47 | } 48 | ~basic_verbose_log() { 49 | if(verbose) 50 | std::cerr << super::str() << std::endl; 51 | } 52 | 53 | std::ostream& operator<<(const char* str) { 54 | return *static_cast(this) << str; 55 | } 56 | }; 57 | template 58 | bool basic_verbose_log::verbose = false; 59 | typedef basic_verbose_log verbose_log; 60 | 61 | #define vlog if(1) verbose_log() 62 | 63 | #endif /* _VERBOSE_LOG_HPP_ */ 64 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/quorum/unit_tests/gtest/src/gtest_main.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #include 31 | 32 | #include "gtest/gtest.h" 33 | 34 | GTEST_API_ int main(int argc, char **argv) { 35 | printf("Running main() from gtest_main.cc\n"); 36 | testing::InitGoogleTest(&argc, argv); 37 | return RUN_ALL_TESTS(); 38 | } 39 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/quorum/unit_tests/test_misc.hpp: -------------------------------------------------------------------------------- 1 | #ifndef _TEST_MISC_H_ 2 | #define _TEST_MISC_H_ 3 | 4 | #include 5 | 6 | struct file_unlink { 7 | std::string path; 8 | bool do_unlink; 9 | explicit file_unlink(const char* s, bool d = true) : path(s), do_unlink(d) { } 10 | explicit file_unlink(const std::string& s, bool d = true) : path(s), do_unlink(d) { } 11 | 12 | ~file_unlink() { 13 | if(do_unlink) 14 | unlink(path.c_str()); 15 | } 16 | }; 17 | 18 | 19 | #endif /* _TEST_MISC_H_ */ 20 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/ufasta/Makefile.am: -------------------------------------------------------------------------------- 1 | ACLOCAL_AMFLAGS = -I m4 2 | 3 | AM_CPPFLAGS = -Wall -I$(srcdir) 4 | AM_CXXFLAGS = $(ALL_CXXFLAGS) -g -O3 5 | AM_LDFLAGS = 6 | 7 | bin_PROGRAMS = ufasta 8 | noinst_HEADERS = $(YAGGO_SRCS) common.hpp 9 | BUILT_SOURCES = $(YAGGO_SRCS) 10 | CLEANFILES = 11 | DISTCLEANFILES = $(BUILT_SOURCES) 12 | EXTRA_DIST = 13 | 14 | # Yaggo automatic rules with silencing 15 | V_YAGGO = $(V_YAGGO_$(V)) 16 | V_YAGGO_ = $(V_YAGGO_$(AM_DEFAULT_VERBOSITY)) 17 | V_YAGGO_0 = @echo " YAGGO " $@; 18 | .yaggo.hpp: 19 | # $(V_YAGGO)$(YAGGO) --license $(srcdir)/header-license -o $@ $< 20 | $(V_YAGGO)$(YAGGO) -o $@ $< 21 | 22 | YAGGO_SRCS = # Append all file to be built by yaggo 23 | 24 | ################## 25 | # Build binaries # 26 | ################## 27 | SUB_CMDS = one.cc sizes.cc head.cc tail.cc rc.cc n50.cc extract.cc \ 28 | format.cc sort.cc dsort.cc split.cc 29 | 30 | if HAVE_BOOST_REGEX 31 | AM_LDFLAGS += -lboost_regex 32 | SUB_CMDS += hgrep.cc dgrep.cc 33 | endif 34 | 35 | ufasta_SOURCES = ufasta.cc $(SUB_CMDS) 36 | YAGGO_SRCS += $(SUB_CMDS:.cc=_cmdline.hpp) 37 | 38 | ######### 39 | # Tests # 40 | ######### 41 | tests/testsh: tests/testsh.in 42 | @mkdir -p $(dir $@) 43 | $(AM_V_GEN)sed -e 's,[@]SRCDIR[@],$(abs_srcdir),g' \ 44 | -e 's,[@]BUILDDIR[@],$(abs_builddir),g' $< > $@ 45 | @chmod a+x $@ 46 | 47 | check_SCRIPTS = tests/testsh 48 | CLEANFILES += $(check_SCRIPTS) 49 | EXTRA_DIST += tests/testsh.in 50 | 51 | TESTS = tests/test_head.sh tests/test_tail.sh tests/test_rc.sh \ 52 | tests/test_one.sh tests/test_hgrep.sh tests/test_n50.sh \ 53 | tests/test_sizes.sh tests/test_extract.sh \ 54 | tests/test_format.sh tests/test_sort.sh tests/test_dsort.sh \ 55 | tests/test_dgrep.sh tests/test_split.sh 56 | EXTRA_DIST += $(TESTS) tests/test1.fasta 57 | TEST_EXTENSIONS = .sh 58 | SH_LOG_COMPILER = ./tests/testsh 59 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/ufasta/common.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __COMMON_H__ 2 | #define __COMMON_H__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | inline std::istream& skip_line(std::istream& is) { 9 | return is.ignore(std::numeric_limits::max(), '\n'); 10 | } 11 | 12 | struct entry { 13 | int size; 14 | std::vector lines; 15 | void add_line(std::istream& is) { 16 | if(size >= (int)lines.size()) 17 | lines.push_back(""); 18 | std::getline(is, lines[size]); 19 | ++size; 20 | } 21 | }; 22 | 23 | #endif /* __COMMON_H__ */ 24 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/ufasta/dgrep.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #include "common.hpp" 8 | #include 9 | 10 | 11 | int dgrep_main(int argc, char *argv[]) { 12 | dgrep_cmdline args(argc, argv); 13 | if(args.file_arg.empty()) { 14 | args.file_arg.push_back("/dev/stdin"); 15 | if(isatty(0)) 16 | std::cerr << "Warning: reading from terminal" << std::endl; 17 | } 18 | boost::regex regexp; 19 | 20 | try { 21 | regexp = args.regexp_arg; 22 | } catch(boost::bad_expression error) { 23 | std::cerr << "Invalid regular expression: " << error.what() << "\n" 24 | << " " << args.regexp_arg << "\n" 25 | << std::string(1 + error.position(), ' ') << "^" << std::endl; 26 | return EXIT_FAILURE; 27 | } 28 | 29 | size_t max_count = args.max_count_given ? args.max_count_arg : std::numeric_limits::max(); 30 | size_t n_line = 0; 31 | std::string line, header; 32 | for(auto file : args.file_arg) { 33 | try { 34 | std::ifstream is; 35 | is.exceptions(std::ios::failbit|std::ios::badbit); 36 | is.open(file); 37 | int c; 38 | // Display unchanged up to first header 39 | for(c = is.peek(); c != '>' && c != EOF; c = is.peek()) { 40 | ++n_line; 41 | std::getline(is, line); 42 | if(args.line_number_flag) 43 | std::cout << n_line << ':'; 44 | std::cout << line << '\n'; 45 | } 46 | 47 | while(c != EOF && max_count > 0) { 48 | const size_t header_n_line = ++n_line; 49 | std::getline(is, header); 50 | bool header_printed = false; 51 | 52 | for(c = is.peek(); c != '>' && c != EOF; c = is.peek()) { 53 | ++n_line; 54 | std::getline(is, line); 55 | if(regex_search(line.cbegin(), line.cend(), regexp) ^ args.invert_match_flag) { 56 | if(!header_printed) { 57 | if(args.line_number_flag) 58 | std::cout << header_n_line << ':'; 59 | std::cout << header << '\n'; 60 | header_printed = true; 61 | } 62 | if(args.line_number_flag) 63 | std::cout << n_line << ':'; 64 | std::cout << line << '\n'; 65 | if(--max_count == 0) break; 66 | } 67 | } 68 | } 69 | } catch(std::ios::failure) { 70 | std::cerr << "Error with file '" << file << '\'' << std::endl; 71 | return EXIT_FAILURE; 72 | } 73 | } 74 | 75 | return EXIT_SUCCESS; 76 | } 77 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/ufasta/dsort.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | int dsort_main(int argc, char *argv[]) { 8 | dsort_cmdline args(argc, argv); 9 | if(args.file_arg.empty()) { 10 | args.file_arg.push_back("/dev/stdin"); 11 | if(isatty(0)) 12 | std::cerr << "Warning: reading from terminal" << std::endl; 13 | } 14 | 15 | int res = EXIT_SUCCESS; 16 | int c; 17 | entry data; 18 | std::string header; 19 | for(const auto& file : args.file_arg) { 20 | try { 21 | std::ifstream is; 22 | is.exceptions(std::ios::failbit|std::ios::badbit); 23 | is.open(file); 24 | // Display unchanged up to first header 25 | for(c = is.peek(); c != '>' && c != EOF; c = is.peek()) { 26 | std::getline(is, header); 27 | std::cout << header << '\n'; 28 | } 29 | 30 | while(c != EOF) { 31 | std::getline(is, header); 32 | data.size = 0; 33 | for(c = is.peek() ; c != '>' && c != EOF; c = is.peek()) 34 | data.add_line(is); 35 | std::sort(data.lines.begin(), data.lines.begin() + data.size); 36 | std::cout << header << '\n'; 37 | for(int i = 0; i < data.size; ++i) 38 | std::cout << data.lines[i] << '\n'; 39 | } 40 | } catch(std::ios::failure) { 41 | std::cerr << "Error with file '" << file << '\'' << std::endl; 42 | res = EXIT_FAILURE; 43 | } 44 | } 45 | 46 | return res; 47 | } 48 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/ufasta/format.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | void cleanup(std::string& l, const bool lc, const bool uc, const bool space) { 9 | if(!(lc || uc || space)) return; 10 | size_t j = 0; 11 | for(size_t i = 0; i < l.size(); ++i) { 12 | if(space && std::isspace(l[i])) continue; 13 | if(lc) l[j] = std::tolower(l[i]); 14 | if(uc) l[j] = std::toupper(l[i]); 15 | ++j; 16 | } 17 | l.resize(j); 18 | } 19 | 20 | int format_main(int argc, char *argv[]) { 21 | format_cmdline args(argc, argv); 22 | if(args.file_arg.empty()) { 23 | args.file_arg.push_back("/dev/stdin"); 24 | if(isatty(0)) 25 | std::cerr << "Warning: reading from terminal" << std::endl; 26 | } 27 | 28 | 29 | std::string line; 30 | for(auto file : args.file_arg) { 31 | try { 32 | std::ifstream is; 33 | is.exceptions(std::ios::failbit|std::ios::badbit); 34 | is.open(file); 35 | 36 | int c; 37 | // Display unchanged up to first header 38 | for(c = is.peek(); c != '>' && c != EOF; c = is.peek()) { 39 | std::getline(is, line); 40 | std::cout << line << '\n'; 41 | } 42 | 43 | while(c != EOF) { 44 | std::getline(is, line); // Header 45 | std::cout << line << '\n'; 46 | 47 | size_t ooff = 0; // current out offset 48 | bool empty = true; 49 | for(c = is.peek(); c != '>' && c != EOF; c = is.peek()) { 50 | std::getline(is, line); 51 | cleanup(line, args.lower_case_flag, args.upper_case_flag, args.spaces_flag); 52 | size_t loff = 0; // current line offset 53 | while(true) { 54 | const size_t out_left = args.line_length_arg - ooff; 55 | const size_t line_left = line.size() - loff; 56 | if(out_left < line_left) { 57 | std::cout.write(line.c_str() + loff, out_left); 58 | std::cout << '\n'; 59 | empty = false; 60 | ooff = 0; 61 | loff += out_left; 62 | } else { 63 | std::cout.write(line.c_str() + loff, line_left); 64 | empty = false; 65 | ooff += line_left; 66 | break; 67 | } 68 | } 69 | } 70 | if(!empty) 71 | std::cout << '\n'; 72 | } 73 | } catch(std::ios::failure) { 74 | std::cerr << "Error with file '" << file << '\'' << std::endl; 75 | return EXIT_FAILURE; 76 | } 77 | } 78 | 79 | return EXIT_SUCCESS; 80 | } 81 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/ufasta/hgrep.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #include "common.hpp" 8 | #include 9 | 10 | 11 | int hgrep_main(int argc, char *argv[]) { 12 | hgrep_cmdline args(argc, argv); 13 | if(args.file_arg.empty()) { 14 | args.file_arg.push_back("/dev/stdin"); 15 | if(isatty(0)) 16 | std::cerr << "Warning: reading from terminal" << std::endl; 17 | } 18 | 19 | boost::regex regexp; 20 | 21 | try { 22 | regexp = args.regexp_arg; 23 | } catch(boost::bad_expression error) { 24 | std::cerr << "Invalid regular expression: " << error.what() << "\n" 25 | << " " << args.regexp_arg << "\n" 26 | << std::string(1 + error.position(), ' ') << "^" << std::endl; 27 | return EXIT_FAILURE; 28 | } 29 | 30 | size_t max_count = args.max_count_given ? args.max_count_arg : std::numeric_limits::max(); 31 | std::string line; 32 | for(auto file : args.file_arg) { 33 | try { 34 | std::ifstream is; 35 | is.exceptions(std::ios::failbit|std::ios::badbit); 36 | is.open(file); 37 | bool skip = true; 38 | int c; 39 | // Display unchanged up to first header 40 | for(c = is.peek(); c != '>' && c != EOF; c = is.peek()) { 41 | std::getline(is, line); 42 | std::cout << line << '\n'; 43 | } 44 | 45 | while(c != EOF) { 46 | std::getline(is, line); 47 | skip = !regex_search(++line.cbegin(), line.cend(), regexp) ^ args.invert_match_flag; 48 | if(skip) { 49 | for(c = is.peek(); c != '>' && c != EOF; c = is.peek()) 50 | skip_line(is); 51 | } else { 52 | if(max_count-- == 0) break; 53 | std::cout << line << '\n'; 54 | for(c = is.peek(); c != '>' && c != EOF; c = is.peek()) { 55 | std::getline(is, line); 56 | std::cout << line << '\n'; 57 | } 58 | } 59 | } 60 | } catch(std::ios::failure) { 61 | std::cerr << "Error with file '" << file << '\'' << std::endl; 62 | return EXIT_FAILURE; 63 | } 64 | } 65 | 66 | return EXIT_SUCCESS; 67 | } 68 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/ufasta/one.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | 7 | int one_main(int argc, char *argv[]) { 8 | one_cmdline args(argc, argv); 9 | if(args.file_arg.empty()) { 10 | args.file_arg.push_back("/dev/stdin"); 11 | if(isatty(0)) 12 | std::cerr << "Warning: reading from terminal" << std::endl; 13 | } 14 | 15 | 16 | std::string line; 17 | for(auto file : args.file_arg) { 18 | try { 19 | std::ifstream is; 20 | is.exceptions(std::ios::failbit|std::ios::badbit); 21 | is.open(file); 22 | 23 | int c; 24 | // Display unchanged up to first header 25 | for(c = is.peek(); c != '>' && c != EOF; c = is.peek()) { 26 | std::getline(is, line); 27 | std::cout << line << '\n'; 28 | } 29 | 30 | while(c != EOF) { 31 | std::getline(is, line); // Header 32 | std::cout << line << '\n'; 33 | 34 | for(c = is.peek(); c != '>' && c != EOF; c = is.peek()) { 35 | std::getline(is, line); 36 | std::cout << line; 37 | } 38 | std::cout << '\n'; 39 | } 40 | } catch(std::ios::failure) { 41 | std::cerr << "Error with file '" << file << '\'' << std::endl; 42 | return EXIT_FAILURE; 43 | } 44 | } 45 | 46 | return EXIT_SUCCESS; 47 | } 48 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/ufasta/sizes.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "common.hpp" 6 | #include 7 | 8 | int sizes_main(int argc, char *argv[]) { 9 | sizes_cmdline args(argc, argv); 10 | if(args.file_arg.empty()) { 11 | args.file_arg.push_back("/dev/stdin"); 12 | if(isatty(0)) 13 | std::cerr << "Warning: reading from terminal" << std::endl; 14 | } 15 | 16 | std::string line; 17 | for(auto file : args.file_arg) { 18 | try { 19 | std::ifstream is; 20 | is.exceptions(std::ios::failbit|std::ios::badbit); 21 | is.open(file); 22 | if((args.file_arg.size() > 1 && !args.quiet_flag) || args.verbose_flag) 23 | std::cout << "==> " << file << " <==\n"; 24 | 25 | int c; 26 | size_t offset = 0; 27 | 28 | // Skip up to first header 29 | for(c = is.peek(); c != '>' && c != EOF; c = is.peek()) { 30 | skip_line(is); 31 | offset += is.gcount(); 32 | } 33 | 34 | while(c != EOF) { 35 | if(!args.header_flag) { 36 | skip_line(is); 37 | offset += is.gcount(); 38 | } else { 39 | std::getline(is, line); 40 | offset += line.size() + 1; 41 | auto last = line.find_first_of(" \t"); 42 | std::cout.write(line.c_str() + 1, (last == std::string::npos ? line.size() : last) - 1); 43 | std::cout << ' '; 44 | } 45 | const size_t save_offset = offset; 46 | 47 | size_t size = 0; 48 | for(c = is.peek(); c != '>' && c != EOF; c = is.peek()) { 49 | skip_line(is); 50 | offset += is.gcount(); 51 | size += is.gcount() - 1; 52 | } 53 | std::cout << size; 54 | if(args.index_flag) std::cout << ' ' << save_offset << ' ' << offset; 55 | std::cout << '\n'; 56 | } 57 | } catch(std::ios::failure) { 58 | std::cerr << "Error with file '" << file << '\'' << std::endl; 59 | return EXIT_FAILURE; 60 | } 61 | } 62 | 63 | return EXIT_SUCCESS; 64 | } 65 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/ufasta/tests/test_dgrep.sh: -------------------------------------------------------------------------------- 1 | 2 | RES=$(ufasta dgrep 'CacGACgcggatGaGTcGcagAgccG.*GcGatcGcCtCacAGCAaGTtC' $TEST1) 3 | EXPECT_EQ ">read6" $(echo "$RES" | head -n 1) "Got read6" 4 | 5 | RES=$(ufasta dgrep 'acgt' $TEST1 | grep -v '^>') 6 | GR=$(grep 'acgt' $TEST1) 7 | EXPECT_EQ "$GR" "$RES" "Identical to grep" 8 | 9 | RES=$(ufasta dgrep -n 'act' $TEST1 | grep -v '>') 10 | GR=$(grep -n 'act' $TEST1) 11 | EXPECT_EQ "$GR" "$RES" "Identical to grep, line numbers" 12 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/ufasta/tests/test_dsort.sh: -------------------------------------------------------------------------------- 1 | 2 | NB=$(grep -c '^>' $TEST1) 3 | for i in $(seq 0 $((NB - 1))); do 4 | ufasta dsort $TEST1 | ufasta extract -n "read$i" | tail -n +2 | sort -C 5 | EXPECT_SUCCESS "Sorted entry $i" 6 | done 7 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/ufasta/tests/test_extract.sh: -------------------------------------------------------------------------------- 1 | 2 | EXPECT_EQ "" "$(ufasta extract $TEST1 | head -n 1)" "Extract empty" 3 | diff $TEST1 <(ufasta extract -v -f /dev/null $TEST1) 4 | EXPECT_SUCCESS "Extract all" 5 | 6 | diff <(ufasta hgrep '^read(4|5|7|10|32)\b' $TEST1) \ 7 | <(ufasta extract -n read10 -n read5 -n toto -f <(echo read4 read5 blah read7) -f <(echo read32) -f /dev/null $TEST1) 8 | EXPECT_SUCCESS "Extract 5 reads" 9 | 10 | diff <(ufasta hgrep -v '^read(4|5|7|10|32)\b' $TEST1) \ 11 | <(ufasta extract -v -n read10 -n read5 -n toto -f <(echo read4 read5 blah read7) -f <(echo read32) -f /dev/null $TEST1) 12 | EXPECT_SUCCESS "Extract complement 5 reads" 13 | 14 | diff <(ufasta hgrep -v -m 4 '^read(4|5|7|10|32)\b' $TEST1) \ 15 | <(ufasta extract -v -m 4 -n read10 -n read5 -n toto -f <(echo read4 read5 blah read7) -f <(echo read32) -f /dev/null $TEST1) 16 | EXPECT_SUCCESS "Extract complement 4 reads" 17 | 18 | NBT=$(grep -c '^>' $TEST1) 19 | NBE=$(ufasta extract -p 0.5 $TEST1 | grep -c '^>') 20 | # Small probability to fail 21 | perl -e 'exit(!($ARGV[1] >= $ARGV[0] / 4 && $ARGV[1] <= 3 * $ARGV[0] / 4))' $NBT $NBE 22 | EXPECT_SUCCESS "Extract random number of reads" 23 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/ufasta/tests/test_format.sh: -------------------------------------------------------------------------------- 1 | 2 | diff <(ufasta one $TEST1) <(ufasta format -l 15 $TEST1 | ufasta one $TEST1) 3 | EXPECT_SUCCESS "Format then one" 4 | 5 | ufasta format -l 15 $TEST1 | grep -v '^>' | perl -ne 'chomp; length($_) <= 15 || exit(1)' 6 | EXPECT_SUCCESS "Short lines" 7 | 8 | diff <(ufasta one $TEST1 | grep -v '^>' | tr '[:upper:]' '[:lower:]') <(ufasta format -L $TEST1 | ufasta one /dev/fd/0 | grep -v '^>') 9 | EXPECT_SUCCESS "Lower case" 10 | 11 | diff <(ufasta one $TEST1 | grep -v '^>' | tr '[:lower:]' '[:upper:]') <(ufasta format -U $TEST1 | ufasta one /dev/fd/0 | grep -v '^>') 12 | EXPECT_SUCCESS "Uppr case" 13 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/ufasta/tests/test_head.sh: -------------------------------------------------------------------------------- 1 | 2 | x=$(ufasta head $TEST1 | grep -c '^>') 3 | EXPECT_EQ 10 $x "Output default number of entries" 4 | 5 | x=$(ufasta head -n 2 $TEST1 | grep -c '^>') 6 | EXPECT_EQ 2 $x "Output 2 entries" 7 | x=$(ufasta head -n -2 $TEST1 | grep -c '^>') 8 | EXPECT_EQ 48 $x "Output 48 entries" 9 | 10 | x=$(ufasta head -n 3 $TEST1 | wc -l) 11 | r=$(head -n $((x + 1)) $TEST1 | tail -n 1) 12 | EXPECT_EQ ">read3" "$r" "Output correct number of lines 1" 13 | x2=$(ufasta head -n -3 $TEST1 | wc -l) 14 | r2=$(head -n $x2 $TEST1 | grep '^>' | tail -n 1) 15 | EXPECT_EQ ">read46" "$r2" "Output correct number of lines 2" 16 | 17 | l=$(ufasta head -n 3 $TEST1) 18 | el=$(head -n $x $TEST1) 19 | EXPECT_EQ "$el" "$l" "Output correct lines 1" 20 | l=$(ufasta head -n -3 $TEST1) 21 | el=$(head -n $x2 $TEST1) 22 | EXPECT_EQ "$el" "$l" "Output correct lines 2" 23 | 24 | l=$(ufasta head -v $TEST1 | head -n 1) 25 | EXPECT_EQ "==> $TEST1 <==" "$l" "Output header verbose" 26 | l=$(ufasta head $TEST1 $TEST1 | head -n 1) 27 | EXPECT_EQ "==> $TEST1 <==" "$l" "Output header many" 28 | l=$(ufasta head -q $TEST1 $TEST1 | head -n 1) 29 | EXPECT_EQ ">read0" "$l" "Output header quiet" 30 | 31 | 32 | # Test byte switch 33 | l=$(ufasta head -c 0 $TEST1) 34 | EXPECT_EQ "" "$l" "-c 0" 35 | for i in $(seq 1 50 $(wc -c < $TEST1)); do 36 | l=$(ufasta head -c $i $TEST1 | grep -c '^>') 37 | EXPECT_LT 0 "$l" "-c $i at least one entry" 38 | l=$(ufasta head -c $i $TEST1 | wc -c) 39 | EXPECT_LE $i $l "-c $i at least $i bytes" 40 | 41 | l=$(ufasta head -c $i $TEST1; ufasta tail -c +$i $TEST1) 42 | EXPECT_EQ "$(cat $TEST1)" "$l" "tail + head -c +$i" 43 | done 44 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/ufasta/tests/test_hgrep.sh: -------------------------------------------------------------------------------- 1 | 2 | diff <(ufasta one $TEST1 | grep -A 1 '^>read1' | grep -v -- --) <(ufasta hgrep '^read1' $TEST1 | ufasta one /dev/fd/0) 3 | EXPECT_SUCCESS "Grep for ^read1" 4 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/ufasta/tests/test_n50.sh: -------------------------------------------------------------------------------- 1 | 2 | ufasta n50 -H -N10 -N25 -N50 -N75 -N90 $TEST1 | sort -c -r 3 | EXPECT_SUCCESS "Ns statistics sorted" 4 | 5 | S=$(ufasta n50 -H -S $TEST1) 6 | ES=$(grep -v '^>' $TEST1 | perl -ne 'chomp; print' | wc -c) 7 | EXPECT_EQ "$ES" "$S" "Correct sum size" 8 | C=$(grep -c '^>' $TEST1) 9 | 10 | EALL=$(cat <' $TEST1) <(ufasta one $TEST1 | grep '^>') 3 | EXPECT_SUCCESS "Identical headers" 4 | 5 | diff <(grep -v '^>' $TEST1 | perl -ne 'chomp; print') <(ufasta one $TEST1 | grep -v '^>' | perl -ne 'chomp; print') 6 | EXPECT_SUCCESS "Identical sequence" 7 | 8 | first=$((echo -e 'toto\ntata'; cat $TEST1) | ufasta one /dev/fd/0 | head -n 2) 9 | expect=$(echo -e 'toto\ntata') 10 | EXPECT_EQ "$expect" "$first" "Keep pre-header" 11 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/ufasta/tests/test_rc.sh: -------------------------------------------------------------------------------- 1 | 2 | ori=$(cat $TEST1 | wc) 3 | rc=$(ufasta rc $TEST1 | wc) 4 | EXPECT_EQ "$ori" "$rc" "Output same length" 5 | 6 | ori=$(cat $TEST1) 7 | id=$(ufasta rc $TEST1 | ufasta rc /dev/fd/0) 8 | EXPECT_EQ "$ori" "$id" "Involution" 9 | 10 | paste <(ufasta rc $TEST1 | ufasta one /dev/fd/0 | grep -v '^>') <(ufasta one $TEST1 | grep -v '^>') | \ 11 | perl -ane '$F[0] = uc($F[0]); $F[1] =~ tr/ACGTacgt/TGCATGCA/; $F[1] = reverse($F[1]); exit(1) unless $F[0] eq $F[1]' 12 | EXPECT_SUCCESS "Reverse complement" 13 | 14 | ori=$(cat $TEST1 | wc) 15 | can=$(ufasta rc -C $TEST1 | wc) 16 | EXPECT_EQ "$ori" "$rc" "Output -C same length" 17 | 18 | first=$(ufasta rc -C $TEST1) 19 | second=$(echo "$first" | ufasta rc -C /dev/fd/0) 20 | EXPECT_EQ "$first" "$second" "Projection" 21 | 22 | paste <(ufasta rc -C $TEST1 | ufasta one /dev/fd/0 | grep -v '^>') <(ufasta one $TEST1 | grep -v '^>') | \ 23 | perl -ane '$F[0] = uc($F[0]); $F[1] = uc($F[1]); $rc = reverse($F[1]); $rc =~ tr/ACGT/TGCA/; unless(($F[0] eq $rc || $F[0] eq $F[1]) && $F[0] cmp $F[1] <= 0) { print("$.\n0 $F[0]\n1 $F[1]\n2 $rc"); exit(1) }' 24 | EXPECT_SUCCESS "Canonical" 25 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/ufasta/tests/test_sizes.sh: -------------------------------------------------------------------------------- 1 | 2 | ES=$(ufasta n50 -H -S $TEST1) 3 | S=$(ufasta sizes $TEST1 | perl -ane '$c += $F[0]; END { print $c, "\n" }') 4 | EXPECT_EQ "$ES" "$S" "Sum of sizes" 5 | 6 | offset=0 7 | ufasta sizes -i $TEST1 | while read s o eo; do 8 | test $offset -lt $o || fail "Offset not increasing enough" 9 | offset=$((o + s)) 10 | done 11 | EXPECT_SUCCESS "Offset increment" 12 | 13 | i=0 14 | ufasta sizes -i $TEST1 | while read s o eo; do 15 | diff <(ufasta hgrep "^read$i\b" $TEST1 | tail -n +2) \ 16 | <(tail -c +$((o + 1)) $TEST1 | head -c $((eo - o))) 17 | EXPECT_SUCCESS "Compare sequence $i" 18 | i=$((i+1)) 19 | done 20 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/ufasta/tests/test_sort.sh: -------------------------------------------------------------------------------- 1 | 2 | SORT_SIZES=$(ufasta sort $TEST1 | ufasta sizes -H /dev/fd/0) 3 | SIZES_SORT=$(ufasta sizes -H $TEST1 | sort -k1,1) 4 | EXPECT_EQ "$SIZES_SORT" "$SORT_SIZES" "Sorted sizes" 5 | 6 | SORT_SIZES=$(sed -e 's/>read\([0-9]\+\)/>blah read\1/' $TEST1 | ufasta sort -k 2 /dev/stdin | ufasta sizes -H /dev/fd/0) 7 | SIZES_SORT=$(ufasta sizes -H $TEST1 | sort -k1,1 | sed -e 's/read[0-9]\+/blah/') 8 | EXPECT_EQ "$SIZES_SORT" "$SORT_SIZES" "Sorted sizes, second column" 9 | 10 | SORT_SIZES=$(sed -e 's/>read\([0-9]\+\)/>blah read\1/' $TEST1 | ufasta sort -C 5 -k 2 -n /dev/stdin | ufasta sizes -H /dev/fd/0) 11 | SIZES_SORT=$(ufasta sizes -H $TEST1 | sort -n -k1.5,1.10 | sed -e 's/read[0-9]\+/blah/') 12 | EXPECT_EQ "$SIZES_SORT" "$SORT_SIZES" "Sorted sizes, numeric, second column" 13 | 14 | 15 | SORT_SORT=$(ufasta sort $TEST1 | sort) 16 | SORT_ONCE=$(sort $TEST1) 17 | EXPECT_EQ "$SORT_ONCE" "$SORT_SORT" "Sorted content" 18 | 19 | SORT_SIZES=$(ufasta sort -C 5 -n $TEST1 | ufasta sizes -H /dev/fd/0) 20 | SIZES_SORT=$(ufasta sizes -H $TEST1 | sort -n -k1.5,1.10) 21 | EXPECT_EQ "$SIZES_SORT" "$SORT_SIZES" "Sorted numeric sizes" 22 | 23 | SORT_SORT=$(cat $TEST1 | ufasta sort -C 5 -n /dev/fd/0 | sort) 24 | SORT_ONCE=$(sort $TEST1) 25 | EXPECT_EQ "$SORT_ONCE" "$SORT_SORT" "Sorted numeric content" 26 | 27 | SORT_SORT=$(echo -e ">1 2\n>1 1" | ufasta sort /dev/fd/0) 28 | EXPECT_EQ "$(echo -e ">1 2\n>1 1")" "$SORT_SORT" "Sort first word" 29 | SORT_SORT=$(echo -e ">1 2\n>1 1" | ufasta sort -H /dev/fd/0) 30 | EXPECT_EQ "$(echo -e ">1 1\n>1 2")" "$SORT_SORT" "Sort full header line" 31 | 32 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/ufasta/tests/test_split.sh: -------------------------------------------------------------------------------- 1 | 2 | trap "rm -f split1 split2" EXIT 3 | ufasta split -i $TEST1 >(cat > split1) >(cat > split2) 4 | diff <(cat split1 split2 | ufasta sort) <(ufasta sort $TEST1) 5 | EXPECT_SUCCESS "Split join" 6 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/ufasta/tests/test_tail.sh: -------------------------------------------------------------------------------- 1 | 2 | x=$(ufasta tail -n +1 $TEST1 | grep -c '^>') 3 | EXPECT_EQ "50" $x "Output all 1" 4 | x=$(ufasta tail -n 50 $TEST1 | grep -c '^>') 5 | EXPECT_EQ "50" $x "Output all 2" 6 | 7 | x=$(ufasta tail -n +2 $TEST1 | grep -c '^>') 8 | EXPECT_EQ "49" $x "Output all but first 1" 9 | x=$(ufasta tail -n 49 $TEST1 | grep -c '^>') 10 | EXPECT_EQ "49" $x "Output all but first 2" 11 | 12 | x=$(ufasta tail -n +49 $TEST1 | wc -l) 13 | eh=$(tail -n $x $TEST1 | head -n 1) 14 | EXPECT_EQ ">read48" "$eh" "Output last two headers" 15 | x2=$(ufasta tail -n 2 $TEST1 | wc -l) 16 | EXPECT_EQ $x $x2 "Complementary tail" 17 | 18 | el=$(tail -n $x $TEST1) 19 | l=$(ufasta tail -n +49 $TEST1) 20 | EXPECT_EQ "$el" "$l" "Output last two entries 1" 21 | l=$(ufasta tail -n 2 $TEST1) 22 | EXPECT_EQ "$el" "$l" "Output last two entries 2" 23 | 24 | l=$(ufasta tail -c +0 $TEST1) 25 | EXPECT_EQ "$(cat $TEST1)" "$l" "-c +0" 26 | 27 | test1_len=$(wc -c < $TEST1) 28 | for i in $(seq 1 53 $(wc -c < $TEST1)); do 29 | l=$(ufasta tail -c +$i $TEST1 | wc -c) 30 | EXPECT_GE $((test1_len - i)) $l "-c +$i" 31 | 32 | l=$(ufasta head -c $i $TEST1; ufasta tail -c +$i $TEST1) 33 | EXPECT_EQ "$(cat $TEST1)" "$l" "tail + head -c +$i" 34 | done 35 | -------------------------------------------------------------------------------- /SuperReads_RNA/global-1/ufasta/tests/testsh.in: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | SRCDIR=@SRCDIR@ 4 | BUILDDIR=@BUILDDIR@ 5 | 6 | success() { 7 | echo "[ OK ] $1" 8 | true 9 | } 10 | 11 | fail() { 12 | echo "[FAIL] $1" 13 | false 14 | } 15 | 16 | EXPECT_EQ() { 17 | test "$1" = "$2" && success "$3" || fail "$3. Expected '$1' got '$2'" 18 | } 19 | 20 | EXPECT_NE() { 21 | test "$1" != "$2" && success "$3" || fail "$3. Expected '$1' got '$2'" 22 | } 23 | 24 | EXPECT_GT() { 25 | test "$1" -gt "$2" && success "$3" || fail "$3. Expected '$1' > '$2'" 26 | } 27 | 28 | EXPECT_GE() { 29 | test "$1" -ge "$2" && success "$3" || fail "$3. Expected '$1' >= '$2'" 30 | } 31 | 32 | EXPECT_LT() { 33 | test "$1" -lt "$2" && success "$3" || fail "$3. Expected '$1' < '$2'" 34 | } 35 | 36 | EXPECT_LE() { 37 | test "$1" -le "$2" && success "$3" || fail "$3. Expected '$1' <= '$2'" 38 | } 39 | 40 | 41 | EXPECT_SUCCESS() { 42 | test "$?" = "0" && success "$1" || fail "$1" 43 | } 44 | 45 | set +o | grep pipefail > /dev/null && set -o pipefail 46 | set -o errexit 47 | 48 | TEST1=$SRCDIR/tests/test1.fasta 49 | PATH=$BUILDIR:$PATH 50 | LANG=C # For sorting 51 | 52 | echo -n "pwd: "; pwd 53 | echo -n "ufasta: "; which ufasta 54 | echo "script: $1" 55 | 56 | source "$1" 57 | -------------------------------------------------------------------------------- /SuperReads_RNA/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -xe 4 | 5 | ROOT=`pwd` 6 | [ -z "$DEST" ] && DEST="$ROOT" 7 | 8 | ################### 9 | # Check for gmake # 10 | ################### 11 | mkdir -p dist-bin 12 | PATH=$PATH:$ROOT/dist-bin 13 | ln -sf $(which make) $ROOT/dist-bin/gmake 14 | ln -sf $ROOT/PkgConfig.pm $ROOT/dist-bin/pkg-config 15 | 16 | export NUM_THREADS=`grep -c '^processor' /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 1`; 17 | BINDIR=$DEST/bin 18 | LIBDIR=$DEST/lib 19 | export PKG_CONFIG_PATH=$LIBDIR/pkgconfig:$PKG_CONFIG_PATH 20 | (cd global-1 && autoreconf -f -i && \ 21 | ./configure --prefix=$DEST --bindir=$BINDIR --libdir=$LIBDIR && make -j $NUM_THREADS install-special) 22 | 23 | echo "creating sr_config_example.txt with correct PATHS" 24 | $BINDIR/createSuperReads_RNA -g sr_config_example.txt 25 | -------------------------------------------------------------------------------- /gclib/GFastaIndex.h: -------------------------------------------------------------------------------- 1 | /* 2 | * GFaIdx.h 3 | * 4 | * Created on: Aug 25, 2010 5 | * Author: gpertea 6 | */ 7 | 8 | #ifndef GFAIDX_H_ 9 | #define GFAIDX_H_ 10 | 11 | #include "GHash.hh" 12 | #include "GList.hh" 13 | 14 | class GFastaRec { 15 | public: 16 | char* seqname; 17 | uint seqlen; 18 | off_t fpos; 19 | int line_len; //effective line length (without EoL) 20 | int line_blen; //length of line including EoL characters 21 | GFastaRec(uint slen=0, off_t fp=0, int llen=0, int llenb=0) { 22 | seqname=NULL; //only a pointer copy 23 | seqlen=slen; 24 | fpos=fp; 25 | line_len=llen; 26 | line_blen=llenb; 27 | } 28 | bool operator==(GFastaRec& d){ 29 | return (fpos==d.fpos); 30 | } 31 | bool operator>(GFastaRec& d){ 32 | return (fpos>d.fpos); 33 | } 34 | bool operator<(GFastaRec& d){ 35 | return (fpos records; 46 | void addRecord(const char* seqname, uint seqlen, 47 | off_t foffs, int llen, int llen_full); 48 | 49 | GFastaRec* getRecord(const char* seqname) { 50 | return records.Find(seqname); 51 | } 52 | bool hasIndex() { return haveFai; } 53 | int loadIndex(const char* finame); 54 | int buildIndex(); //build index in memory by parsing the whole fasta file 55 | int storeIndex(const char* finame); 56 | int storeIndex(FILE* fai); 57 | int getCount() { return records.Count(); } 58 | GFastaIndex(const char* fname, const char* finame=NULL):records() { 59 | if (fileExists(fname)!=2) GError("Error: fasta file %s not found!\n",fname); 60 | if (fileSize(fname)<=0) GError("Error: invalid fasta file %s !\n",fname); 61 | fa_name=Gstrdup(fname); 62 | fai_name=finame!=NULL ? Gstrdup(finame) : NULL; 63 | if (fileSize(fa_name)==0) { 64 | GError("Error creating GFastaIndex(%s): invalid fasta file!\n",fa_name); 65 | } 66 | haveFai=false; 67 | if (fai_name!=NULL && fileSize(fai_name)>0) { 68 | //try to load the index file if it exists 69 | loadIndex(fai_name); 70 | haveFai=(records.Count()>0); 71 | } 72 | } 73 | ~GFastaIndex() { 74 | GFREE(fa_name); 75 | GFREE(fai_name); 76 | } 77 | }; 78 | 79 | #endif /* GFAIDX_H_ */ 80 | -------------------------------------------------------------------------------- /gclib/codons.h: -------------------------------------------------------------------------------- 1 | #ifndef CODONS_H 2 | #define CODONS_H 3 | #include "GBase.h" 4 | #include 5 | 6 | unsigned short packCodon(char n1, char n2, char n3); 7 | //assumes n1,n2,n3 are UPPERCASE! 8 | 9 | struct Codon { 10 | char nuc[3]; 11 | Codon(char* str=NULL) { 12 | if (str==NULL) { 13 | nuc[0]='N'; 14 | nuc[1]='N'; 15 | nuc[2]='N'; 16 | } 17 | else { 18 | nuc[0]=toupper(str[0]); 19 | nuc[1]=toupper(str[1]); 20 | nuc[2]=toupper(str[2]); 21 | } 22 | } 23 | 24 | Codon(char s1, char s2, char s3) { 25 | nuc[0]=toupper(s1); 26 | nuc[1]=toupper(s2); 27 | nuc[2]=toupper(s3); 28 | } 29 | 30 | 31 | char& operator[](int idx) { 32 | if (idx<0 || idx>2) 33 | GError("Error: Codon index out of bounds!\n"); 34 | return nuc[idx]; 35 | } 36 | 37 | char operator[](int idx) const { 38 | if (idx<0 || idx>2) 39 | GError("Error: Codon index out of bounds!\n"); 40 | return nuc[idx]; 41 | } 42 | 43 | char translate(); 44 | }; 45 | 46 | //simple 1st frame forward translation of a given DNA string 47 | //will allocated memory for the translation -- the caller is 48 | // responsible for freeing the returned string! 49 | char* translateDNA(const char* dnastr, int& aalen, int dnalen=0); 50 | 51 | char translateCodon(const char* dna); //returns the aminoacid code for the 1st codon at dna 52 | 53 | bool codonTableInit(); 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /gclib/gdna.cpp: -------------------------------------------------------------------------------- 1 | #include "gdna.h" 2 | #include 3 | 4 | const char* IUPAC_2BIT ="AACCTTGGTTAAAAAACCCCGGAAAAAACCAAAAAA"; 5 | const char* IUPAC_2BITN ="001133223300000011112200000011000000"; 6 | const char* IUPAC_DEFS ="AaCcTtGgUuMmRrWwSsYyKkVvHhDdBbNnXx-*"; 7 | const char* IUPAC_COMP ="TtGgAaCcAaKkYyWwSsRrMmBbDdHhVvNnXx-*"; 8 | 9 | #define A_2BIT 0 // 00 10 | #define C_2BIT 1 // 01 11 | #define G_2BIT 2 // 10 12 | #define T_2BIT 3 // 11 13 | 14 | static byte ntCompTable[256]; 15 | static byte nt2bit[256]; //maps any character to a 2bit base value (with N = A) 16 | static char v_2bit2nt[4] = {'A','C','G','T'}; 17 | 18 | //---------------------- 19 | 20 | static bool gdna_Ready=gDnaInit(); 21 | 22 | //---------------------- 23 | 24 | byte gdna2bit(char* &nt, int n) { 25 | // Pack n bases into a byte (n can be 1..4) 26 | byte out = 0; 27 | while (n && *nt) { 28 | n--; 29 | out <<= 2; 30 | out += nt2bit[(int)*nt]; 31 | nt++; 32 | } 33 | #ifdef GDEBUG 34 | if (n) { 35 | GError("Error: attempt to read 6-mer beyond the end of the string!\n"); 36 | } 37 | #endif 38 | return out; 39 | } 40 | 41 | 42 | char ntComplement(char c) { 43 | return ntCompTable[(int)c]; 44 | } 45 | 46 | char g2bit2base(byte v2bit) { 47 | return v_2bit2nt[v2bit & 0x03 ]; 48 | } 49 | 50 | //in place reverse complement of nucleotide (sub)sequence 51 | char* reverseComplement(char* seq, int slen) { 52 | if (slen==0) slen=strlen(seq); 53 | //reverseChars(seq,len); 54 | int l=0; 55 | int r=slen-1; 56 | char c; 57 | while (l 4 | // a Linux-specific way to report the memory usage of the current process 5 | void get_mem_usage(double& vm_usage, double& resident_set); 6 | 7 | void print_mem_usage(FILE* fout=stderr); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /prep_linux.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ver=$(fgrep '#define VERSION ' stringtie.cpp) 3 | ver=${ver#*\"} 4 | ver=${ver%%\"*} 5 | srcpack=stringtie-$ver 6 | source prep_source.sh 7 | linpack=$srcpack.Linux_x86_64 8 | echo "preparing $linpack.tar.gz" 9 | echo "-------------------" 10 | /bin/rm -rf $linpack 11 | /bin/rm -f $linpack.tar.gz 12 | mkdir $linpack 13 | cd $srcpack 14 | make cleanall 15 | make static 16 | cp LICENSE README stringtie ../$linpack/ 17 | cd .. 18 | tar cvfz $linpack.tar.gz $linpack 19 | ls -l $linpack.tar.gz 20 | echo "scp $linpack.tar.gz $srcpack.tar.gz salz:~/html/software/stringtie/dl/" 21 | echo "If you're on salzN machines you can also update the release# links:" 22 | echo "perl -i -pe 's/stringtie\-\d\.\d+\.\d+\w?\./stringtie-$ver./g' ~/html/software/stringtie/home.shtml" 23 | -------------------------------------------------------------------------------- /prep_mac.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ver=$(fgrep '#define VERSION ' stringtie.cpp) 3 | ver=${ver#*\"} 4 | ver=${ver%%\"*} 5 | pack=stringtie-$ver 6 | macpack=$pack.OSX_x86_64 7 | echo "preparing $macpack.tar.gz" 8 | echo "-------------------" 9 | /bin/rm -rf $macpack 10 | /bin/rm -f $macpack.tar.gz 11 | mkdir $macpack 12 | make clean 13 | make release 14 | cp -p LICENSE README stringtie $macpack/ 15 | tar cvfz $macpack.tar.gz $macpack 16 | ls -l $macpack.tar.gz 17 | #echo "If you're on igmN machines you can also update the web files:" 18 | echo "scp $macpack.tar.gz salz:~/html/software/stringtie/dl/" 19 | #echo "perl -i -pe 's/stringtie-[0123]\.\d+\./stringtie-$ver./g' ~/html/software/stringtie/index.shtml" 20 | -------------------------------------------------------------------------------- /prep_source.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ver=$(fgrep '#define VERSION ' stringtie.cpp) 3 | ver=${ver#*\"} 4 | ver=${ver%%\"*} 5 | pack=stringtie-$ver 6 | echo "preparing $pack.tar.gz" 7 | echo "-------------------" 8 | /bin/rm -rf $pack 9 | /bin/rm -f $pack.tar.gz 10 | mkdir $pack 11 | mkdir $pack/gclib 12 | cd samtools-0.1.18 13 | make clean 14 | cd .. 15 | libdir=stringtie-$ver/gclib/ 16 | cp Makefile LICENSE README stringtie.cpp {rlink,tablemaker,tmerge}.{h,cpp} $pack/ 17 | #sed 's|\.\./gclib|./gclib|' Makefile > $pack/Makefile 18 | cp -r samtools-0.1.18 $pack/ 19 | /bin/rm -rf $pack/samtools-0.1.18/.svn 20 | cp ./gclib/{GVec,GList,GHash,GIntHash}.hh $libdir 21 | cp ./gclib/GBitVec.h $libdir 22 | cp ./gclib/{GArgs,GBam,GBase,gdna,GStr,gff,codons,GFaSeqGet,GFastaIndex,proc_mem,GThreads}.{h,cpp} $libdir 23 | tar cvfz $pack.tar.gz $pack 24 | ls -l $pack.tar.gz 25 | #scp $pack.tar.gz igm3:~/src/ 26 | -------------------------------------------------------------------------------- /samtools-0.1.18/AUTHORS: -------------------------------------------------------------------------------- 1 | Heng Li from the Sanger Institute wrote most of the initial source codes 2 | of SAMtools and various converters. 3 | 4 | Bob Handsaker from the Broad Institute is a major contributor to the 5 | SAM/BAM specification. He designed and implemented the BGZF format, the 6 | underlying indexable compression format for the BAM format. BGZF does 7 | not support arithmetic between file offsets. 8 | 9 | Jue Ruan for the Beijing Genome Institute designed and implemented the 10 | RAZF format, an alternative indexable compression format. RAZF supports 11 | arithmetic between file offsets, at the cost of increased index file 12 | size and the full compatibility with gzip. RAZF is optional and only 13 | used in `faidx' for indexing RAZF compressed fasta files. 14 | 15 | Colin Hercus updated novo2sam.pl to support gapped alignment by 16 | novoalign. 17 | 18 | Petr Danecek contributed the header parsing library sam_header.c and 19 | sam2vcf.pl script and added knet support to the RAZF library. 20 | 21 | -------------------------------------------------------------------------------- /samtools-0.1.18/COPYING: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2008-2009 Genome Research Ltd. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /samtools-0.1.18/INSTALL: -------------------------------------------------------------------------------- 1 | System Requirements 2 | =================== 3 | 4 | SAMtools depends on the zlib library . Version 1.2.3+ is 5 | preferred and with 1.2.3+ you can compile razip and use it to compress a FASTA 6 | file. SAMtools' faidx is able to index a razip-compressed FASTA file to save 7 | diskspace. Older zlib also works with SAMtools, but razip cannot be compiled. 8 | 9 | The text-based viewer (tview) requires the GNU ncurses library 10 | , which comes with Mac OS X and most of 11 | the modern Linux/Unix distributions. If you do not have this library installed, 12 | you can still compile the rest of SAMtools by manually changing: 13 | `-D_CURSES_LIB=1' to `-D_CURSES_LIB=0' at the line starting with `DFLAGS=', and 14 | comment out the line starting with `LIBCURSES='. 15 | 16 | 17 | Compilation 18 | =========== 19 | 20 | Type `make' to compile samtools. If you have zlib >= 1.2.2.1, you can compile 21 | razip with `make razip'. 22 | 23 | 24 | Installation 25 | ============ 26 | 27 | Copy `samtools', `bcftools/bcftools' and other executables/scripts in `misc' to 28 | a location you want (e.g. a directory in your $PATH). You may also copy 29 | `samtools.1' and `bcftools/bcftools.1' to a directory in your $MANPATH such 30 | that the `man' command may find the manual. 31 | -------------------------------------------------------------------------------- /samtools-0.1.18/bam2bcf.h: -------------------------------------------------------------------------------- 1 | #ifndef BAM2BCF_H 2 | #define BAM2BCF_H 3 | 4 | #include 5 | #include "errmod.h" 6 | #include "bcftools/bcf.h" 7 | 8 | #define B2B_INDEL_NULL 10000 9 | 10 | typedef struct __bcf_callaux_t { 11 | int capQ, min_baseQ; 12 | int openQ, extQ, tandemQ; // for indels 13 | int min_support; // for collecting indel candidates 14 | double min_frac; // for collecting indel candidates 15 | // for internal uses 16 | int max_bases; 17 | int indel_types[4]; 18 | int maxins, indelreg; 19 | char *inscns; 20 | uint16_t *bases; 21 | errmod_t *e; 22 | void *rghash; 23 | } bcf_callaux_t; 24 | 25 | typedef struct { 26 | int depth, ori_depth, qsum[4]; 27 | int anno[16]; 28 | float p[25]; 29 | int mvd[3]; // mean variant distance, number of variant reads, average read length 30 | } bcf_callret1_t; 31 | 32 | typedef struct { 33 | int a[5]; // alleles: ref, alt, alt2, alt3 34 | int n, n_alleles, shift, ori_ref, unseen; 35 | int anno[16], depth, ori_depth; 36 | uint8_t *PL; 37 | float vdb; // variant distance bias 38 | } bcf_call_t; 39 | 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | bcf_callaux_t *bcf_call_init(double theta, int min_baseQ); 45 | void bcf_call_destroy(bcf_callaux_t *bca); 46 | int bcf_call_glfgen(int _n, const bam_pileup1_t *pl, int ref_base, bcf_callaux_t *bca, bcf_callret1_t *r); 47 | int bcf_call_combine(int n, const bcf_callret1_t *calls, int ref_base /*4-bit*/, bcf_call_t *call); 48 | int bcf_call2bcf(int tid, int pos, bcf_call_t *bc, bcf1_t *b, bcf_callret1_t *bcr, int is_SP, 49 | const bcf_callaux_t *bca, const char *ref); 50 | int bcf_call_gap_prep(int n, int *n_plp, bam_pileup1_t **plp, int pos, bcf_callaux_t *bca, const char *ref, 51 | const void *rghash); 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /samtools-0.1.18/bam_endian.h: -------------------------------------------------------------------------------- 1 | #ifndef BAM_ENDIAN_H 2 | #define BAM_ENDIAN_H 3 | 4 | #include 5 | 6 | static inline int bam_is_big_endian() 7 | { 8 | long one= 1; 9 | return !(*((char *)(&one))); 10 | } 11 | static inline uint16_t bam_swap_endian_2(uint16_t v) 12 | { 13 | return (uint16_t)(((v & 0x00FF00FFU) << 8) | ((v & 0xFF00FF00U) >> 8)); 14 | } 15 | static inline void *bam_swap_endian_2p(void *x) 16 | { 17 | *(uint16_t*)x = bam_swap_endian_2(*(uint16_t*)x); 18 | return x; 19 | } 20 | static inline uint32_t bam_swap_endian_4(uint32_t v) 21 | { 22 | v = ((v & 0x0000FFFFU) << 16) | (v >> 16); 23 | return ((v & 0x00FF00FFU) << 8) | ((v & 0xFF00FF00U) >> 8); 24 | } 25 | static inline void *bam_swap_endian_4p(void *x) 26 | { 27 | *(uint32_t*)x = bam_swap_endian_4(*(uint32_t*)x); 28 | return x; 29 | } 30 | static inline uint64_t bam_swap_endian_8(uint64_t v) 31 | { 32 | v = ((v & 0x00000000FFFFFFFFLLU) << 32) | (v >> 32); 33 | v = ((v & 0x0000FFFF0000FFFFLLU) << 16) | ((v & 0xFFFF0000FFFF0000LLU) >> 16); 34 | return ((v & 0x00FF00FF00FF00FFLLU) << 8) | ((v & 0xFF00FF00FF00FF00LLU) >> 8); 35 | } 36 | static inline void *bam_swap_endian_8p(void *x) 37 | { 38 | *(uint64_t*)x = bam_swap_endian_8(*(uint64_t*)x); 39 | return x; 40 | } 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /samtools-0.1.18/bam_reheader.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "bgzf.h" 4 | #include "bam.h" 5 | 6 | #define BUF_SIZE 0x10000 7 | 8 | int bam_reheader(BGZF *in, const bam_header_t *h, int fd) 9 | { 10 | BGZF *fp; 11 | bam_header_t *old; 12 | int len; 13 | uint8_t *buf; 14 | if (in->open_mode != 'r') return -1; 15 | buf = malloc(BUF_SIZE); 16 | old = bam_header_read(in); 17 | fp = bgzf_fdopen(fd, "w"); 18 | bam_header_write(fp, h); 19 | if (in->block_offset < in->block_length) { 20 | bgzf_write(fp, in->uncompressed_block + in->block_offset, in->block_length - in->block_offset); 21 | bgzf_flush(fp); 22 | } 23 | #ifdef _USE_KNETFILE 24 | while ((len = knet_read(in->x.fpr, buf, BUF_SIZE)) > 0) 25 | fwrite(buf, 1, len, fp->x.fpw); 26 | #else 27 | while (!feof(in->file) && (len = fread(buf, 1, BUF_SIZE, in->file)) > 0) 28 | fwrite(buf, 1, len, fp->file); 29 | #endif 30 | free(buf); 31 | fp->block_offset = in->block_offset = 0; 32 | bgzf_close(fp); 33 | return 0; 34 | } 35 | 36 | int main_reheader(int argc, char *argv[]) 37 | { 38 | bam_header_t *h; 39 | BGZF *in; 40 | if (argc != 3) { 41 | fprintf(stderr, "Usage: samtools reheader \n"); 42 | return 1; 43 | } 44 | { // read the header 45 | tamFile fph = sam_open(argv[1]); 46 | if (fph == 0) { 47 | fprintf(stderr, "[%s] fail to read the header from %s.\n", __func__, argv[1]); 48 | return 1; 49 | } 50 | h = sam_header_read(fph); 51 | sam_close(fph); 52 | } 53 | in = strcmp(argv[2], "-")? bam_open(argv[2], "r") : bam_dopen(fileno(stdin), "r"); 54 | if (in == 0) { 55 | fprintf(stderr, "[%s] fail to open file %s.\n", __func__, argv[2]); 56 | return 1; 57 | } 58 | bam_reheader(in, h, fileno(stdout)); 59 | bgzf_close(in); 60 | return 0; 61 | } 62 | -------------------------------------------------------------------------------- /samtools-0.1.18/errmod.h: -------------------------------------------------------------------------------- 1 | #ifndef ERRMOD_H 2 | #define ERRMOD_H 3 | 4 | #include 5 | 6 | struct __errmod_coef_t; 7 | 8 | typedef struct { 9 | double depcorr; 10 | struct __errmod_coef_t *coef; 11 | } errmod_t; 12 | 13 | errmod_t *errmod_init(float depcorr); 14 | void errmod_destroy(errmod_t *em); 15 | 16 | /* 17 | n: number of bases 18 | m: maximum base 19 | bases[i]: qual:6, strand:1, base:4 20 | q[i*m+j]: phred-scaled likelihood of (i,j) 21 | */ 22 | int errmod_cal(const errmod_t *em, int n, int m, uint16_t *bases, float *q); 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /samtools-0.1.18/kaln.h: -------------------------------------------------------------------------------- 1 | /* The MIT License 2 | 3 | Copyright (c) 2003-2006, 2008, 2009 by Heng Li 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 20 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 21 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | */ 25 | 26 | #ifndef LH3_KALN_H_ 27 | #define LH3_KALN_H_ 28 | 29 | #include 30 | 31 | #define MINOR_INF -1073741823 32 | 33 | typedef struct { 34 | int gap_open; 35 | int gap_ext; 36 | int gap_end_open; 37 | int gap_end_ext; 38 | 39 | int *matrix; 40 | int row; 41 | int band_width; 42 | } ka_param_t; 43 | 44 | typedef struct { 45 | int iio, iie, ido, ide; 46 | int eio, eie, edo, ede; 47 | int *matrix; 48 | int row; 49 | int band_width; 50 | } ka_param2_t; 51 | 52 | #ifdef __cplusplus 53 | extern "C" { 54 | #endif 55 | 56 | uint32_t *ka_global_core(uint8_t *seq1, int len1, uint8_t *seq2, int len2, const ka_param_t *ap, 57 | int *_score, int *n_cigar); 58 | int ka_global_score(const uint8_t *_seq1, int len1, const uint8_t *_seq2, int len2, const ka_param2_t *ap); 59 | #ifdef __cplusplus 60 | } 61 | #endif 62 | 63 | extern ka_param_t ka_param_blast; /* = { 5, 2, 5, 2, aln_sm_blast, 5, 50 }; */ 64 | extern ka_param_t ka_param_qual; // only use this for global alignment!!! 65 | extern ka_param2_t ka_param2_qual; // only use this for global alignment!!! 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /samtools-0.1.18/knetfile.h: -------------------------------------------------------------------------------- 1 | #ifndef KNETFILE_H 2 | #define KNETFILE_H 3 | 4 | #include 5 | #include 6 | 7 | #ifndef _WIN32 8 | #define netread(fd, ptr, len) read(fd, ptr, len) 9 | #define netwrite(fd, ptr, len) write(fd, ptr, len) 10 | #define netclose(fd) close(fd) 11 | #else 12 | #include 13 | #define netread(fd, ptr, len) recv(fd, ptr, len, 0) 14 | #define netwrite(fd, ptr, len) send(fd, ptr, len, 0) 15 | #define netclose(fd) closesocket(fd) 16 | #endif 17 | 18 | // FIXME: currently I/O is unbuffered 19 | 20 | #define KNF_TYPE_LOCAL 1 21 | #define KNF_TYPE_FTP 2 22 | #define KNF_TYPE_HTTP 3 23 | 24 | typedef struct knetFile_s { 25 | int type, fd; 26 | int64_t offset; 27 | char *host, *port; 28 | 29 | // the following are for FTP only 30 | int ctrl_fd, pasv_ip[4], pasv_port, max_response, no_reconnect, is_ready; 31 | char *response, *retr, *size_cmd; 32 | int64_t seek_offset; // for lazy seek 33 | int64_t file_size; 34 | 35 | // the following are for HTTP only 36 | char *path, *http_host; 37 | } knetFile; 38 | 39 | #define knet_tell(fp) ((fp)->offset) 40 | #define knet_fileno(fp) ((fp)->fd) 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | #ifdef _WIN32 47 | int knet_win32_init(); 48 | void knet_win32_destroy(); 49 | #endif 50 | 51 | knetFile *knet_open(const char *fn, const char *mode); 52 | 53 | /* 54 | This only works with local files. 55 | */ 56 | knetFile *knet_dopen(int fd, const char *mode); 57 | 58 | /* 59 | If ->is_ready==0, this routine updates ->fd; otherwise, it simply 60 | reads from ->fd. 61 | */ 62 | off_t knet_read(knetFile *fp, void *buf, off_t len); 63 | 64 | /* 65 | This routine only sets ->offset and ->is_ready=0. It does not 66 | communicate with the FTP server. 67 | */ 68 | off_t knet_seek(knetFile *fp, int64_t off, int whence); 69 | int knet_close(knetFile *fp); 70 | 71 | #ifdef __cplusplus 72 | } 73 | #endif 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /samtools-0.1.18/kprobaln.h: -------------------------------------------------------------------------------- 1 | /* The MIT License 2 | 3 | Copyright (c) 2003-2006, 2008, 2009 by Heng Li 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 20 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 21 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | */ 25 | 26 | #ifndef LH3_KPROBALN_H_ 27 | #define LH3_KPROBALN_H_ 28 | 29 | #include 30 | 31 | typedef struct { 32 | float d, e; 33 | int bw; 34 | } kpa_par_t; 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | int kpa_glocal(const uint8_t *_ref, int l_ref, const uint8_t *_query, int l_query, const uint8_t *iqual, 41 | const kpa_par_t *c, int *state, uint8_t *q); 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | extern kpa_par_t kpa_par_def, kpa_par_alt; 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /samtools-0.1.18/sam_header.h: -------------------------------------------------------------------------------- 1 | #ifndef __SAM_HEADER_H__ 2 | #define __SAM_HEADER_H__ 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | void *sam_header_parse2(const char *headerText); 9 | void *sam_header_merge(int n, const void **dicts); 10 | void sam_header_free(void *header); 11 | char *sam_header_write(const void *headerDict); // returns a newly allocated string 12 | 13 | char **sam_header2list(const void *_dict, char type[2], char key_tag[2], int *_n); 14 | 15 | void *sam_header2tbl(const void *dict, char type[2], char key_tag[2], char value_tag[2]); 16 | const char *sam_tbl_get(void *h, const char *key); 17 | int sam_tbl_size(void *h); 18 | void sam_tbl_destroy(void *h); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /samtools-0.1.18/sample.h: -------------------------------------------------------------------------------- 1 | #ifndef BAM_SAMPLE_H 2 | #define BAM_SAMPLE_H 3 | 4 | #include "kstring.h" 5 | 6 | typedef struct { 7 | int n, m; 8 | char **smpl; 9 | void *rg2smid, *sm2id; 10 | } bam_sample_t; 11 | 12 | bam_sample_t *bam_smpl_init(void); 13 | int bam_smpl_add(bam_sample_t *sm, const char *abs, const char *txt); 14 | int bam_smpl_rg2smid(const bam_sample_t *sm, const char *fn, const char *rg, kstring_t *str); 15 | void bam_smpl_destroy(bam_sample_t *sm); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /tag_git.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ver=$(fgrep '#define VERSION ' stringtie.cpp) 3 | ver=${ver#*\"} 4 | ver=${ver%%\"*} 5 | git checkout master 6 | git tag -a "v$ver" -m "release $ver" 7 | git push --tags 8 | -------------------------------------------------------------------------------- /tmerge.h: -------------------------------------------------------------------------------- 1 | #ifndef STRINGTIE_MERGE_H_ 2 | #define STRINGTIE_MERGE_H_ 3 | #include "GStr.h" 4 | #include "GList.hh" 5 | #include "rlink.h" 6 | extern GStr tmp_path; 7 | extern bool keepTempFiles; 8 | /*struct TInFile { 9 | GStr fpath; 10 | int ftype; //0=bam file, 1=GTF transfrags 11 | TInFile(const char* fn=NULL,int ft=0):fpath(fn),ftype(ft) { } 12 | }*/ 13 | struct TInputRecord { 14 | GBamRecord* brec; 15 | int fidx; //index in files and readers 16 | bool operator<(TInputRecord& o) { 17 | //decreasing location sort 18 | GBamRecord& r1=*brec; 19 | GBamRecord& r2=*(o.brec); 20 | int refcmp=strcmp(r1.refName(),r2.refName()); 21 | if (refcmp==0) { 22 | //higher coords first 23 | if (r1.start!=r2.start) 24 | return (r1.start>r2.start); 25 | else { 26 | if (r1.end!=r2.end) 27 | return (r1.end>r2.end); 28 | else if (fidx==o.fidx) 29 | return (strcmp(r1.name(), r2.name())>0); 30 | else return fidx>o.fidx; 31 | } 32 | } 33 | else { //use lexicographic order of ref seqs 34 | return (refcmp>0); 35 | } 36 | } 37 | bool operator==(TInputRecord& o) { 38 | GBamRecord& r1=*brec; 39 | GBamRecord& r2=*(o.brec); 40 | return ( strcmp(r1.refName(),r2.refName())==0 && r1.start==r2.start && r1.end==r2.end 41 | && fidx==o.fidx && strcmp(r1.name(),r2.name())==0); 42 | } 43 | 44 | TInputRecord(GBamRecord* b=NULL, int i=0):brec(b),fidx(i) {} 45 | ~TInputRecord() { 46 | delete brec; 47 | } 48 | }; 49 | 50 | struct TInputFiles { 51 | protected: 52 | TInputRecord* crec; 53 | GStr convert2BAM(GStr& gtf, int idx); 54 | public: 55 | GPVec readers; 56 | GVec files; //same order 57 | GVec tmpfiles; //all the temp files created by this 58 | GList recs; //next record for each 59 | TInputFiles():crec(NULL), readers(true), files(), tmpfiles(), 60 | recs(true, true, true) { } 61 | void Add(const char* fn); 62 | int count() { return files.Count(); } 63 | int start(); //open all files, load 1 record from each 64 | GBamRecord* next(); 65 | void stop(); // 66 | }; 67 | 68 | 69 | #endif /* STRINGTIE_MERGE_H_ */ 70 | --------------------------------------------------------------------------------