import java.util.List;
import java.util.Map.Entry;
-import com.stevesoft.pat.Regex;
-
/**
* Base class for Ensembl sequence fetchers
*
*/
public abstract class EnsemblSeqProxy extends EnsemblRestClient
{
- // TODO modify to accept other species e.g. ENSMUSTnnn
- private static final Regex TRANSCRIPT_REGEX = new Regex(
- "(ENST)[0-9]{11}$");
-
private static final List<String> CROSS_REFERENCES = Arrays
- .asList(new String[] { "CCDS" });
+ .asList(new String[] { "CCDS", "Uniprot/SWISSPROT" });
protected static final String CONSEQUENCE_TYPE = "consequence_type";
}
}
+ if (alignment == null)
+ {
+ return null;
+ }
+
/*
* fetch and transfer genomic sequence features,
* fetch protein product and add as cross-reference
int mappedDnaLength = getCdsRanges(dnaSeq, ranges);
int proteinLength = proteinSeq.getLength();
- List<int[]> proteinRange = new ArrayList<int[]>();
+ int proteinEnd = proteinLength;
int proteinStart = 1;
/*
proteinStart = 2;
proteinLength--;
}
- proteinRange.add(new int[] { proteinStart, proteinLength });
+ List<int[]> proteinRange = new ArrayList<int[]>();
/*
* dna length should map to protein (or protein plus stop codon)
*/
int codesForResidues = mappedDnaLength / 3;
- if (codesForResidues == proteinLength
- || codesForResidues == (proteinLength + 1))
+ if (codesForResidues == (proteinLength + 1))
+ {
+ MappingUtils.unmapStopCodon(ranges, mappedDnaLength);
+ codesForResidues--;
+ }
+ if (codesForResidues == proteinLength)
{
+ proteinRange.add(new int[] { proteinStart, proteinEnd });
return new MapList(ranges, proteinRange, 3, 1);
}
return null;
{
return 0;
}
+ SequenceOntologyI so = SequenceOntologyFactory.getInstance();
int mappedDnaLength = 0;
for (SequenceFeature sf : sfs)
{
/*
* process a CDS feature (or a sub-type of CDS)
*/
- if (SequenceOntologyFactory.getInstance().isA(sf.getType(),
- SequenceOntologyI.CDS))
+ if (so.isA(sf.getType(), SequenceOntologyI.CDS))
{
int phase = 0;
try {
*/
int begin = sf.getBegin();
int end = sf.getEnd();
- if (ranges.isEmpty() && phase > 0)
+ if (ranges.isEmpty())
{
begin += phase;
if (begin > end)
|| SequenceOntologyFactory.getInstance().isA(featureType,
SequenceOntologyI.TRANSCRIPT);
}
-
- public static boolean isTranscriptIdentifier(String query)
- {
- return query == null ? false : TRANSCRIPT_REGEX.search(query);
- }
}