2014-06-03 19:22:39 -07:00
#!/usr/bin/env perl
use strict ;
use warnings ;
use Test::More ;
use DDG::Test::Goodie ;
2014-10-06 05:06:42 -07:00
zci answer_type = > 'reverse_complement' ;
zci is_cached = > 1 ;
my @ aaaacccggt = (
"ACCGGGTTTT" ,
structured_answer = > {
input = > [ 'AAAACCCGGT' ] ,
2015-01-09 00:46:54 -08:00
operation = > 'Nucleotide reverse complement' ,
2014-10-06 05:06:42 -07:00
result = > 'ACCGGGTTTT'
} ) ;
2014-06-03 19:22:39 -07:00
ddg_goodie_test (
2014-10-06 05:06:42 -07:00
[ qw( DDG::Goodie::ReverseComplement ) ] ,
#Basic DNA reverse complements, various trigger combinations
'AAAACCCGGT reverse complement' = > test_zci ( @ aaaacccggt ) ,
'reverse complement of TTTGATCATGGCTCAGGACGAACGCTGGCGGCGT' = > test_zci (
"ACGCCGCCAGCGTTCGTCCTGAGCCATGATCAAA" ,
structured_answer = > {
input = > [ 'TTTGATCATGGCTCAGGACGAACGCTGGCGGCGT' ] ,
2015-01-09 00:46:54 -08:00
operation = > 'Nucleotide reverse complement' ,
2014-10-06 05:06:42 -07:00
result = > 'ACGCCGCCAGCGTTCGTCCTGAGCCATGATCAAA'
}
) ,
'AAAACCCGGT revcomp' = > test_zci ( @ aaaacccggt ) ,
'revcomp AAAACCCGGT' = > test_zci ( @ aaaacccggt ) ,
'revcomp of AAAACCCGGT' = > test_zci ( @ aaaacccggt ) ,
'DNA revcomp of sequence AAAACCCGGT' = > test_zci ( @ aaaacccggt ) ,
'reverse complement of RNA sequence AAAACCCGGU' = > test_zci (
"ACCGGGTTTT" ,
structured_answer = > {
input = > [ 'AAAACCCGGU' ] ,
2015-01-09 00:46:54 -08:00
operation = > 'Nucleotide reverse complement' ,
2014-10-06 05:06:42 -07:00
result = > 'ACCGGGTTTT'
}
) ,
#RNA reverse complement with acceptable spacing characters
'reverse complement uca gac gga' = > test_zci (
"TCCGTCTGA" ,
structured_answer = > {
input = > [ 'UCAGACGGA' ] ,
2015-01-09 00:46:54 -08:00
operation = > 'Nucleotide reverse complement' ,
2014-10-06 05:06:42 -07:00
result = > 'TCCGTCTGA' ,
}
) ,
'reverse complement of nucleotide sequence uca-gac-gga' = > test_zci (
"TCCGTCTGA" ,
structured_answer = > {
input = > [ 'UCAGACGGA' ] ,
2015-01-09 00:46:54 -08:00
operation = > 'Nucleotide reverse complement' ,
2014-10-06 05:06:42 -07:00
result = > 'TCCGTCTGA' ,
}
) ,
#With ambiguous bases (both DNA and RNA)
'reverse complement TCAAAWWDGGATTAMATACCCTGGTAGTCCACRCCATAAACGATGTATGCTTGGTGRGVGTGAGTAATCACTCAGTMCGAAGGCAACCTGATAAGCATACCKCCTVGAGTACGATCSCAAGGTTGAAACTCA DNA sequence'
= > test_zci (
"TGAGTTTCAACCTTGSGATCGTACTCBAGGMGGTATGCTTATCAGGTTGCCTTCGKACTGAGTGATTACTCACBCYCACCAAGCATACATCGTTTATGGYGTGGACTACCAGGGTATKTAATCCHWWTTTGA" ,
structured_answer = > {
input = > [
'TCAAAWWDGGATTAMATACCCTGGTAGTCCACRCCATAAACGATGTATGCTTGGTGRGVGTGAGTAATCACTCAGTMCGAAGGCAACCTGATAAGCATACCKCCTVGAGTACGATCSCAAGGTTGAAACTCA'
] ,
2015-01-09 00:46:54 -08:00
operation = > 'Nucleotide reverse complement' ,
2014-10-06 05:06:42 -07:00
result = >
'TGAGTTTCAACCTTGSGATCGTACTCBAGGMGGTATGCTTATCAGGTTGCCTTCGKACTGAGTGATTACTCACBCYCACCAAGCATACATCGTTTATGGYGTGGACTACCAGGGTATKTAATCCHWWTTTGA'
} ,
) ,
'reverse complement CUAKCCAAGCCGACGASUCGGUAGCUGGUCUGAGAGKGACGAACAGCCACACUGGAACUGAGACAYCGGUCCAGACUCCUACGGGAGGCAGCAGUGAGGAAUAUUGGUCAAKUGGACRGCAAGUCUGAACCAYGCGACGRCGCGUGCGGGAUGAAGGGGCUUAGCCUCGUAAACDCGCURGUCAAGAGGGACGAGAGGHGCGAUUUUGUMCGUCCGGGWWACGV'
= > test_zci (
"BCGTWWCCCGGACGKACAAAATCGCDCCTCTCGTCCCTCTTGACYAGCGHGTTTACGAGGCTAAGCCCCTTCATCCCGCACGCGYCGTCGCRTGGTTCAGACTTGCYGTCCAMTTGACCAATATTCCTCACTGCTGCCTCCCGTAGGAGTCTGGACCGRTGTCTCAGTTCCAGTGTGGCTGTTCGTCMCTCTCAGACCAGCTACCGASTCGTCGGCTTGGMTAG" ,
structured_answer = > {
input = > [
'CUAKCCAAGCCGACGASUCGGUAGCUGGUCUGAGAGKGACGAACAGCCACACUGGAACUGAGACAYCGGUCCAGACUCCUACGGGAGGCAGCAGUGAGGAAUAUUGGUCAAKUGGACRGCAAGUCUGAACCAYGCGACGRCGCGUGCGGGAUGAAGGGGCUUAGCCUCGUAAACDCGCURGUCAAGAGGGACGAGAGGHGCGAUUUUGUMCGUCCGGGWWACGV'
] ,
2015-01-09 00:46:54 -08:00
operation = > 'Nucleotide reverse complement' ,
2014-10-06 05:06:42 -07:00
result = >
'BCGTWWCCCGGACGKACAAAATCGCDCCTCTCGTCCCTCTTGACYAGCGHGTTTACGAGGCTAAGCCCCTTCATCCCGCACGCGYCGTCGCRTGGTTCAGACTTGCYGTCCAMTTGACCAATATTCCTCACTGCTGCCTCCCGTAGGAGTCTGGACCGRTGTCTCAGTTCCAGTGTGGCTGTTCGTCMCTCTCAGACCAGCTACCGASTCGTCGGCTTGGMTAG'
} ,
) ,
#Mix of DNA and RNA bases (should return empty, as it is more likely that this
# is an error than one of the edge cases of uracil-containing DNA)
'reverse complement AAATTTCCCGGGUUU' = > undef ,
#Non-nucleic acid query strings (should return empty, no idea what they wanted)
'reverse complement hello-this-is-DNA' = > undef ,
'DNA reverse complement' = > undef ,
2014-06-03 19:22:39 -07:00
) ;
done_testing ;