Skip to content

Commit

Permalink
Comment out lines in FTHelper that convert specific tags to notes, ad…
Browse files Browse the repository at this point in the history
…d a test that checks for duplicated note tags, all tests pass
  • Loading branch information
bosborne committed Aug 25, 2011
1 parent c588c1b commit 5ffa0a8
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 5 deletions.
15 changes: 11 additions & 4 deletions Bio/SeqIO/FTHelper.pm
Expand Up @@ -207,12 +207,19 @@ sub from_SeqFeature {
$fth->loc($locstr);
$fth->key($key);
$fth->field->{'note'} = [];

# the lines below take specific tags (e.g. /score=23 ) and re-enter them as
# new tags like /note="score=25" - if the file is round-tripped this creates
# duplicate values

#$sf->source_tag && do { push(@{$fth->field->{'note'}},"source=" . $sf->source_tag ); };

($sf->can('score') && $sf->score) && do { push(@{$fth->field->{'note'}},
"score=" . $sf->score ); };
($sf->can('frame') && $sf->frame) && do { push(@{$fth->field->{'note'}},
"frame=" . $sf->frame ); };
#($sf->can('score') && $sf->score) && do { push(@{$fth->field->{'note'}},
# "score=" . $sf->score ); };

#($sf->can('frame') && $sf->frame) && do { push(@{$fth->field->{'note'}},
# "frame=" . $sf->frame ); };

#$sf->strand && do { push(@{$fth->field->{'note'}},"strand=" . $sf->strand ); };

foreach my $tag ( $sf->get_all_tags ) {
Expand Down
22 changes: 21 additions & 1 deletion t/SeqIO/genbank.t
Expand Up @@ -7,7 +7,7 @@ BEGIN {
use lib '.';
use Bio::Root::Test;

test_begin(-tests => 272 );
test_begin(-tests => 274 );

use_ok('Bio::SeqIO::genbank');
}
Expand Down Expand Up @@ -581,3 +581,23 @@ $seq = $ast->next_seq;
ok my @ctg = $seq->annotation->get_Annotations('contig');
like $ctg[0]->value, qr/join\(.*?gap.*?complement/;

# write_seq() and FTHelper duplicate specific tags, need to check a round-trip
$ast = Bio::SeqIO->new(-format => 'genbank' ,
-verbose => $verbose,
-file => test_input_file('singlescore.gbk'));
$as = $ast->next_seq();
($cds) = grep { $_->primary_tag eq 'CDS' } $as->get_SeqFeatures();
my @notes = $cds->get_tag_values('note');
is(scalar @notes, 2);
$testfile = test_output_file();
$out = Bio::SeqIO->new(-file => ">$testfile",
-format => 'genbank');
$out->write_seq($as);
$out->close();
$ast = Bio::SeqIO->new(-format => 'genbank' ,
-verbose => $verbose,
-file => $testfile );
$as = $ast->next_seq;
($cds) = grep { $_->primary_tag eq 'CDS' } $as->get_SeqFeatures();
my @notes = $cds->get_tag_values('note');
is(scalar @notes, 2);
48 changes: 48 additions & 0 deletions t/data/singlescore.gbk
@@ -0,0 +1,48 @@
LOCUS test0001 1500 bp dna linear UNK
DEFINITION [organism=Test test] [strain=test0001] [gcode=11] [date=8-24-2011]
ACCESSION test0001
KEYWORDS .
FEATURES Location/Qualifiers
fasta_record 1..1200
/name="contig00002"
/note="untiled"
CDS 16..1215
/locus_tag="test0001_10"
/inference="similar to AA sequence:BLASTX:2.2.18"
/score="463"
/product="tRNA uridine 5-carboxymethylaminomethyl
modification enzyme MnmG n=70 Tax=Proteobacteria
RepID=MNMG_ALTMD"
/note="score=463"
/note="similar to tRNA uridine 5-carboxymethylaminomethyl
modification enzyme GidA PRK05192"
gene 16..1215
/locus_tag="test0001_10"
/inference="ab initio prediction:glimmer3:3.0.2"
ORIGIN
1 ctaacacaaa gtaatatgag tttttattct agatcagttg tattatcaac aggtaccttt
61 ctaggtggaa aaatacacat aggtttagaa agttattctg ctggaagaaa aggagaaaaa
121 gcatctatag atttagctct tcgtttaaga gatttgcctt ttcgtgtgga tagattaaaa
181 actggaacac cacctcgaat tgatattaat acaattaatt ttgaaaattt atttgtccag
241 catggtgatg ttcctactcc tgttttttct tttatggggg atatttctaa tcatcctctt
301 caaataccgt gttttcttac acacactaat gaaaaaacgc atgaaataat acgtaaaaat
361 ttacataaga gtcctctata tacaggtatt attaaaggtg tgggacctcg atattgtcct
421 tctattgaag ataaaattgt acgtttccct gataggaaat cacatcaaat ttttttagag
481 ccagaaggat taactagtat tgaaatatat ccaaatggta tctcaactag tttaccctta
541 gatgttcaaa aagaaatagt aagttctgta aaaggtttag aaaagtctaa aattattact
601 cctggttatg ctgtagaata tgattttttt gatcctaagg atttaaatct tactttagag
661 agtaaatgga ttaaaggtct ttttttagct ggtcaaatta atggtactac tggttatgaa
721 gaagctgcgt ctcaaggact tttagcaggt ttaaatgcag ctttaagtgc aaaagattgc
781 aaacaatggt ttcctagacg tgatcaagct tatttaggtg ttcttattga tgatttaact
841 actcaaggtg cgaatgaacc ttatcgaatg tttacttcaa gatctgaata tcggttaact
901 ttaagagaag ataatgctga tttacgttta actgaaatag cttataaatt gggattagta
961 gataatccaa gatggattcg ttataatgaa aaagtactaa atatcagtaa tgaaaaaaat
1021 cgtttaaaaa aaataaaaat atatcctaaa tcctctgata gtactatttt aaatcagtta
1081 tttaatattg ttttaactaa agaaattaat attttaaatt tattaaaacg tccagaaatt
1141 acatatgaaa atttaaagta tttaaaaaat tttaaagtag gtatttctga tttagaagca
1201 nnnttaatta attaannngg tgagtttact tctagtgatt tattaaaacg tattttttct
1261 accttttgca taggaaaata agaatataat ttttgcccgg aggcggaatt gaaccaccga
1321 cacggggatt ttcagtcccc tgctctaccg actgagctat ccgggcaatt tttacattaa
1381 atcatcaaag ataaaacttt gtcaatcttt ttttgtagaa gttaatttga aattttgatt
1441 taactaatat cttttctatt ttgaaaatat aaaataaaaa taaaaaaata attttttccc
//

0 comments on commit 5ffa0a8

Please sign in to comment.