I have a very simple but massively frustrating problem. I am interested in just getting all of the lengths (number of amino acid residues) associated with Ensembl proteins.
The BioMart interface to Ensembl has plenty of information, but not protein lengths. The biomaRt package for R looks great, but doesn't have protein lengths. This is madness!
Things I've tried:
- Converting a list of all ENSPs to Uniprot IDs and getting the protein lengths from Uniprot. This doesn't work well since a single Uniprot accession can correspond to several ENSPs, and I'm interested in having all the isoform information.
- Getting the CDS lengths out of BioMart, and noting that they're about 3 times the protein lengths. This isn't precise enough, though.
- Getting ENSP sequences out of BioMart with the aim of counting the amino acids to get the length. This is possible to script so I'm happy to do this if there are no other options.
I'm sure others have encountered the same issue. What do you all think?
---- Edit: still haven't found a direct source of protein length info, but here's some code that calculates them given a text file of ENSP accessions
# load ensp table
ensp <- read.table("~/Projects/chimera_project/analyses/pfam_smart_domain_mapping/all_ensp.txt", header=TRUE)
ensp <- ensp$ensembl_protein_id
# set up mart/dataset
ensembl.human = useMart(biomart="ensembl", dataset = "hsapiens_gene_ensembl")
# see how long it takes to fetch sequences of ensps in list
start_time <- proc.time()
human.prot = getSequence(id=head(ensp, 500), mart=ensembl.human, seqType=c("peptide"), type="ensembl_peptide_id")
proc.time() - start_time
# what have we got here
# reformat result and calculate protein lengths
result <- as.data.frame(cbind(human.prot, human.prot))
result$length <- nchar(result$peptide) - 1
# write out
write.table(x=result, sep='\t', file="~/Projects/chimera_project/analyses/pfam_smart_domain_mapping/ensp_sequences_with_length.txt")