Skip to content

Commit

Permalink
Merge pull request #62 from friendsofstrandseq/weber8thomas/fix-slurm…
Browse files Browse the repository at this point in the history
…-time-issue

weber8thomas/fix slurm time issue
  • Loading branch information
weber8thomas authored Jul 1, 2024
2 parents 9a77a9e + 6fcffbc commit 2917dc3
Show file tree
Hide file tree
Showing 8 changed files with 759 additions and 69 deletions.
56 changes: 28 additions & 28 deletions .github/workflows/advanced.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ on:
jobs:
Testing-with-MultiQC:
runs-on: ubuntu-latest
needs:
- Formatting
- Linting
- Testing-basic-v7
- Testing-basic-with-ashleys
# needs:
# - Formatting
# - Linting
# - Testing-basic-v7
# - Testing-basic-with-ashleys
steps:
- name: Checkout repository with submodules
uses: actions/checkout@v4
Expand All @@ -32,8 +32,8 @@ jobs:

- name: Git Submodule Update
run: |
git pull --recurse-submodules
git submodule update --remote --recursive
# git pull --recurse-submodules
git submodule update --remote --recursive --force --init
- name: Setup Python
uses: actions/setup-python@v5
Expand All @@ -60,11 +60,11 @@ jobs:
Testing-with-ms-norm:
runs-on: ubuntu-latest
needs:
- Formatting
- Linting
- Testing-basic-v7
- Testing-basic-with-ashleys
# needs:
# - Formatting
# - Linting
# - Testing-basic-v7
# - Testing-basic-with-ashleys
steps:
- name: Checkout repository with submodules
uses: actions/checkout@v4
Expand All @@ -74,8 +74,8 @@ jobs:

- name: Git Submodule Update
run: |
git pull --recurse-submodules
git submodule update --remote --recursive
# git pull --recurse-submodules
git submodule update --remote --recursive --force --init
- name: Setup Python
uses: actions/setup-python@v5
Expand All @@ -102,11 +102,11 @@ jobs:
Testing-with-breakpointR-only:
runs-on: ubuntu-latest
needs:
- Formatting
- Linting
- Testing-basic-v7
- Testing-basic-with-ashleys
# needs:
# - Formatting
# - Linting
# - Testing-basic-v7
# - Testing-basic-with-ashleys
steps:
- name: Checkout repository with submodules
uses: actions/checkout@v4
Expand All @@ -116,8 +116,8 @@ jobs:

- name: Git Submodule Update
run: |
git pull --recurse-submodules
git submodule update --remote --recursive
# git pull --recurse-submodules
git submodule update --remote --recursive --force --init
- name: Setup Python
uses: actions/setup-python@v5
Expand All @@ -144,11 +144,11 @@ jobs:
Testing-with-whatshap-only:
runs-on: ubuntu-latest
needs:
- Formatting
- Linting
- Testing-basic-v7
- Testing-basic-with-ashleys
# needs:
# - Formatting
# - Linting
# - Testing-basic-v7
# - Testing-basic-with-ashleys
steps:
- name: Checkout repository with submodules
uses: actions/checkout@v4
Expand All @@ -158,8 +158,8 @@ jobs:

- name: Git Submodule Update
run: |
git pull --recurse-submodules
git submodule update --remote --recursive
# git pull --recurse-submodules
git submodule update --remote --recursive --force --init
- name: Setup Python
uses: actions/setup-python@v5
Expand Down
64 changes: 32 additions & 32 deletions .github/workflows/assemblies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@ on:
jobs:
Testing-with-hg38:
runs-on: ubuntu-latest
needs:
- Formatting
- Linting
- Testing-basic-v7
- Testing-basic-with-ashleys
# needs:
# - Formatting
# - Linting
# - Testing-basic-v7
# - Testing-basic-with-ashleys
# - Testing-basic-with-slurm
steps:
- name: Checkout repository with submodules and LFS
uses: actions/checkout@v4
with:
submodules: recursive
lfs: true
# lfs: true

- name: Git Submodule Update
run: |
git pull --recurse-submodules
git submodule update --remote --recursive
# git pull --recurse-submodules
git submodule update --remote --recursive --force --init
- name: Setup Python
uses: actions/setup-python@v5
Expand All @@ -61,23 +61,23 @@ jobs:
Testing-with-hg19:
runs-on: ubuntu-latest
needs:
- Formatting
- Linting
- Testing-basic-v7
- Testing-basic-with-ashleys
# needs:
# - Formatting
# - Linting
# - Testing-basic-v7
# - Testing-basic-with-ashleys
# - Testing-basic-with-slurm
steps:
- name: Checkout repository with submodules and LFS
uses: actions/checkout@v4
with:
submodules: recursive
lfs: true
# lfs: true

