Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transform_bc.py missing? #1

Open
afvallejo opened this issue Jun 21, 2021 · 5 comments
Open

transform_bc.py missing? #1

afvallejo opened this issue Jun 21, 2021 · 5 comments
Assignees

Comments

@afvallejo
Copy link

Hi, Thank you very much for this amzing work, I was trying to use your pipeline, however seem like the transform_bc.py file is mising from the repository. Could you please let me know how can i get tha file? or how to format the BC for the input

best

Andres

@Psy-Fer
Copy link
Collaborator

Psy-Fer commented Jun 21, 2021

Hello,

I'll add the file in when I get the chance tomorrow. But here is a quick copy/paste with my phone that should work.

import sys

filename = sys.argv[1]
header = int(sys.argv[2])

head = False
if header:
    head = True

count = 0
# first = '\t'.join(['index', 'fwd_bc', 'rev_bc', 'gene_num', 'UMI_num'])
first = '\t'.join(['index', 'fwd_bc', 'rev_bc'])
print first
with open(filename, 'r') as f:
    for l in f:
        if head:
            head = False
            continue
        count += 1
        l = l.strip('\r\n')
        l = l.strip('\r')
        l = l.strip('\n')
        l = l.split(',')
        l = [i.strip('"') for i in l]
        l[0] = l[0].split('-')[0]
        rev = []
        for i in l[0]:
            if i == 'A':
                rev.append('T')
            elif i == 'T':
                rev.append('A')
            elif i == 'G':
                rev.append('C')
            elif i == 'C':
                rev.append('G')
            else:
                print >> sys.stderr, "Something is wrong, try again", l
        out = ''.join(rev[::-1])
        # print '\t'.join([str(count), l[0], out, l[1], l[2]])
        print '\t'.join([str(count), l[0], out])

@Psy-Fer Psy-Fer self-assigned this Jun 21, 2021
@afvallejo
Copy link
Author

afvallejo commented Jun 21, 2021 via email

@jkbenotmane
Copy link

What should be the input for this? The Barcodes from cellranger?
Best wishes

@Psy-Fer
Copy link
Collaborator

Psy-Fer commented Jun 29, 2021

Hello,

This was built to accommodate the ever changing and bug ridden formats I was given from the illumina/cell ranger side of things.

But I'll upload a simplified version now, that takes a flat list of barcodes, for example, the input file would look like this:

AAACAACGAATAGTTC
AAACAAGTATCTCCCA
AAACAATCTACTAGCA
AAACACCAATAACTGC
AAACAGAGCGACTCCT
AAACAGCTTTCAGAAG
AAACAGGGTCTATATT
AAACAGTGTTCCTGGG
AAACATGGTGAGAGGA
AAACATTTCCCGGATT

And the output would be in the format needed for the demultiplexing.

James F.

@Psy-Fer
Copy link
Collaborator

Psy-Fer commented Jun 29, 2021

Alright, so if you have barcodes that look like this in a file

filtered_pass_barcodes.txt

AAACCTGAGCACACAG
AAACCTGAGCGTAGTG
AAACCTGAGGCTACGA
AAACCTGCAAGACACG
AAACCTGCATGAACCT
AAACCTGGTTCGAATC
AAACGGGAGAGAGCTC
AAACGGGAGGTACTCT
AAACGGGAGTGTCCCG
AAACGGGTCTTTACAC

then you do

python barcode_transform.py filtered_pass_barcodes.txt > transformed_barcodes.tsv

Then you can use this file for the demultiplexing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants