Skip to content

Commit

Permalink
style: format code with Autopep8 and Google Java Format
Browse files Browse the repository at this point in the history
This commit fixes the style issues introduced in 25b2670 according to the output
from Autopep8 and Google Java Format.

Details: None
  • Loading branch information
deepsource-autofix[bot] authored Aug 16, 2024
1 parent 25b2670 commit 16492d3
Showing 1 changed file with 50 additions and 50 deletions.
100 changes: 50 additions & 50 deletions src/main/java/DNAnalyzer/core/DNADataUploader.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,62 +8,62 @@

public class DNADataUploader {

public static Map<String, String> uploadFrom23andMe(String filePath) throws IOException {
Map<String, String> snpData = new HashMap<>();

try (BufferedReader reader = new BufferedReader(new FileReader(filePath))) {
String line;
while ((line = reader.readLine()) != null) {
if (line.startsWith("#")) {
continue; // skip comment lines
}
String[] parts = line.split("\t");
if (parts.length == 4) {
String rsid = parts[0];
String genotype = parts[3];
snpData.put(rsid, genotype);
}
}
public static Map<String, String> uploadFrom23andMe(String filePath) throws IOException {
Map<String, String> snpData = new HashMap<>();

try (BufferedReader reader = new BufferedReader(new FileReader(filePath))) {
String line;
while ((line = reader.readLine()) != null) {
if (line.startsWith("#")) {
continue; // skip comment lines
}
String[] parts = line.split("\t");
if (parts.length == 4) {
String rsid = parts[0];
String genotype = parts[3];
snpData.put(rsid, genotype);
}

return snpData;
}
}

public static Map<String, String> uploadFromAncestryDNA(String filePath) throws IOException {
Map<String, String> snpData = new HashMap<>();

try (BufferedReader reader = new BufferedReader(new FileReader(filePath))) {
String line;
boolean dataStarted = false;
while ((line = reader.readLine()) != null) {
if (!dataStarted) {
if (line.startsWith("rsid")) {
dataStarted = true;
}
continue;
}
String[] parts = line.split("\t");
if (parts.length == 5) {
String rsid = parts[0];
String genotype = parts[3];
snpData.put(rsid, genotype);
}
}
return snpData;
}

public static Map<String, String> uploadFromAncestryDNA(String filePath) throws IOException {
Map<String, String> snpData = new HashMap<>();

try (BufferedReader reader = new BufferedReader(new FileReader(filePath))) {
String line;
boolean dataStarted = false;
while ((line = reader.readLine()) != null) {
if (!dataStarted) {
if (line.startsWith("rsid")) {
dataStarted = true;
}
continue;
}

return snpData;
String[] parts = line.split("\t");
if (parts.length == 5) {
String rsid = parts[0];
String genotype = parts[3];
snpData.put(rsid, genotype);
}
}
}

public static void main(String[] args) {
try {
Map<String, String> data23andMe = uploadFrom23andMe("path/to/23andMe_data.txt");
System.out.println("23andMe data loaded. Total SNPs: " + data23andMe.size());
return snpData;
}

Map<String, String> dataAncestryDNA = uploadFromAncestryDNA("path/to/AncestryDNA_data.txt");
System.out.println("AncestryDNA data loaded. Total SNPs: " + dataAncestryDNA.size());
public static void main(String[] args) {
try {
Map<String, String> data23andMe = uploadFrom23andMe("path/to/23andMe_data.txt");
System.out.println("23andMe data loaded. Total SNPs: " + data23andMe.size());

} catch (IOException e) {
e.printStackTrace();
}
Map<String, String> dataAncestryDNA = uploadFromAncestryDNA("path/to/AncestryDNA_data.txt");
System.out.println("AncestryDNA data loaded. Total SNPs: " + dataAncestryDNA.size());

} catch (IOException e) {
e.printStackTrace();
}
}
}
}

0 comments on commit 16492d3

Please sign in to comment.