Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/gabe-dubose/emus
27 October 2023, 08:23:24 UTC
  • Code
  • Branches (1)
  • Releases (0)
  • Visits
Revision 7e564642a8534324a40203783498dd8d6501e030 authored by Gabe DuBose on 15 May 2022, 13:05:17 UTC, committed by Gabe DuBose on 15 May 2022, 13:05:17 UTC
Updated simulation script
1 parent 5305461
  • Files
  • Changes
    • Branches
    • Releases
    • HEAD
    • refs/heads/main
    • 7e564642a8534324a40203783498dd8d6501e030
    No releases to show
  • 5541b2c
  • /
  • emus
  • /
  • plot_vcf_histogram.py
Raw File Download Save again
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • revision
  • directory
  • content
  • snapshot
origin badgerevision badge
swh:1:rev:7e564642a8534324a40203783498dd8d6501e030
origin badgedirectory badge
swh:1:dir:27a089d6a1ee0b2918edefba57b84e90f8fbf402
origin badgecontent badge
swh:1:cnt:f8daca2984982482e8e29bcf99e4b1282175c0bd
origin badgesnapshot badge
swh:1:snp:2bd7ed1081ff598939e948409013744f1715835b

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • revision
  • directory
  • content
  • snapshot
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
Tip revision: 7e564642a8534324a40203783498dd8d6501e030 authored by Gabe DuBose on 15 May 2022, 13:05:17 UTC
Updated simulation script
Tip revision: 7e56464
plot_vcf_histogram.py
#!/usr/bin/env python3

import argparse
import re
import matplotlib.pyplot as plt

parser = argparse.ArgumentParser()
parser.add_argument('-i', '--input', metavar = '<Input VCF File>', 
    help = "VCF file for variant distribution plotting; a separate plot will be made for each unique sequence ID")
parser.add_argument('-o', '--outdir', metavar='<Directory name>', 
    help = "Directory to save histogram plots to")
args = parser.parse_args()

class VariantData:
    def __init__(self, data):
        self.data = data
        
    #function to get variant positions for each sequence
    def extract_data(self, data):
        variant_positions = {}
        with open(data, 'r') as datafile:
            lines = datafile.readlines()
            for line in lines:
                metadata = bool(re.match("^#", line))
                if metadata == False:
                    sequence_id = line.split('\t')[0]
                    position = line.split('\t')[1]
                    if sequence_id not in variant_positions:
                        variant_positions[sequence_id] = []
                    variant_positions[sequence_id].append(position)

        return variant_positions

#define variant data object and get data
variants_data = VariantData(args.input)
variant_positions = variants_data.extract_data(args.input)

#plot variant histograms
for sequence in variant_positions:
    data = [int(x) for x in variant_positions[sequence]]

    plt.figure(figsize=(10,5)).tight_layout()
    plt.grid(zorder=1)
    plt.hist(data, 100, color = 'lightsalmon', zorder = 2)
    plt.margins(x=0)
    plt.title(f'{sequence}')   
    pdf = f"{args.outdir}/{sequence}_hist.pdf"
    plt.savefig(pdf)
The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API