@@ -28,7 +28,8 @@ void ReadInput(const Arguments &args, std::vector<std::unique_ptr<Sample>> *samp
2828 if (!args.themisto_mode && !args.read_likelihood_mode ) {
2929 // Check that the number of reference sequences matches in the grouping and the alignment.
3030 reference->verify_kallisto_alignment (*args.infiles .run_info );
31- ReadKallisto (reference->get_n_refs (), *args.infiles .ec , *args.infiles .tsv , &samples->back ()->pseudos );
31+ samples->back ()->pseudos = telescope::KallistoAlignment (reference->get_n_refs ());
32+ telescope::read::Kallisto (*args.infiles .ec , *args.infiles .tsv , &samples->back ()->pseudos );
3233 } else if (!args.read_likelihood_mode ) {
3334 if (!args.themisto_index_path .empty ()) {
3435 try {
@@ -43,7 +44,8 @@ void ReadInput(const Arguments &args, std::vector<std::unique_ptr<Sample>> *samp
4344 cxxio::In forward_strand (args.tinfile1 );
4445 cxxio::In reverse_strand (args.tinfile2 );
4546 std::vector<std::istream*> strands = { &forward_strand.stream (), &reverse_strand.stream () };
46- ReadThemisto (get_mode (args.themisto_merge_mode ), reference->get_n_refs (), strands, &samples->back ()->pseudos );
47+ samples->back ()->pseudos = telescope::KallistoAlignment (reference->get_n_refs ());
48+ telescope::read::ThemistoToKallisto (telescope::get_mode (args.themisto_merge_mode ), strands, &samples->back ()->pseudos );
4749 } else {
4850 if (reference->get_n_groupings () > 1 ) {
4951 throw std::runtime_error (" Using more than one grouping with --read-likelihood is not yet implemented." );
@@ -63,8 +65,7 @@ void ConstructLikelihood(const Arguments &args, const Grouping &grouping, const
6365 }
6466 if (free_ec_counts) {
6567 // Free memory used by the configs after all likelihood matrices are built.
66- sample->pseudos .ec_configs .clear ();
67- sample->pseudos .ec_configs .shrink_to_fit ();
68+ sample->pseudos .clear_configs ();
6869 }
6970}
7071
@@ -98,24 +99,26 @@ void WriteResults(const Arguments &args, const std::unique_ptr<Sample> &sample,
9899 }
99100
100101 // Relative abundances
101- std::string abundances_outfile (outfile);
102- abundances_outfile = (args.outfile .empty () || !args.batch_mode ? abundances_outfile : abundances_outfile + ' /' + sample->cell_name ());
103- if (!args.outfile .empty ()) {
104- abundances_outfile += " _abundances.txt" ;
105- of.open (abundances_outfile);
106- }
107- if (args.bootstrap_mode ) {
108- BootstrapSample* bs = static_cast <BootstrapSample*>(&(*sample));
109- bs->write_bootstrap (grouping.get_names (), args.iters , (args.outfile .empty () ? std::cout : of.stream ()));
110- } else {
111- sample->write_abundances (grouping.get_names (), (args.outfile .empty () ? std::cout : of.stream ()));
102+ if (!args.optimizer .no_fit_model ) {
103+ std::string abundances_outfile (outfile);
104+ abundances_outfile = (args.outfile .empty () || !args.batch_mode ? abundances_outfile : abundances_outfile + ' /' + sample->cell_name ());
105+ if (!args.outfile .empty ()) {
106+ abundances_outfile += " _abundances.txt" ;
107+ of.open (abundances_outfile);
108+ }
109+ if (args.bootstrap_mode ) {
110+ BootstrapSample* bs = static_cast <BootstrapSample*>(&(*sample));
111+ bs->write_bootstrap (grouping.get_names (), args.iters , (args.outfile .empty () ? std::cout : of.stream ()));
112+ } else {
113+ sample->write_abundances (grouping.get_names (), (args.outfile .empty () ? std::cout : of.stream ()));
114+ }
112115 }
113116
114117 // Probability matrix
115- if (args.optimizer .print_probs ) {
118+ if (args.optimizer .print_probs && !args. optimizer . no_fit_model ) {
116119 sample->write_probabilities (grouping.get_names (), std::cout);
117120 }
118- if (args.optimizer .write_probs ) {
121+ if (args.optimizer .write_probs && !args. optimizer . no_fit_model ) {
119122 std::string probs_outfile (outfile);
120123 probs_outfile += " _probs.csv" ;
121124 if (args.optimizer .gzip_probs ) {
0 commit comments