diff --git a/uk/ac/sanger/artemis/io/ChadoCanonicalGene.java b/uk/ac/sanger/artemis/io/ChadoCanonicalGene.java index 0d800492b21aa9ba80cdf08b83d9633be55b13a3..8fe25545ff98b49314d2d1c92f90911a25c89d03 100644 --- a/uk/ac/sanger/artemis/io/ChadoCanonicalGene.java +++ b/uk/ac/sanger/artemis/io/ChadoCanonicalGene.java @@ -20,7 +20,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/io/ChadoCanonicalGene.java,v 1.20 2007-03-28 09:15:34 tjc Exp $ + * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/io/ChadoCanonicalGene.java,v 1.21 2007-03-29 08:35:59 tjc Exp $ */ package uk.ac.sanger.artemis.io; @@ -683,6 +683,53 @@ public class ChadoCanonicalGene return null; } + + /** + * Generate new names for peptide features for this gene model + * @param transcript_id + * @return + */ + public String autoGeneratePepName(final String transcript_id) + { + try + { + int index = transcript_id.lastIndexOf(':'); + int transcript_number = -1; + + if(index > -1) + { + try + { + transcript_number = Integer.parseInt(transcript_id.substring(index+1)); + } + catch(NumberFormatException nfe) + { + transcript_number = -1; + } + } + + if(transcript_number < 1) + { + for(transcript_number = 1; transcript_number <= transcripts.size(); + transcript_number++) + { + Feature transcript = (Feature) transcripts.get(transcript_number - 1); + if(transcript_id.equals(getQualifier(transcript, "ID"))) + break; + } + } + + String name = (String)getGene().getQualifierByName("ID").getValues().get(0); + + return name + ":" + transcript_number + ":pep"; + } + catch(InvalidRelationException e) + { + e.printStackTrace(); + } + return null; + } + /** * Search for the feature with a particular uniquename * @param name uniquename