public boolean checkPolymeridConnection ( String polymerId ) { LOG . debug ( "Validation of polymerID in the connection section:" ) ; String ratio = "(:[1-9][0-9]*(\\.[0-9]+)?)?" ; String id = "(PEPTIDE[1-9][0-9]*|RNA[1-9][0-9]*|CHEM[1-9][0-9]*|BLOB[1-9][0-9]*|G[1-9][0-9]*)" ; String pattern = "(\\(" + id + ratio + "(," + id + ratio + ")+\\)" + ratio + "|" + id + ratio + ")" ; Pattern p = Pattern . compile ( pattern , Pattern . CASE_INSENSITIVE ) ; Matcher m = p . matcher ( polymerId ) ; if ( m . matches ( ) ) { LOG . debug ( "PolymerID in the connection section is valid:" ) ; return true ; } LOG . debug ( "PolymerID in the connection section is not valid: " + polymerId ) ; return false ; }
method to validate the polymer id in the connection section the id can be peptide rna chem or blob the ratio + range was also included the ambiguity is also proven