@@ -25,7 +25,7 @@ use crate::nam::{Nam, get_nams_by_chaining, reverse_nam_if_needed};
2525use crate :: piecewisealigner:: remove_spurious_anchors;
2626use crate :: read:: Read ;
2727use crate :: revcomp:: reverse_complement;
28- use crate :: seeding:: { RandstrobeIterator , SeedingParameters , SyncmerIterator } ;
28+ use crate :: seeding:: SeedingParameters ;
2929
3030const MAX_PAIR_NAMS : usize = 1000 ;
3131
@@ -76,73 +76,6 @@ impl Alignment {
7676 }
7777}
7878
79- #[ derive( Debug ) ]
80- pub struct QueryRandstrobe {
81- pub hash : u64 ,
82- pub hash_revcomp : u64 ,
83- pub start : usize ,
84- pub end : usize ,
85- }
86-
87- /// Generate randstrobes for a query sequence and its reverse complement.
88- /// TODO move to strobes.rs?
89- pub fn randstrobes_query ( seq : & [ u8 ] , parameters : & SeedingParameters ) -> [ Vec < QueryRandstrobe > ; 2 ] {
90- let mut randstrobes = {
91- let expected = seq. len ( ) / ( parameters. syncmer . k - parameters. syncmer . s + 1 ) ;
92- [ Vec :: with_capacity ( expected) , Vec :: with_capacity ( expected) ]
93- } ;
94- if seq. len ( ) < parameters. randstrobe . w_max {
95- return randstrobes;
96- }
97-
98- // Generate syncmers for the forward sequence
99- let syncmer_iter = SyncmerIterator :: new (
100- seq,
101- parameters. syncmer . k ,
102- parameters. syncmer . s ,
103- parameters. syncmer . t ,
104- ) ;
105- let mut syncmers: Vec < _ > = syncmer_iter. collect ( ) ;
106-
107- // Generate randstrobes for the forward sequence
108- let randstrobe_iter =
109- RandstrobeIterator :: new ( syncmers. iter ( ) . cloned ( ) , parameters. randstrobe . clone ( ) ) ;
110-
111- for randstrobe in randstrobe_iter {
112- randstrobes[ 0 ] . push ( QueryRandstrobe {
113- hash : randstrobe. hash ,
114- hash_revcomp : randstrobe. hash_revcomp ,
115- start : randstrobe. strobe1_pos ,
116- end : randstrobe. strobe2_pos + parameters. syncmer . k ,
117- } ) ;
118- }
119-
120- // For the reverse complement, we can re-use the syncmers of the forward
121- // sequence because canonical syncmers are invariant under reverse
122- // complementing. Only the coordinates need to be adjusted.
123- syncmers. reverse ( ) ;
124- for i in 0 ..syncmers. len ( ) {
125- syncmers[ i] . position = seq. len ( ) - syncmers[ i] . position - parameters. syncmer . k ;
126- }
127-
128- // Randstrobes cannot be re-used for the reverse complement:
129- // If in the forward direction, syncmer[i] and syncmer[j] were paired up, it
130- // is not necessarily the case that syncmer[j] is going to be paired with
131- // syncmer[i] in the reverse direction because i is fixed in the forward
132- // direction and j is fixed in the reverse direction.
133- let rc_randstrobe_iter =
134- RandstrobeIterator :: new ( syncmers. into_iter ( ) , parameters. randstrobe . clone ( ) ) ;
135- for randstrobe in rc_randstrobe_iter {
136- randstrobes[ 1 ] . push ( QueryRandstrobe {
137- hash : randstrobe. hash ,
138- hash_revcomp : randstrobe. hash_revcomp ,
139- start : randstrobe. strobe1_pos ,
140- end : randstrobe. strobe2_pos + parameters. syncmer . k ,
141- } ) ;
142- }
143- randstrobes
144- }
145-
14679/// Conversion of an Alignment into a SamRecord
14780#[ derive( Default ) ]
14881pub struct SamOutput {
0 commit comments