@@ -752,7 +752,7 @@ where
752752 //collects the DNA sequence and translations on the correct strand
753753 if stra == -1 {
754754 if cod > 1 {
755- println ! ( "reverse strand coding start more than one {:?}" , & iterablecount) ;
755+ // println!("reverse strand coding start more than one {:?}", &iterablecount);
756756 if sto + 1 <= record. sequence . len ( ) {
757757 sliced_sequence = & record. sequence [ sta+cod..sto+1 ] ;
758758 }
@@ -770,7 +770,7 @@ where
770770 else {
771771 sliced_sequence = & record. sequence [ sta..sto] ;
772772 }
773- // println!("iterable count after is {:?}", &iterablecount);
773+ println ! ( "iterable count after is {:?}" , & iterablecount) ;
774774 }
775775 let cds_char = sliced_sequence;
776776 let prot_seq = translate ( & revcomp ( cds_char. as_bytes ( ) ) ) ;
@@ -789,7 +789,7 @@ where
789789 sliced_sequence = & record. sequence [ sta+cod-1 ..sto] ;
790790 }
791791 else {
792- // println!("forward strand codon value one cnt {:?}", &iterablecount);
792+ println ! ( "forward strand codon value one cnt {:?}" , & iterablecount) ;
793793 sliced_sequence = & record. sequence [ sta-1 ..sto] ;
794794 }
795795 let cds_char = sliced_sequence;
@@ -1575,8 +1575,7 @@ mod tests {
15751575 #[ allow( unused_assignments) ]
15761576 #[ allow( unused_imports) ]
15771577 fn test_read_file ( ) {
1578- println ! ( "in testing of read file" ) ;
1579- let content = std:: fs:: read_to_string ( "rhizexample.gbk" ) . expect ( "error reading file" ) ;
1578+ let content = std:: fs:: read_to_string ( "K12_ribo.gbk" ) . expect ( "error reading file" ) ;
15801579 assert ! ( content. contains( "LOCUS" ) ) ;
15811580 assert ! ( content. len( ) > 0 ) ;
15821581 }
@@ -1587,10 +1586,9 @@ mod tests {
15871586 #[ allow( unused_assignments) ]
15881587 #[ allow( unused_imports) ]
15891588 fn test_parse_gbk ( ) {
1590- let file_gbk = "rhizexample .gbk" ;
1589+ let file_gbk = "K12_ribo .gbk" ;
15911590 let records = genbank ! ( & file_gbk) ;
15921591 assert ! ( records. len( ) > 0 ) ;
1593- println ! ( "records len is {:?}" , & records. len( ) ) ;
15941592 }
15951593 #[ test]
15961594 #[ allow( unused_mut) ]
@@ -1599,10 +1597,13 @@ mod tests {
15991597 #[ allow( unused_assignments) ]
16001598 #[ allow( unused_imports) ]
16011599 fn test_parse_source_attributes ( ) {
1602- let file_gbk = "rhizexample .gbk" ;
1600+ let file_gbk = "K12_ribo .gbk" ;
16031601 let records = genbank ! ( & file_gbk) ;
1604- let record = records[ 0 ] . clone ( ) ;
1605- assert_eq ! ( record. id, "AM236082" ) ;
1602+ if let Some ( record) = records. first ( ) {
1603+ if let Some ( ( key, val) ) = record. source_map . source_attributes . first_key_value ( ) {
1604+ assert_eq ! ( key, & "source_NC_000913_1" . to_string( ) ) ;
1605+ }
1606+ }
16061607 }
16071608 #[ test]
16081609 #[ allow( unused_mut) ]
@@ -1611,11 +1612,14 @@ mod tests {
16111612 #[ allow( unused_assignments) ]
16121613 #[ allow( unused_imports) ]
16131614 fn test_parse_cds_attributes ( ) {
1614- let file_gbk = "rhizexample .gbk" ;
1615+ let file_gbk = "K12_ribo .gbk" ;
16151616 let records = genbank ! ( & file_gbk) ;
1616- let record = records[ 0 ] . clone ( ) ;
1617- assert_eq ! ( record. cds. locus_tag. clone( ) . unwrap( ) , "pRL80142" . to_string( ) ) ;
1618- //assert_eq!(record.cds.get_gene(&record.id).as_deref(), Some(&"trbBp8".to_string()));
1617+ if let Some ( record) = records. first ( ) {
1618+ if let Some ( ( locus_tag, vals) ) = record. cds . attributes . first_key_value ( ) {
1619+ assert_eq ! ( locus_tag, & "b3304" . to_string( ) ) ;
1620+ assert_eq ! ( record. cds. get_gene( & locus_tag) . as_deref( ) , Some ( & "rplR" . to_string( ) ) ) ;
1621+ }
1622+ }
16191623 }
16201624 #[ test]
16211625 #[ allow( unused_mut) ]
@@ -1624,11 +1628,14 @@ mod tests {
16241628 #[ allow( unused_assignments) ]
16251629 #[ allow( unused_imports) ]
16261630 fn test_parse_sequence_attributes ( ) {
1627- let file_gbk = "rhizexample .gbk" ;
1631+ let file_gbk = "K12_ribo .gbk" ;
16281632 let records = genbank ! ( & file_gbk) ;
1629- let record = records[ 0 ] . clone ( ) ;
1630- let loc_tag = & record. cds . locus_tag . clone ( ) . unwrap ( ) ;
1631- assert_eq ! ( record. seq_features. get_sequence_faa( & loc_tag) , Some ( & "MLQSHSRLVRKLQDALGEHLCIALEDPTVVEIMLNPDGKLFIERLGHGVAPAGEMQATAAETVIGSVAHALQSEADGERPIISGELPIGGHRFEGLLPPVVNSPTFTIRRRASRLIPLDDYVTAKIMTEAQASIIRSAITNRLNIVIAGGTGSGKTTLANAVIAEIVSSAPEDRMVILEDTSEIQCAAENAVCLHTSDAVDMARLLKSTMRLRPDRIIVGEVRDGAALTLLKAWNTGHPGGVTTIHSNSAMSALRRLEQLTSEASQQPMQAVIGEAVDLVISIERAGRGRRVREVLHVEGFNGSRYQTEHYPQIDEDSHAA" . to_string( ) ) ) ;
1633+ if let Some ( record) = records. first ( ) {
1634+ if let Some ( ( key, vals) ) = record. cds . attributes . first_key_value ( ) {
1635+ assert_eq ! ( key, & "b3304" . to_string( ) ) ;
1636+ assert_eq ! ( record. seq_features. get_sequence_faa( & key) , Some ( & "MDKKSARIRRATRARRKLQELGATRLVVHRTPRHIYAQVIAPNGSEVLVAASTVEKAIAEQLKYTGNKDAAAAVGKAVAERALEKGIKDVSFDRSGFQYHGRVQALADAAREAGLQF" . to_string( ) ) ) ;
1637+ }
1638+ }
16321639 }
16331640}
16341641
0 commit comments