Skip to content

Commit 44b5dee

Browse files
authored
Merge pull request #104 from Rfam/rfamseq-desc-len
Adds variable length checks prior to populate call for Rfamseq table
2 parents 75619a3 + d984d10 commit 44b5dee

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Rfam/Schemata/RfamLive/ResultSet/Rfamseq.pm

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,16 @@ sub updateRfamseqFromFamilyObj {
109109
croak "ERROR in $sub_name, invalid source read from seed info hash, valid values are \"SEED:GenBank\" and \"SEED:RNAcentral\" but read $source";
110110
}
111111

112+
# enforce maximum number of characters for each value,
113+
# for overflows in description we just truncate, overflow in others are fatal
114+
if(length($seed_name) > 20) { croak "ERROR in $sub_name, rfamseq_acc $seed_name exceeds 20 characters"; }
115+
if(length($accession) > 15) { croak "ERROR in $sub_name, accession $accession exceeds 15 characters"; }
116+
if(length($version) > 6) { croak "ERROR in $sub_name, version $version exceeds 6 characters"; }
117+
if(length($ncbi_id) > 10) { croak "ERROR in $sub_name, ncbi_id $ncbi_id exceeds 10 characters"; }
118+
if(length($length) > 10) { croak "ERROR in $sub_name, length $length exceeds 10 characters"; }
119+
if(length($source) > 20) { croak "ERROR in $sub_name, source $source exceeds 20 characters"; }
120+
if(length($description) > 250) { $description = substr($description, 0, 250); }
121+
112122
push(@row_AH, { rfamseq_acc => $seed_name,
113123
accession => $accession,
114124
version => $version,

0 commit comments

Comments
 (0)