Skip to content

Commit

Permalink
Merge pull request #124 from SanojPunchihewa/bug-fixes
Browse files Browse the repository at this point in the history
Bug fixes
  • Loading branch information
SanojPunchihewa authored Feb 14, 2020
2 parents 4286231 + 503e77d commit 5db20d3
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,15 @@ protected void onCreate(@Nullable final Bundle savedInstanceState) {
@Override
public void onClick(final View v) {
btnDownloadAndExtract.setEnabled(false);
String datasetFolder = Environment.getExternalStorageDirectory() + "/" + folderName
+ "/ecoli-data-set";
FileUtil.deleteFolder(new File(datasetFolder));
downloadDataSet(ecoliDataSetURL);
}
});
linearLayout.addView(btnDownloadAndExtract);

txtLogView = new TextView(this);
// txtLogView.setTextSize(f);
linearLayout.addView(txtLogView);

btnRunPipeline = new Button(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import com.mobilegenomics.f5n.support.DownloadManager;
import com.mobilegenomics.f5n.support.PipelineState;
import com.mobilegenomics.f5n.support.PreferenceUtil;
import com.mobilegenomics.f5n.support.TimeFormat;
import com.mobilegenomics.f5n.support.ZipListener;
import com.mobilegenomics.f5n.support.ZipManager;
import com.obsez.android.lib.filechooser.ChooserDialog;
Expand All @@ -46,6 +47,8 @@ public class DownloadActivity extends AppCompatActivity {

class FTPDownloadTask extends AsyncTask<String, Long, Boolean> {

long downloadStartTime;

long fileSize;

boolean status;
Expand Down Expand Up @@ -93,8 +96,10 @@ public void bytesTransferred(long totalBytesTransferred, int bytesTransferred, l
protected void onPostExecute(final Boolean downloadSuccess) {
super.onPostExecute(downloadSuccess);
Log.i(TAG, "Download Finished");
long downloadTime = System.currentTimeMillis() - downloadStartTime;
if (downloadSuccess) {
statusTextView.setText("Download Completed");
String time = TimeFormat.millisToShortDHMS(downloadTime);
statusTextView.setText("Download Completed in " + time);
} else {
statusTextView.setText("Download Error");
}
Expand All @@ -105,6 +110,7 @@ protected void onPostExecute(final Boolean downloadSuccess) {
protected void onPreExecute() {
super.onPreExecute();
Log.i(TAG, "Download Started");
downloadStartTime = System.currentTimeMillis();
statusTextView.setText("Download Started");
progressBar.setMax(100);
disableButtons();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.mobilegenomics.f5n.support.PreferenceUtil;
import com.mobilegenomics.f5n.support.ServerCallback;
import com.mobilegenomics.f5n.support.ServerConnectionUtils;
import com.mobilegenomics.f5n.support.TimeFormat;
import com.mobilegenomics.f5n.support.ZipListener;
import com.mobilegenomics.f5n.support.ZipManager;
import com.obsez.android.lib.filechooser.ChooserDialog;
Expand All @@ -53,6 +54,8 @@ class FTPUploadTask extends AsyncTask<String, Long, Boolean> {

long fileSize;

long uploadStartTime;

@Override
protected Boolean doInBackground(String... urls) {
FTPClient con;
Expand Down Expand Up @@ -107,11 +110,13 @@ protected void onCancelled() {
protected void onPostExecute(final Boolean uploadSuccess) {
super.onPostExecute(uploadSuccess);
Log.i(TAG, "Upload Finished");
long uploadTime = System.currentTimeMillis() - uploadStartTime;
if (uploadSuccess) {
String time = TimeFormat.millisToShortDHMS(uploadTime);
GUIConfiguration.setPipelineState(PipelineState.COMPLETED);
PreferenceUtil
.setSharedPreferenceInt(R.string.id_app_mode, GUIConfiguration.getPipelineState().ordinal());
statusTextView.setText("Upload Completed");
statusTextView.setText("Upload Completed in " + time);
sendJobResults();
} else {
statusTextView.setText("Upload Error");
Expand All @@ -121,6 +126,7 @@ protected void onPostExecute(final Boolean uploadSuccess) {
@Override
protected void onPreExecute() {
super.onPreExecute();
uploadStartTime = System.currentTimeMillis();
statusTextView.setText("Upload started");
}

Expand Down
12 changes: 12 additions & 0 deletions app/src/main/java/com/mobilegenomics/f5n/support/FileUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -235,4 +235,16 @@ public static boolean isFileInExternalSdCard(String filePath) {
return !filePath.contains(internalStorage);
}

/**
* Delete a folder and its content
*/
public static void deleteFolder(File fodler) {
if (fodler.isDirectory()) {
for (File child : fodler.listFiles()) {
deleteFolder(child);
}
}
fodler.delete();
}

}
50 changes: 19 additions & 31 deletions app/src/main/res/raw/f5c_call_methylation_arguments.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@
},
{
"argName": "batch size",
"argValue": "512",
"argDescription": "batch size -max number of reads loaded at once [512]",
"argValue": "256",
"argDescription": "batch size -max number of reads loaded at once [256]",
"flag": "-K",
"argID": "tobedecided",
"isDependentOn": "argIDofanotherArg",
"hasFlag": true,
"flagOnly": false,
"required": false,
"required": true,
"isFile": false
},
{
Expand All @@ -84,33 +84,21 @@
"required": true,
"isFile": false
},
{
"argName": "help",
"argValue": null,
"argDescription": "help",
"flag": "-h",
"argID": "tobedecided",
"isDependentOn": "argIDofanotherArg",
"hasFlag": true,
"flagOnly": true,
"required": false,
"isFile": false
},
{
"argName": "min map quality",
"argValue": "0",
"argValue": null,
"argDescription": "minimum mapping quality [30]",
"flag": "--min-mapq",
"argID": "tobedecided",
"isDependentOn": "argIDofanotherArg",
"hasFlag": true,
"flagOnly": false,
"required": true,
"required": false,
"isFile": false
},
{
"argName": "consider secondary map",
"argValue": "no",
"argValue": null,
"argDescription": "consider secondary mappings or not [no]",
"flag": "--secondary=",
"argID": "tobedecided",
Expand All @@ -121,22 +109,22 @@
"isFile": false
},
{
"argName": "skip unreadable or terminate",
"argValue": "yes",
"argDescription": "skip any unreadable fast5 or terminate program [yes]",
"flag": "--skip-unreadable=",
"argName": "skip ultra long reads and write to file",
"argValue": null,
"argDescription": "skip ultra long reads and write those entries to the bam file provided as the argument",
"flag": "--skip-ultra",
"argID": "tobedecided",
"isDependentOn": "argIDofanotherArg",
"hasFlag": true,
"flagOnly": false,
"required": false,
"isFile": false
"isFile": true
},
{
"argName": "verbosity",
"argValue": "0",
"argDescription": "verbosity level [0]",
"flag": "--verbose",
"argName": "threshold to skip ultra long reads",
"argValue": null,
"argDescription": "threshold to skip ultra long reads [100000]",
"flag": "--ultra-thresh",
"argID": "tobedecided",
"isDependentOn": "argIDofanotherArg",
"hasFlag": true,
Expand All @@ -145,14 +133,14 @@
"isFile": false
},
{
"argName": "version",
"argName": "verbosity",
"argValue": null,
"argDescription": "print version",
"flag": "--version",
"argDescription": "verbosity level [0]",
"flag": "--verbose",
"argID": "tobedecided",
"isDependentOn": "argIDofanotherArg",
"hasFlag": true,
"flagOnly": true,
"flagOnly": false,
"required": false,
"isFile": false
}
Expand Down

0 comments on commit 5db20d3

Please sign in to comment.