Skip to content

Commit 2b961a4

Browse files
authored
Fixing uniprot queries (#640)
* fixed queries * Returned line to original
1 parent 4bb8617 commit 2b961a4

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

mzLib/UsefulProteomicsDatabases/ProteinDbRetriever.cs

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,22 @@ public static class ProteinDbRetriever
1919
/// <param name="reviewed">if yes file contains only reviewd proteins</param>
2020
/// <param name="compress">if yes file is saved as .gz</param>
2121
/// <param name="absolutePathToStorageDirectory"></param>
22-
public static string RetrieveProteome(string proteomeID, string absolutePathToStorageDirectory, ProteomeFormat format, Reviewed reviewed, Compress compress, IncludeIsoforms include)
22+
public static string RetrieveProteome(string proteomeID, string absolutePathToStorageDirectory, ProteomeFormat format,
23+
Reviewed reviewed, Compress compress, IncludeIsoforms include)
2324
{
2425
if (Directory.Exists(absolutePathToStorageDirectory))
2526
{
2627
string htmlQueryString = "";
2728
string filename = "\\" + proteomeID;
29+
bool compressBool = false;
30+
bool isoformBool = false;
31+
bool reviewedBool = false;
2832
if (format == ProteomeFormat.fasta)
2933
{
3034
if (reviewed == Reviewed.yes)
3135
{
3236
filename += "_reviewed";
37+
reviewedBool = true;
3338
}
3439
else
3540
{
@@ -39,19 +44,25 @@ public static string RetrieveProteome(string proteomeID, string absolutePathToSt
3944
if (include == IncludeIsoforms.yes)
4045
{
4146
filename += "_isoform";
47+
isoformBool = true;
4248
}
4349
filename += ".fasta";
4450
if (compress == Compress.yes)
4551
{
4652
filename += ".gz";
53+
compressBool = true;
4754
}
48-
htmlQueryString = "https://legacy.uniprot.org/uniprot/?query=proteome:" + proteomeID + " reviewed:" + reviewed + "&compress=" + compress + "&format=" + format + "&include:" + include;
55+
56+
htmlQueryString = "https://rest.uniprot.org/uniprot/search?query=" + proteomeID + "+AND+" + "reviewed:" + reviewedBool.ToString().ToLower() +
57+
"&compressed=" + compressBool.ToString().ToLower() + "&format=" + format + "&includeIsoforms:" + isoformBool.ToString().ToLower();
58+
4959
}
5060
else if (format == ProteomeFormat.xml)
5161
{
5262
if (reviewed == Reviewed.yes)
5363
{
5464
filename += "_reviewed";
65+
reviewedBool = true;
5566
}
5667
else
5768
{
@@ -61,8 +72,11 @@ public static string RetrieveProteome(string proteomeID, string absolutePathToSt
6172
if (compress == Compress.yes)
6273
{
6374
filename += ".gz";
75+
compressBool = true;
6476
}
65-
htmlQueryString = "https://legacy.uniprot.org/uniprot/?query=proteome:" + proteomeID + " reviewed:" + reviewed + "&compress=" + compress + "&format=" + format;
77+
htmlQueryString = "https://rest.uniprot.org/proteome/search?query=" + proteomeID + "+AND+reviewed:" + reviewedBool.ToString().ToLower()
78+
+ "&compressed=" + compressBool.ToString().ToLower() + "&format=" + format;
79+
6680
}
6781
if (htmlQueryString.Length > 0)
6882
{
@@ -85,8 +99,9 @@ public static string RetrieveProteome(string proteomeID, string absolutePathToSt
8599
public static string DownloadAvailableUniProtProteomes(string destinationFolder)
86100
{
87101
if (Directory.Exists(destinationFolder))
88-
{
89-
string htmlQueryString = "https://legacy.uniprot.org/proteomes/?query=*&format=tab&compress=yes&columns=id,name,organism-id,proteincount,busco,cpd,assembly%20representation";
102+
{
103+
string htmlQueryString = "https://rest.uniprot.org/proteomes/search?query=*&format=tsv&compressed=true";
104+
90105
string filename = "availableUniProtProteomes.txt.gz";
91106

92107
string filepath = Path.Combine(destinationFolder, filename);

0 commit comments

Comments
 (0)