From 77275af740d9e60e0109d2344c63c3fe09ff5213 Mon Sep 17 00:00:00 2001 From: cjfields Date: Tue, 16 Dec 2008 05:11:04 +0000 Subject: [PATCH] You must actually test data if you want this module to be included in the release (this now fails two tests) svn path=/bioperl-live/trunk/; revision=15175 --- t/Microarray/Tools/ReseqChip.t | 87 ++++++++++++++---------------------------- 1 file changed, 29 insertions(+), 58 deletions(-) diff --git a/t/Microarray/Tools/ReseqChip.t b/t/Microarray/Tools/ReseqChip.t index 0b480a41d..bee56d156 100755 --- a/t/Microarray/Tools/ReseqChip.t +++ b/t/Microarray/Tools/ReseqChip.t @@ -6,54 +6,44 @@ BEGIN { use lib '.'; use Bio::Root::Test; test_begin(-tests => 7, - -requires_modules => [qw(Statistics::Frequency Spreadsheet::ParseExcel Spreadsheet::WriteExcel)] + -requires_modules => [qw(Statistics::Frequency + Spreadsheet::ParseExcel + Spreadsheet::WriteExcel)] ); use_ok('Bio::Microarray::Tools::ReseqChip'); } my $DEBUG = test_debug(); - -sub process_sample($$$$$$$$) { +sub process_sample($$$$$$$) { - my ($myReseqChip, $aln, $ind_id, $options_hash, $newseq_output_filename, $recalls_output_filename, $workbook, $tmpdir) = @_; - print "process sample $ind_id ...\n"; + my ($myReseqChip, $aln, $ind_id, $options_hash, $newseq_output_filename, $recalls_output_filename, $workbook) = @_; + print "process sample $ind_id ...\n" if $DEBUG; $aln->sort_alphabetically; - SKIP: { - skip "unable to create temp dir '$tmpdir', skipping tests", 12 unless -d $tmpdir; - $myReseqChip->write_alignment2xls($aln, $workbook, $ind_id, 'human_mtDNA_RCRS', 1); - ok('dummy', 'write_alignment2xls'); - } + $myReseqChip->write_alignment2xls($aln, $workbook, $ind_id, 'human_mtDNA_RCRS', 1); + ok(-e $workbook, 'write_alignment2xls'); my ($newseq,$dummy); - if (-d $tmpdir) { - $newseq=$myReseqChip->calc_sequence($aln, $dummy, $options_hash, $recalls_output_filename); - ok('dummy', 'calc_sequence'); - } else { - $newseq=$myReseqChip->calc_sequence($aln, $dummy, $options_hash); - ok('dummy', 'calc_sequence'); - } - SKIP: { - skip "unable to create temp dir '$tmpdir', skipping tests", 12 unless -d $tmpdir; - $myReseqChip->write2fasta($newseq, $ind_id, $newseq_output_filename, 1); - ok('dummy', 'write2fasta'); - } + $newseq=$myReseqChip->calc_sequence($aln, $dummy, $options_hash, $recalls_output_filename); + ok(-e $recalls_output_filename, 'calc_sequence'); + $myReseqChip->write2fasta($newseq, $ind_id, $newseq_output_filename, 1); + ok(-e $newseq_output_filename, 'write2fasta'); + } +###input files +my $Affy_frags_design_filename = test_input_file('ReseqChip_mtDNA_design_annotation_file_FINAL.xls'); +my $format = 'affy_mitochip_v2'; +my $Affy_sample_fasta_file = test_input_file('ReseqChip_ExampleData.fasta'); +my $Mito_reference_fasta_file = test_input_file('ReseqChip_RefSeq.fasta'); -###intput files -my $Affy_frags_design_filename='t/data/ReseqChip_mtDNA_design_annotation_file_FINAL.xls'; -my $format='affy_mitochip_v2'; -my $Affy_sample_fasta_file='t/data/ReseqChip_ExampleData.fasta'; -my $Mito_reference_fasta_file='t/data/ReseqChip_RefSeq.fasta'; - -my $tmpdir = File::Spec->catfile(qw(t tmp)); -mkdir($tmpdir,0777); +#my $tmpdir = File::Spec->catfile(qw(t tmp)); +#mkdir($tmpdir,0777); ###output files -my $xls_filename="$tmpdir/alignment_redundantfrags.xls"; -my $recalls_output_filename="$tmpdir/recalls_output.txt"; -my $newseq_output_filename="$tmpdir/newseq.fasta"; +my $xls_filename=test_output_file(); +my $recalls_output_filename=test_output_file(); +my $newseq_output_filename=test_output_file(); my $in = Bio::SeqIO->new(-file => $Affy_sample_fasta_file, -format => 'Fasta'); @@ -62,8 +52,7 @@ my $in_refseq = Bio::SeqIO->new(-file => $Mito_reference_fasta_file, my $refseq = $in_refseq->next_seq(); my %ref_seq_max_ins_hash=(3106 => 1); -#print "1. Chip Design File: $Affy_frags_design_filename\n2. Format: $format\n3. Reference Sequence: $refseq\n4. Samplefile: $Affy_sample_fasta_file\n\n"; -my $myReseqChip=Bio::Microarray::Tools::ReseqChip->new($Affy_frags_design_filename, $format, \%ref_seq_max_ins_hash, $refseq); +my $myReseqChip = Bio::Microarray::Tools::ReseqChip->new($Affy_frags_design_filename, $format, \%ref_seq_max_ins_hash, $refseq); my %options_hash=( include_main_sequence => 1, @@ -101,7 +90,6 @@ $options_hash{deletions}=1; $options_hash{flank_size_weak}=1; $options_hash{consider_context}=1; $options_hash{swap_ins}=1; - ##options for diploid model $options_hash{depth}=10; @@ -115,7 +103,6 @@ $options_hash{flank_right}=1; $options_hash{allowed_n_in_flank}=2; - ##ins options $options_hash{depth_ins}=1; $options_hash{ins_threshold}=60; @@ -135,10 +122,6 @@ $options_hash{flank_right}=5; $options_hash{allowed_n_in_flank}=0; - - - - ##hap model 2 $options_hash{depth}=10; $options_hash{depth_del}=10; @@ -146,23 +129,17 @@ $options_hash{depth_del}=10; $options_hash{call_threshold}=90; $options_hash{del_threshold}=90; - $options_hash{flank_left}=1; $options_hash{flank_right}=1; $options_hash{allowed_n_in_flank}=1; - - - - my $ind_id=""; my $ind_id_old=""; my $workbook = Spreadsheet::WriteExcel->new($xls_filename); my $j=1; -my $aln = new Bio::SimpleAlign(); +my $aln = Bio::SimpleAlign->new(); while ( (my $seq = $in->next_seq())) { - my $locseq; my $test_complete_seq=($seq->id =~ /human_mtDNA_RCRS/); if ($test_complete_seq==1) { @@ -172,12 +149,11 @@ while ( (my $seq = $in->next_seq())) { if (!$test_complete_seq) { $locseq=$myReseqChip->insert_gaps2frag($seq); $aln->add_seq($locseq); - - } else { if ($aln->length>0) { - process_sample($myReseqChip, $aln, $ind_id_old, \%options_hash, $newseq_output_filename, $recalls_output_filename, $workbook, $tmpdir); + process_sample($myReseqChip, $aln, $ind_id_old, \%options_hash, + $newseq_output_filename, $recalls_output_filename, $workbook); } $ind_id_old=$ind_id; @@ -188,12 +164,7 @@ while ( (my $seq = $in->next_seq())) { } } -process_sample($myReseqChip, $aln, $ind_id_old, \%options_hash, $newseq_output_filename, $recalls_output_filename, $workbook, $tmpdir); +process_sample($myReseqChip, $aln, $ind_id_old, \%options_hash, + $newseq_output_filename, $recalls_output_filename, $workbook); $workbook->close(); - - -END { - File::Path::rmtree($tmpdir) if ($tmpdir && (-d $tmpdir)); -} - \ No newline at end of file -- 2.11.4.GIT