- name: Git Submodule Update
run: |
git pull --recurse-submodules
git submodule update --remote --recursive
# git pull --recurse-submodules
git submodule update --remote --recursive --force --init
- name: Setup Python
uses: actions/setup-python@v5
Expand All @@ -104,23 +104,23 @@ jobs:
Testing-with-T2T:
runs-on: ubuntu-latest
needs:
- Formatting
- Linting
- Testing-basic-v7
- Testing-basic-with-ashleys
# needs:
# - Formatting
# - Linting
# - Testing-basic-v7
# - Testing-basic-with-ashleys
# - Testing-basic-with-slurm
steps:
- name: Checkout repository with submodules and LFS
uses: actions/checkout@v4
with:
submodules: recursive
lfs: true
# lfs: true

- name: Git Submodule Update
run: |
git pull --recurse-submodules
git submodule update --remote --recursive
# git pull --recurse-submodules
git submodule update --remote --recursive --force --init
- name: Setup Python
uses: actions/setup-python@v5
Expand All @@ -147,23 +147,23 @@ jobs:
Testing-with-mm10:
runs-on: ubuntu-latest
needs:
- Formatting
- Linting
- Testing-basic-v7
- Testing-basic-with-ashleys
# needs:
# - Formatting
# - Linting
# - Testing-basic-v7
# - Testing-basic-with-ashleys
# - Testing-basic-with-slurm
steps:
- name: Checkout repository with submodules and LFS
uses: actions/checkout@v4
with:
submodules: recursive
lfs: true
# lfs: true

- name: Git Submodule Update
run: |
git pull --recurse-submodules
git submodule update --remote --recursive
# git pull --recurse-submodules
git submodule update --remote --recursive --force --init
- name: Setup Python
uses: actions/setup-python@v5
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ jobs:
# Update references
- name: Git Submodule Update
run: |
git pull --recurse-submodules
git submodule update --remote --recursive
# git pull --recurse-submodules
git submodule update --remote --recursive --force --init
- name: Setup Python
uses: actions/setup-python@v5
Expand Down Expand Up @@ -125,8 +125,8 @@ jobs:

- name: Git Submodule Update
run: |
git pull --recurse-submodules
git submodule update --remote --recursive
# git pull --recurse-submodules
git submodule update --remote --recursive --force --init
- name: Setup Python
uses: actions/setup-python@v5
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/main_v8.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ jobs:
# - Formatting
# - Linting
steps:
- name: Checkout repository with submodules and LFS
- name: Checkout repository with submodules
uses: actions/checkout@v4
with:
submodules: recursive
lfs: true
# lfs: true

- name: Git Submodule Update
run: |
git pull --recurse-submodules
git submodule update --remote --recursive
# git pull --recurse-submodules
git submodule update --remote --recursive --force --init
- name: Setup Python
uses: actions/setup-python@v5
Expand Down
76 changes: 76 additions & 0 deletions afac/reorganise_landsdorp_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import os
import shutil
import sys
import pandas as pd
import logging

# Set up logging
logging.basicConfig(
level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s"
)


def rename_and_copy_fastq_files(
source_directory, target_directory, sample_name, cell_name
):
if not os.path.exists(target_directory):
os.makedirs(target_directory, exist_ok=True)
logging.info(f"Created directory: {target_directory}")

for filename in os.listdir(source_directory):
if filename.endswith(".fastq.gz"):
new_filename = f"{cell_name}-{sample_name}-{filename}"
if ".1." or ".2." not in new_filename:
new_filename = new_filename.replace(
".fastq.gz", ".1.fastq.gz"
) # Format with cell_name and sample_name

logging.info(f"Target directory: {target_directory}")
logging.info(f"New filename: {new_filename}")

source_path = os.path.join(source_directory, filename)
target_path = os.path.join(target_directory, new_filename)
shutil.copy2(source_path, target_path)
logging.info(f"Copied and renamed from {source_path} to {target_path}")
# exit()


def process_samples(excel_path, source_base_directory, target_base_directory):
sample_data = pd.read_csv(excel_path, sep="\t")
# sample_data = sample_data.loc[sample_data["LIBRARY_LAYOUT"] == "SINGLE"]
sample_data["Sample_Name"] = sample_data["Source Name"].apply(
lambda x: x.split("_")[0]
)
sample_data = sample_data[
["Sample_Name", "Characteristics[cell line]"]
].drop_duplicates()
print(sample_data)
exit()
for index, row in sample_data.iterrows():
source_name = row["Sample_Name"]
cell_line = row["Characteristics[cell line]"]

source_directory = os.path.join(source_base_directory, source_name, "fastq")
logging.info(f"Source directory: {source_directory}")
logging.info(f"Source name: {source_name}")
logging.info(f"Cell line: {cell_line}")
logging.info(f"Target base directory: {target_base_directory}")
target_directory = os.path.join(target_base_directory, cell_line, "fastq")

if os.path.exists(source_directory):
rename_and_copy_fastq_files(
source_directory, target_directory, source_name, cell_line
)
else:
logging.warning(f"Source directory not found: {source_directory}")


if __name__ == "__main__":
if len(sys.argv) != 4:
logging.error(
"Usage: python script.py <path_to_excel> <source_base_directory> <target_base_directory>"
)
sys.exit(1)

_, excel_path, source_base_directory, target_base_directory = sys.argv
process_samples(excel_path, source_base_directory, target_base_directory)
Loading

0 comments on commit 2917dc3

Please sign in to comment.