Skip to content

Commit 09ac269

Browse files
Merge pull request #148 from SynBioDex/tayasherstyukova-readme-update
readme fix
2 parents 36ec9b1 + 35b27eb commit 09ac269

File tree

2 files changed

+79
-79
lines changed

2 files changed

+79
-79
lines changed

README.md

Lines changed: 5 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -40,82 +40,8 @@ There are several ways to install the converter. The easiest is via pip: `pip in
4040
**3) Run the Converter**
4141
Use the code below to run the converter. Converter file needs to be within the same directory as the Excel template.
4242
The following script asks the user for the name of the input file, version of SBOL to use, and offers the option to sign in to gain access to private repositories.
43-
```
44-
45-
# Excel2SBOL Converter
46-
47-
import excel2sbol.converter as conf
48-
from datetime import datetime
49-
import excel_sbol_utils.library2 as exutil2
50-
import getpass
51-
import requests
52-
53-
# Ask the user for the name of the input file
54-
input_file = input("Please enter the name of the input file: ")
55-
56-
# Get the current date
57-
current_date = datetime.now().strftime("%y.%m.%d.%H.%M.%S")
58-
59-
# Add the current date to the output file name
60-
output_file = "Output_SBOL_" + current_date + ".xml"
61-
62-
# Ask the user for the version of SBOL to use
63-
while True:
64-
sbol_version = input("Please enter the version of SBOL to use (2 or 3): ")
65-
if sbol_version in ['2', '3']:
66-
sbol_version = int(sbol_version)
67-
break
68-
else:
69-
print("Invalid input. Please enter either 2 or 3.")
70-
71-
# Ask the user if they want to sign in or not to use private repos
72-
while True:
73-
signin_permission = input("Do you want to sign in? (y/n): ")
74-
if signin_permission in ['y', 'n']:
75-
break
76-
else:
77-
print("Invalid input. Please enter either y or n.")
78-
79-
if signin_permission == 'y':
80-
for attempt in range(1, 3 + 1):
81-
domain = input("Please enter the domain name: ")
82-
domain = domain.rstrip("/")
83-
try:
84-
response = requests.get(domain)
85-
response.raise_for_status()
86-
print("URL reached successfully")
87-
break
88-
except requests.exceptions.RequestException as e:
89-
print(f"Wrong domain name. Attempt {attempt} of 3.")
90-
if attempt == 3:
91-
print("Maximum attempts reached. Exiting the program.")
92-
exit()
93-
94-
max_attempts = 3
95-
for attempt in range(1, max_attempts + 1):
96-
user_email = input("Please enter your email address: ")
97-
user_password = getpass.getpass("Please enter your password: ")
98-
99-
100-
login_response = requests.post(
101-
f"{domain}/login",
102-
headers={'Accept': 'plain/text'},
103-
data={'email': user_email, 'password': user_password}
104-
)
105-
106-
if login_response.status_code == 200:
107-
print("Login successful.")
108-
conf.converter(input_file, output_file, sbol_version=sbol_version, username=user_email, password=user_password, url=domain)
109-
break
110-
else:
111-
print(f"Login unsuccessful. Attempt {attempt} of {max_attempts}.")
112-
if attempt == max_attempts:
113-
print("Maximum login attempts reached. Exiting the program.")
114-
exit()
115-
else:
116-
conf.converter(input_file, output_file, sbol_version=sbol_version)
117-
118-
```
43+
44+
[Converter File](https://github.com/SynBioDex/Excel-to-SBOL/blob/master/excel2sbol/tests/test_files/Excel2SBOLConverter.py)
11945

12046
Tip: the use of `os.getcwd()` and `os.path.join` is reccommended for the creation of the file paths. This is safer from a cybersecurity stand point and provide better operating system interoperability.
12147

@@ -124,13 +50,13 @@ The SBOL file that is output can then be used by further [SBOL tools](https://sb
12450

12551
# Example Conversion
12652

127-
A data-filled [spreadsheet](https://github.com/SynBioDex/Excel-to-SBOL/blob/readme/excel2sbol/resources/templates/Example.xlsm) was converted to an [SBOL file](https://github.com/SynBioDex/Excel-to-SBOL/blob/readme/excel2sbol/tests/test_files/Example.xml).
53+
A data-filled [spreadsheet](https://github.com/SynBioDex/Excel-to-SBOL/blob/master/excel2sbol/resources/templates/Example.xlsm) was converted to an [SBOL file](https://github.com/SynBioDex/Excel-to-SBOL/blob/master/excel2sbol/tests/test_files/Example.xml).
12854

12955
**Example Spreadsheet**
130-
![Example Spreadsheet](https://github.com/SynBioDex/Excel-to-SBOL/blob/readme/images/sample-template.png)
56+
![Example Spreadsheet](https://github.com/SynBioDex/Excel-to-SBOL/blob/master/images/sample-template.png)
13157

13258
**Example SBOL**
133-
![Example SBOL](https://github.com/SynBioDex/Excel-to-SBOL/blob/readme/images/sample-xml.png)
59+
![Example SBOL](https://github.com/SynBioDex/Excel-to-SBOL/blob/master/images/sample-xml.png)
13460

13561

13662

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# # Excel2SBOL Converter
2+
3+
import excel2sbol.converter as conf
4+
from datetime import datetime
5+
import excel_sbol_utils.library2 as exutil2
6+
import getpass
7+
import requests
8+
9+
# Ask the user for the name of the input file
10+
input_file = input("Please enter the name of the input file: ")
11+
12+
# Get the current date
13+
current_date = datetime.now().strftime("%y.%m.%d.%H.%M.%S")
14+
15+
# Add the current date to the output file name
16+
output_file = "Output_SBOL_" + current_date + ".xml"
17+
18+
# Ask the user for the version of SBOL to use
19+
while True:
20+
sbol_version = input("Please enter the version of SBOL to use (2 or 3): ")
21+
if sbol_version in ['2', '3']:
22+
sbol_version = int(sbol_version)
23+
break
24+
else:
25+
print("Invalid input. Please enter either 2 or 3.")
26+
27+
# Ask the user if they want to sign in or not to use private repos
28+
while True:
29+
signin_permission = input("Do you want to sign in? (y/n): ")
30+
if signin_permission in ['y', 'n']:
31+
break
32+
else:
33+
print("Invalid input. Please enter either y or n.")
34+
35+
if signin_permission == 'y':
36+
for attempt in range(1, 3 + 1):
37+
domain = input("Please enter the domain name: ")
38+
domain = domain.rstrip("/")
39+
try:
40+
response = requests.get(domain)
41+
response.raise_for_status()
42+
print("URL reached successfully")
43+
break
44+
except requests.exceptions.RequestException as e:
45+
print(f"Wrong domain name. Attempt {attempt} of 3.")
46+
if attempt == 3:
47+
print("Maximum attempts reached. Exiting the program.")
48+
exit()
49+
50+
max_attempts = 3
51+
for attempt in range(1, max_attempts + 1):
52+
user_email = input("Please enter your email address: ")
53+
user_password = getpass.getpass("Please enter your password: ")
54+
55+
56+
login_response = requests.post(
57+
f"{domain}/login",
58+
headers={'Accept': 'plain/text'},
59+
data={'email': user_email, 'password': user_password}
60+
)
61+
62+
if login_response.status_code == 200:
63+
print("Login successful.")
64+
conf.converter(input_file, output_file, sbol_version=sbol_version, username=user_email, password=user_password, url=domain)
65+
break
66+
else:
67+
print(f"Login unsuccessful. Attempt {attempt} of {max_attempts}.")
68+
if attempt == max_attempts:
69+
print("Maximum login attempts reached. Exiting the program.")
70+
exit()
71+
else:
72+
conf.converter(input_file, output_file, sbol_version=sbol_version)
73+
74+

0 commit comments

Comments
 (0)